orderItem.vue 6.6 KB

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