orderItem.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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 v-if="noPick" class="pay-info">总价¥{{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" @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="noPick" @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. noPick: {
  47. default: true
  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. }
  72. },
  73. },
  74. data() {
  75. return {}
  76. },
  77. onLoad() {},
  78. methods: {
  79. // 获取订单总价
  80. getAllPrice() {
  81. let price = this.orderData.products.reduce((total, site) => {
  82. return total + site.bizPrice * site.buyNum
  83. }, 0)
  84. return price.toFixed(2)
  85. },
  86. // 获取订单类型
  87. getOrderType(type) {
  88. switch (type) {
  89. case 1:
  90. return '待付款'
  91. break;
  92. case 2:
  93. return '待发货'
  94. break;
  95. case 3:
  96. return '已发货'
  97. break;
  98. case 4:
  99. return '已收货'
  100. break;
  101. case 5:
  102. return '已完成'
  103. break;
  104. default:
  105. return '已取消'
  106. }
  107. },
  108. // 操作区分
  109. handleOrder(type) {
  110. if (type == 1) {
  111. // 发货
  112. uni.navigateTo({
  113. url: '/pagesMain/bindOrder?orderId=' + this.orderData.orderId
  114. });
  115. } else if (type == 2) {
  116. // 追踪物流
  117. uni.navigateTo({
  118. url: '/pagesMain/logisticsDeatil?logisticCode=' + this.orderData.logisticsNum
  119. });
  120. } else if (type == 3) {
  121. // 回复
  122. uni.navigateTo({
  123. url: '/pagesMain/evaluateForm?orderId=' + this.orderData.orderId + '&mid='+this.orderData.mid
  124. });
  125. } else if (type == 6) {
  126. // 自助采摘
  127. uni.navigateTo({
  128. url: '/pagesMedia/pickVideo?tenantCode=' + this.orderData.tenantCode + '&orderId=' + this.orderData.orderId
  129. });
  130. }
  131. },
  132. // 跳转订单详情
  133. goToOrderDetail() {
  134. if (this.noPick) {
  135. uni.navigateTo({
  136. url: '/pagesMain/orderDetail?orderId=' + this.orderData.orderId + '&orderStatus=' + this.orderData.orderStatus
  137. });
  138. } else {
  139. // 自助采摘
  140. uni.navigateTo({
  141. url: '/pagesMedia/pickVideo?tenantCode=' + this.orderData.tenantCode + '&orderId=' + this.orderData.orderId
  142. });
  143. }
  144. },
  145. }
  146. }
  147. </script>
  148. <style lang="less" scoped>
  149. .order-row {
  150. width: 100%;
  151. float: left;
  152. margin: 0 0 15px 0;
  153. background: #FFFFFF;
  154. border-radius: 10px;
  155. .shop-info {
  156. width: 100%;
  157. height: 48px;
  158. float: left;
  159. box-sizing: border-box;
  160. padding: 13px 15px 12px 15px;
  161. border-bottom: 1px solid #EEEEEE;
  162. line-height: 22px;
  163. .iconwode {
  164. font-size: 22px;
  165. color: #333333;
  166. }
  167. .shop-name {
  168. font-size: 15px;
  169. font-family: PingFang SC;
  170. color: #333333;
  171. margin: 0 8px 0 10px;
  172. }
  173. .iconshangjia {
  174. font-size: 12px;
  175. color: #999999;
  176. }
  177. .order-type {
  178. float: right;
  179. font-size: 15px;
  180. font-family: PingFang SC;
  181. color: #52A63A;
  182. }
  183. }
  184. .goods-list {
  185. width: 100%;
  186. float: left;
  187. box-sizing: border-box;
  188. padding: 10px 15px 0 15px;
  189. .goods-row {
  190. width: 100%;
  191. height: 90px;
  192. float: left;
  193. display: flex;
  194. margin-bottom: 10px;
  195. .goods-img {
  196. width: 90px;
  197. height: 90px;
  198. border-radius: 5px;
  199. object-fit: cover;
  200. }
  201. .goods-info {
  202. width: calc(100% - 106px);
  203. height: 90px;
  204. margin-left: 16px;
  205. .goods-name {
  206. width: 100%;
  207. height: 36px;
  208. float: left;
  209. font-size: 14px;
  210. font-family: PingFang SC;
  211. color: #333333;
  212. line-height: 18px;
  213. overflow: hidden;
  214. text-overflow: ellipsis;
  215. display: -webkit-box;
  216. -webkit-line-clamp: 2;
  217. -webkit-box-orient: vertical;
  218. word-wrap: break-word;
  219. }
  220. .goods-type {
  221. height: 20px;
  222. float: left;
  223. background: #F0F0F0;
  224. border-radius: 4px;
  225. padding: 0 8px;
  226. margin: 6px 0;
  227. font-size: 10px;
  228. font-family: PingFang SC;
  229. color: #666666;
  230. line-height: 20px;
  231. }
  232. .goods-price-number {
  233. width: 100%;
  234. height: 20px;
  235. float: left;
  236. line-height: 20px;
  237. font-family: PingFang SC;
  238. color: #333333;
  239. .goods-unit {
  240. font-size: 12px;
  241. }
  242. .goods-price {
  243. font-size: 15px;
  244. margin-right: 6px;
  245. }
  246. .goods-number {
  247. font-size: 12px;
  248. }
  249. }
  250. }
  251. }
  252. }
  253. .pay-info {
  254. width: 100%;
  255. float: left;
  256. box-sizing: border-box;
  257. padding: 20px 15px 16px 15px;
  258. font-size: 12px;
  259. font-family: PingFang SC;
  260. color: #333333;
  261. line-height: 16px;
  262. text-align: right;
  263. }
  264. .handle-box {
  265. width: calc(100% - 30px);
  266. height: 51px;
  267. float: left;
  268. margin: 0 15px;
  269. box-sizing: border-box;
  270. padding: 10px 0;
  271. border-top: 1px solid #EEEEEE;
  272. text-align: right;
  273. .handle-button {
  274. color: #333333 !important;
  275. border-color: #BFBFBF !important;
  276. background-color: #FFFFFF !important;
  277. padding: 0;
  278. margin-left: 8px;
  279. height: 30px;
  280. line-height: 30px;
  281. }
  282. }
  283. }
  284. </style>