orderItem.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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. handleOrder(type) {
  111. if (type == 1) {
  112. // 发货
  113. uni.navigateTo({
  114. url: '/pagesMain/bindOrder?orderId=' + this.orderData.orderId
  115. });
  116. } else if (type == 2) {
  117. // 追踪物流
  118. uni.navigateTo({
  119. url: '/pagesMain/logisticsDeatil?logisticCode=' + this.orderData.logisticsNum
  120. });
  121. } else if (type == 3) {
  122. // 回复
  123. uni.navigateTo({
  124. url: '/pagesMain/evaluateForm?orderId=' + this.orderData.orderId + '&mid='+this.orderData.mid
  125. });
  126. } else if (type == 6) {
  127. // 自助采摘
  128. uni.navigateTo({
  129. url: '/pagesMedia/pickVideo?tenantCode=' + this.orderData.tenantCode + '&orderId=' + this.orderData.orderId
  130. });
  131. }
  132. },
  133. // 跳转订单详情
  134. goToOrderDetail() {
  135. // if (this.orderData.noPick) {
  136. uni.navigateTo({
  137. url: '/pagesMain/orderDetail?orderId=' + this.orderData.orderId + '&orderStatus=' + this.orderData.orderStatus
  138. });
  139. // } else {
  140. // // 自助采摘
  141. // uni.navigateTo({
  142. // url: '/pagesMedia/pickVideo?tenantCode=' + this.orderData.tenantCode + '&orderId=' + this.orderData.orderId
  143. // });
  144. // }
  145. },
  146. }
  147. }
  148. </script>
  149. <style lang="less" scoped>
  150. .order-row {
  151. width: 100%;
  152. float: left;
  153. margin: 0 0 15px 0;
  154. background: #FFFFFF;
  155. border-radius: 10px;
  156. .shop-info {
  157. width: 100%;
  158. height: 48px;
  159. float: left;
  160. box-sizing: border-box;
  161. padding: 13px 15px 12px 15px;
  162. border-bottom: 1px solid #EEEEEE;
  163. line-height: 22px;
  164. .iconwode {
  165. font-size: 22px;
  166. color: #333333;
  167. }
  168. .shop-name {
  169. font-size: 15px;
  170. font-family: PingFang SC;
  171. color: #333333;
  172. margin: 0 8px 0 10px;
  173. }
  174. .iconshangjia {
  175. font-size: 12px;
  176. color: #999999;
  177. }
  178. .order-type {
  179. float: right;
  180. font-size: 15px;
  181. font-family: PingFang SC;
  182. color: #52A63A;
  183. }
  184. }
  185. .goods-list {
  186. width: 100%;
  187. float: left;
  188. box-sizing: border-box;
  189. padding: 10px 15px 0 15px;
  190. .goods-row {
  191. width: 100%;
  192. height: 90px;
  193. float: left;
  194. display: flex;
  195. margin-bottom: 10px;
  196. .goods-img {
  197. width: 90px;
  198. height: 90px;
  199. border-radius: 5px;
  200. object-fit: cover;
  201. }
  202. .goods-info {
  203. width: calc(100% - 106px);
  204. height: 90px;
  205. margin-left: 16px;
  206. .goods-name {
  207. width: 100%;
  208. height: 36px;
  209. float: left;
  210. font-size: 14px;
  211. font-family: PingFang SC;
  212. color: #333333;
  213. line-height: 18px;
  214. overflow: hidden;
  215. text-overflow: ellipsis;
  216. display: -webkit-box;
  217. -webkit-line-clamp: 2;
  218. -webkit-box-orient: vertical;
  219. word-wrap: break-word;
  220. }
  221. .goods-type {
  222. height: 20px;
  223. float: left;
  224. background: #F0F0F0;
  225. border-radius: 4px;
  226. padding: 0 8px;
  227. margin: 6px 0;
  228. font-size: 10px;
  229. font-family: PingFang SC;
  230. color: #666666;
  231. line-height: 20px;
  232. }
  233. .goods-price-number {
  234. width: 100%;
  235. height: 20px;
  236. float: left;
  237. line-height: 20px;
  238. font-family: PingFang SC;
  239. color: #333333;
  240. .goods-unit {
  241. font-size: 12px;
  242. }
  243. .goods-price {
  244. font-size: 15px;
  245. margin-right: 6px;
  246. }
  247. .goods-number {
  248. font-size: 12px;
  249. }
  250. }
  251. }
  252. }
  253. }
  254. .pay-info {
  255. width: 100%;
  256. float: left;
  257. box-sizing: border-box;
  258. padding: 20px 15px 16px 15px;
  259. font-size: 12px;
  260. font-family: PingFang SC;
  261. color: #333333;
  262. line-height: 16px;
  263. text-align: right;
  264. }
  265. .handle-box {
  266. width: calc(100% - 30px);
  267. height: 51px;
  268. float: left;
  269. margin: 0 15px;
  270. box-sizing: border-box;
  271. padding: 10px 0;
  272. border-top: 1px solid #EEEEEE;
  273. text-align: right;
  274. .handle-button {
  275. height: 30px;
  276. margin-left: 8px;
  277. margin-bottom: 10px;
  278. line-height: 28px;
  279. text-align: center;
  280. box-sizing: border-box;
  281. display: inline-block;
  282. border-radius: 15px;
  283. /deep/button {
  284. padding: 0 12px;
  285. border: 1px solid #BFBFBF !important;
  286. background-color: #FFFFFF!important;
  287. color: #333333 !important;
  288. }
  289. }
  290. }
  291. }
  292. </style>