orderItem.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <view class="order-row" @click="goToOrderDetail()">
  3. <view class="shop-info" v-if="orderData">
  4. <text class="iconfont iconwode"></text>
  5. <text class="shop-name">{{orderData.nickname}}</text>
  6. <text class="order-type">{{getOrderType(orderData.orderStatus)}}</text>
  7. </view>
  8. <view class="goods-list" v-if="orderData">
  9. <view class="goods-row" v-for="(site, index) in orderData.products" :key="index">
  10. <image class="goods-img" :src="site.imgUrl" mode="aspectFill"></image>
  11. <view class="goods-info">
  12. <view class="goods-name">{{site.productName}}</view>
  13. <view class="goods-type">
  14. 类型:{{site.productType == 1 ? '普通商品' : (site.productType == 2 ? '拍卖' : (site.productType == 3 ? '自助采摘' : '共享种植'))}}
  15. </view>
  16. <view class="goods-price-number">
  17. <text class="goods-unit">¥</text>
  18. <text class="goods-price">{{site.bizPrice}}</text>
  19. <text class="goods-number">x{{site.buyNum}}</text>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="pay-info" v-if="!isPick">总价¥{{getAllPrice()}},实付¥{{orderData.paySum}}</view>
  25. <view class="handle-box" v-if="(tabIndex > 1 && tabIndex < 5) || (tabIndex == 5 && orderData.evaluateStatus == 2 && orderData.evaluateReplyStatus == 1)">
  26. <u-button size="medium" :plain="true" type="success" shape="circle" :ripple="true" :hair-line="false" class="handle-button"
  27. v-if="tabIndex == 2 && orderData.auctionStatus != 1 && orderData.auctionStatus != 3" @click.stop="handleOrder(1)">发货</u-button>
  28. <u-button size="medium" :plain="true" type="success" shape="circle" :ripple="true" :hair-line="false" class="handle-button"
  29. v-if="tabIndex == 3 || tabIndex == 4" @click.stop="handleOrder(2)">追踪物流</u-button>
  30. <u-button size="medium" :plain="true" type="success" shape="circle" :ripple="true" :hair-line="false" class="handle-button"
  31. v-if="tabIndex == 5 && orderData.evaluateStatus == 2 && orderData.evaluateReplyStatus == 1" @click.stop="handleOrder(3)">回复</u-button>
  32. <u-button size="medium" :plain="true" type="success" shape="circle" :ripple="true" :hair-line="false" class="handle-button"
  33. v-if="!orderData.noPick && orderData.orderStatus == 2" @click.stop="handleOrder(6)">自助采摘</u-button>
  34. </view>
  35. <u-top-tips ref="uTips"></u-top-tips>
  36. </view>
  37. </template>
  38. <script>
  39. const NET = require('@/utils/request')
  40. const API = require('@/config/api')
  41. export default {
  42. props: {
  43. tabIndex: {
  44. default: 1
  45. },
  46. isPick: {
  47. default: false
  48. },
  49. orderData: {
  50. default: {
  51. auctionStatus: 0,
  52. orderId: 0,
  53. orderStatus: 0,
  54. evaluateReplyStatus: 0,
  55. nickname: '',
  56. logisticsNum: '',
  57. payStatus: 0,
  58. paySum: 0,
  59. products: [{
  60. bizPrice: 0,
  61. buyNum: 0,
  62. imgUrl: '',
  63. originalPrice: 0,
  64. productId: 0,
  65. productName: '',
  66. productType: 0,
  67. shoppingcartId: 0,
  68. tenantCode: ''
  69. }],
  70. supplierName: '',
  71. noPick: true
  72. }
  73. },
  74. },
  75. data() {
  76. return {}
  77. },
  78. onLoad() {},
  79. methods: {
  80. // 获取订单总价
  81. getAllPrice() {
  82. let price = this.orderData.products.reduce((total, site) => {
  83. return total + site.bizPrice * site.buyNum
  84. }, 0)
  85. return price.toFixed(2)
  86. },
  87. // 获取订单类型
  88. getOrderType(type) {
  89. switch (type) {
  90. case 1:
  91. return '待付款'
  92. break;
  93. case 2:
  94. return '待发货'
  95. break;
  96. case 3:
  97. return '已发货'
  98. break;
  99. case 4:
  100. return '已收货'
  101. break;
  102. case 5:
  103. return '已完成'
  104. break;
  105. default:
  106. return '已取消'
  107. }
  108. },
  109. // 获取拍卖状态
  110. getAuctionType(type) {
  111. switch (type) {
  112. case 1:
  113. return '竞拍中'
  114. break;
  115. case 2:
  116. return '竞拍成功'
  117. break;
  118. case 3:
  119. return '竞拍失败'
  120. break;
  121. }
  122. },
  123. // 操作区分
  124. handleOrder(type) {
  125. if (type == 1) {
  126. // 发货
  127. uni.navigateTo({
  128. url: '/pagesMain/bindOrder?orderId=' + this.orderData.orderId
  129. });
  130. } else if (type == 2) {
  131. // 追踪物流
  132. uni.navigateTo({
  133. url: '/pagesMain/logisticsDeatil?logisticCode=' + this.orderData.logisticsNum
  134. });
  135. } else if (type == 3) {
  136. // 回复
  137. uni.navigateTo({
  138. url: '/pagesMain/evaluateForm?orderId=' + this.orderData.orderId + '&mid='+this.orderData.mid
  139. });
  140. } else if (type == 6) {
  141. // 自助采摘
  142. uni.navigateTo({
  143. url: '/pagesMedia/pickVideo?tenantCode=' + this.orderData.tenantCode + '&orderId=' + this.orderData.orderId
  144. });
  145. }
  146. },
  147. // 跳转订单详情
  148. goToOrderDetail() {
  149. if (!this.isPick) {
  150. uni.navigateTo({
  151. url: '/pagesMain/orderDetail?orderId=' + this.orderData.orderId + '&orderStatus=' + this.orderData.orderStatus
  152. });
  153. } else {
  154. // 自助采摘
  155. uni.navigateTo({
  156. url: '/pagesMedia/pickVideo?tenantCode=' + this.orderData.tenantCode + '&orderId=' + this.orderData.orderId
  157. });
  158. }
  159. },
  160. }
  161. }
  162. </script>
  163. <style lang="less" scoped>
  164. .order-row {
  165. width: 100%;
  166. float: left;
  167. margin: 0 0 15px 0;
  168. background: #FFFFFF;
  169. border-radius: 10px;
  170. .shop-info {
  171. width: 100%;
  172. height: 48px;
  173. float: left;
  174. box-sizing: border-box;
  175. padding: 13px 15px 12px 15px;
  176. border-bottom: 1px solid #EEEEEE;
  177. line-height: 22px;
  178. .iconwode {
  179. font-size: 22px;
  180. color: #333333;
  181. }
  182. .shop-name {
  183. font-size: 15px;
  184. font-family: PingFang SC;
  185. color: #333333;
  186. margin: 0 8px 0 10px;
  187. }
  188. .iconshangjia {
  189. font-size: 12px;
  190. color: #999999;
  191. }
  192. .order-type {
  193. float: right;
  194. font-size: 15px;
  195. font-family: PingFang SC;
  196. color: #52A63A;
  197. }
  198. }
  199. .goods-list {
  200. width: 100%;
  201. float: left;
  202. box-sizing: border-box;
  203. padding: 10px 15px 0 15px;
  204. .goods-row {
  205. width: 100%;
  206. height: 90px;
  207. float: left;
  208. display: flex;
  209. margin-bottom: 10px;
  210. .goods-img {
  211. width: 90px;
  212. height: 90px;
  213. border-radius: 5px;
  214. object-fit: cover;
  215. }
  216. .goods-info {
  217. width: calc(100% - 106px);
  218. height: 90px;
  219. margin-left: 16px;
  220. .goods-name {
  221. width: 100%;
  222. height: 36px;
  223. float: left;
  224. font-size: 14px;
  225. font-family: PingFang SC;
  226. color: #333333;
  227. line-height: 18px;
  228. overflow: hidden;
  229. text-overflow: ellipsis;
  230. display: -webkit-box;
  231. -webkit-line-clamp: 2;
  232. -webkit-box-orient: vertical;
  233. word-wrap: break-word;
  234. }
  235. .goods-type {
  236. height: 20px;
  237. float: left;
  238. background: #F0F0F0;
  239. border-radius: 4px;
  240. padding: 0 8px;
  241. margin: 6px 0;
  242. font-size: 10px;
  243. font-family: PingFang SC;
  244. color: #666666;
  245. line-height: 20px;
  246. }
  247. .goods-price-number {
  248. width: 100%;
  249. height: 20px;
  250. float: left;
  251. line-height: 20px;
  252. font-family: PingFang SC;
  253. color: #333333;
  254. .goods-unit {
  255. font-size: 12px;
  256. }
  257. .goods-price {
  258. font-size: 15px;
  259. margin-right: 6px;
  260. }
  261. .goods-number {
  262. font-size: 12px;
  263. }
  264. }
  265. }
  266. }
  267. }
  268. .pay-info {
  269. width: 100%;
  270. float: left;
  271. box-sizing: border-box;
  272. padding: 20px 15px 16px 15px;
  273. font-size: 12px;
  274. font-family: PingFang SC;
  275. color: #333333;
  276. line-height: 16px;
  277. text-align: right;
  278. }
  279. .handle-box {
  280. width: calc(100% - 30px);
  281. height: 51px;
  282. float: left;
  283. margin: 0 15px;
  284. box-sizing: border-box;
  285. padding: 10px 0;
  286. border-top: 1px solid #EEEEEE;
  287. text-align: right;
  288. .handle-button {
  289. height: 30px;
  290. margin-left: 8px;
  291. margin-bottom: 10px;
  292. line-height: 28px;
  293. text-align: center;
  294. box-sizing: border-box;
  295. display: inline-block;
  296. border-radius: 15px;
  297. /deep/button {
  298. padding: 0 12px;
  299. border: 1px solid #BFBFBF !important;
  300. background-color: #FFFFFF!important;
  301. color: #333333 !important;
  302. }
  303. }
  304. }
  305. }
  306. </style>