orderDetail.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. <template>
  2. <view>
  3. <view class="header">
  4. <view class="left">{{status + (order.refund_status_text ? ':'+order.refund_status_text : '')}}</view>
  5. </view>
  6. <view class="delivery" v-if="order.have_delivered">
  7. <view class="icon">
  8. <text class="cell-icon yticon icon-huoche" style="color: #ffffff"></text>
  9. </view>
  10. <view class="info">
  11. <view v-if="order.express_number">{{order.express_company}}:{{order.express_number}}</view>
  12. <view>发货时候:{{order.deliveredtime}}</view>
  13. <!-- <text class="yticon right icon-you"></text> -->
  14. </view>
  15. </view>
  16. <view class="address" v-if="order.delivery">
  17. <view class="icon">
  18. <text class="cell-icon yticon icon-dizhi" style="color: #ffffff"></text>
  19. </view>
  20. <view class="info">
  21. <view class="name">{{order.delivery.username}}<text class="mobile">{{order.delivery.mobile}}</text></view>
  22. <view class="address">{{order.delivery.address}}</view>
  23. </view>
  24. </view>
  25. <view class="product" v-if="order.products">
  26. <view class="goods-box-single" v-for="(goodsItem, goodsIndex) in order.products" :key="goodsIndex" @click="navTo('/pages/product/product?id='+goodsItem.id+'&flash=0')">
  27. <image class="goods-img" :src="goodsItem.image" mode="aspectFill"></image>
  28. <view class="right">
  29. <text class="title clamp">{{goodsItem.title}}</text>
  30. <text class="attr-box">{{goodsItem.spec}} x {{goodsItem.number}}</text>
  31. <text class="price">{{goodsItem.price}}</text>
  32. <button class="action-btn" v-if="order.have_received != 0 && goodsItem.evaluate == false" @click.stop="button('evaluate', goodsItem)">评价</button>
  33. </view>
  34. </view>
  35. <view class="price">
  36. <view>商品总价 <text>¥ {{order.order_price}}</text></view>
  37. <view>运费 <text>¥ {{order.delivery_price}}</text></view>
  38. <view>优惠 <text>¥ {{order.discount_price}}</text></view>
  39. <view class="total">实付款(含运费) <text>¥ {{order.total_price}}</text></view>
  40. </view>
  41. </view>
  42. <view class="order" v-if="order.createtime">
  43. <view class="title">订单信息</view>
  44. <view>订单编号:{{order.out_trade_no}}</view>
  45. <view>创建时间:{{order.createtime}}</view>
  46. <view>付款时间:{{order.have_paid ? order.paidtime : '未付款'}}</view>
  47. <view>发货时间:{{order.have_delivered ? order.deliveredtime : '未发货'}}</view>
  48. <view v-if="order.have_received">成交时间:{{order.receivedtime}}</view>
  49. <view v-if="order.have_refunded">退货时间:{{order.refundedtime}}</view>
  50. </view>
  51. <view style="height: 10rpx;">
  52. <!--兼容苹果系统下margin-bottom不生效-->
  53. </view>
  54. <view class="bottom" v-if="order.state != 9">
  55. <button class="action-btn" v-if="order.state == 1" @click.stop="button('cancel')">取消订单</button>
  56. <button class="action-btn recom" v-if="order.have_paid == 0" @click.stop="button('pay')">立即支付</button>
  57. <button class="action-btn" v-if="order.have_paid != 0 && order.express_number != ''" @click.stop="button('delivery')">查看物流</button>
  58. <button class="action-btn" v-if="order.have_paid != 0 && order.have_received == 0" @click.stop="button('recerved')">确认收货</button>
  59. <button class="action-btn" v-if="order.have_paid != 0" @click.stop="button('refund')">申请售后</button>
  60. </view>
  61. <view class="bottom" v-if="order.state == 9 && order.status == -1">
  62. <button class="action-btn" v-if="order.have_paid != 0" @click.stop="button('refund')">查看售后</button>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. export default {
  68. data() {
  69. return {
  70. order_id: 0,
  71. status: '订单状态',
  72. order: {}
  73. }
  74. },
  75. onLoad(options) {
  76. this.order_id = options.order_id;
  77. this.detail(options.order_id);
  78. },
  79. methods: {
  80. async detail(order_id) {
  81. let data = await this.$api.request('/order/detail?order_id=' + order_id);
  82. uni.stopPullDownRefresh();
  83. if (data) {
  84. this.status = this.orderStateExp(data.state);
  85. this.order = data;
  86. }
  87. },
  88. // 订单状态文字和颜色
  89. orderStateExp(state) {
  90. let stateTip = '',
  91. stateTipColor = '#fa436a';
  92. switch (+state) {
  93. case 0:
  94. stateTip = '交易成功';
  95. break;
  96. case 1:
  97. stateTip = '待付款';
  98. break;
  99. case 2:
  100. stateTip = '待发货';
  101. break;
  102. case 3:
  103. stateTip = '待收货';
  104. break;
  105. case 4:
  106. stateTip = '待评价';
  107. break;
  108. case 5:
  109. stateTip = '售后';
  110. break;
  111. case 6:
  112. stateTip = '拒绝退款';
  113. break;
  114. case 9:
  115. stateTip = '订单已关闭';
  116. break;
  117. //更多自定义
  118. }
  119. return stateTip;
  120. },
  121. navTo(url) {
  122. this.$api.navTo(url);
  123. },
  124. // 按钮动作
  125. async button(action, item = {}) {
  126. let detail = false;
  127. switch (action) {
  128. case 'cancel':
  129. detail = await this.$api.prePage().cancelOrder({
  130. order_id: this.order_id
  131. });
  132. break;
  133. case 'pay':
  134. this.navTo('/pages/money/pay?order_id=' + this.order_id + '&total=' + this.order.total_price);
  135. break;
  136. case 'delivery':
  137. this.navTo('/pages/order/express?expresssn=' + this.order.express_number + '&express=' + this.order.express);
  138. break;
  139. case 'recerved':
  140. detail = await this.$api.prePage().receivedOrder({
  141. order_id: this.order_id
  142. });
  143. break;
  144. case 'evaluate':
  145. this.$api.navTo('/pages/order/evaluate?product_id=' + item.id + '&order_id=' + this.order_id + '&image=' + item.image +
  146. '&title=' + item.title + '&spec=' + item.spec);
  147. break;
  148. case 'refund':
  149. this.$api.navTo('/pages/order/refund?order_id=' + this.order_id);
  150. break;
  151. }
  152. if (detail) {
  153. this.detail(this.order_id);
  154. }
  155. },
  156. pullDownRefresh() {
  157. this.detail(this.order_id);
  158. }
  159. },
  160. onPullDownRefresh() {
  161. this.pullDownRefresh();
  162. }
  163. }
  164. </script>
  165. <style lang="scss">
  166. page {
  167. background: #f5f5f5;
  168. }
  169. .header {
  170. height: 200rpx;
  171. background: linear-gradient(to right, #ffac30, #fa436a, #F56C6C);
  172. .left {
  173. color: #ffffff;
  174. line-height: 200rpx;
  175. padding-left: 100rpx;
  176. }
  177. }
  178. .delivery {
  179. color: #545454;
  180. background: #ffffff;
  181. border-bottom: 1px solid #e9e9e9;
  182. .icon {
  183. background: #00a7c8;
  184. height: 60rpx;
  185. width: 60rpx;
  186. display: inline-block;
  187. border-radius: 100rpx;
  188. margin: 50rpx 30rpx;
  189. text-align: center;
  190. line-height: 60rpx;
  191. }
  192. .info {
  193. display: inline-flex;
  194. flex-direction: column;
  195. justify-content: center;
  196. width: 600rpx;
  197. vertical-align: middle;
  198. margin: 30rpx 0;
  199. position: relative;
  200. .right {
  201. position: absolute;
  202. right: 0;
  203. }
  204. }
  205. }
  206. .address {
  207. color: #545454;
  208. background: #ffffff;
  209. .icon {
  210. background: linear-gradient(to right, #ffac30, #fa436a, #F56C6C);
  211. height: 60rpx;
  212. width: 60rpx;
  213. display: inline-block;
  214. border-radius: 100rpx;
  215. margin: 50rpx 30rpx;
  216. text-align: center;
  217. line-height: 60rpx;
  218. }
  219. .info {
  220. display: inline-flex;
  221. flex-direction: column;
  222. justify-content: center;
  223. width: 600rpx;
  224. vertical-align: middle;
  225. margin: 30rpx 0;
  226. .mobile {
  227. color: #9b9b9b;
  228. margin-left: 30rpx;
  229. }
  230. }
  231. }
  232. .product {
  233. background: #ffffff;
  234. margin-top: 20rpx;
  235. padding: 30rpx;
  236. /* 单条商品 */
  237. .goods-box-single {
  238. display: flex;
  239. padding: 20upx 0;
  240. border-bottom: 1rpx solid #eaeaea;
  241. .goods-img {
  242. display: block;
  243. width: 120upx;
  244. height: 120upx;
  245. }
  246. .right {
  247. flex: 1;
  248. display: flex;
  249. flex-direction: column;
  250. padding: 0 30upx 0 24upx;
  251. overflow: hidden;
  252. position: relative;
  253. .title {
  254. font-size: $font-base + 2upx;
  255. color: $font-color-dark;
  256. line-height: 1;
  257. }
  258. .attr-box {
  259. font-size: $font-sm + 2upx;
  260. color: $font-color-light;
  261. padding: 10upx 12upx;
  262. }
  263. .price {
  264. font-size: $font-base + 2upx;
  265. color: $font-color-dark;
  266. margin-top: 0;
  267. &:before {
  268. content: '¥';
  269. font-size: $font-sm;
  270. margin: 0 2upx 0 8upx;
  271. }
  272. }
  273. .action-btn {
  274. width: 160rpx;
  275. height: 60rpx;
  276. padding: 0;
  277. text-align: center;
  278. line-height: 60rpx;
  279. font-size: 26rpx;
  280. color: #303133;
  281. background: #fff;
  282. border-radius: 100px;
  283. float: right;
  284. position: absolute;
  285. right: 0;
  286. bottom: 0;
  287. }
  288. }
  289. }
  290. .price {
  291. color: #9b9b9b;
  292. font-size: 26rpx;
  293. margin-top: 30rpx;
  294. text {
  295. float: right;
  296. }
  297. .total {
  298. font-size: 35rpx;
  299. text {
  300. color: #F56C6C;
  301. }
  302. }
  303. }
  304. }
  305. .order {
  306. background: #ffffff;
  307. margin-top: 20rpx;
  308. padding: 30rpx;
  309. .title {
  310. border-left: 4rpx solid #F56C6C;
  311. padding-left: 17rpx;
  312. color: #898989;
  313. font-size: 35rpx;
  314. margin-bottom: 20rpx;
  315. }
  316. font-size: 26rpx;
  317. color: #9b9b9b;
  318. line-height: 45rpx;
  319. margin-bottom: 120rpx;
  320. }
  321. .bottom {
  322. position: fixed;
  323. width: 100%;
  324. height: 100rpx;
  325. background: #ffffff;
  326. bottom: 0;
  327. border-top: 1px solid #e9e9e9;
  328. .action-btn {
  329. width: 160rpx;
  330. height: 60rpx;
  331. margin: 20rpx;
  332. padding: 0;
  333. text-align: center;
  334. line-height: 60rpx;
  335. font-size: 26rpx;
  336. color: #303133;
  337. background: #fff;
  338. border-radius: 100px;
  339. float: right;
  340. &:after {
  341. border-radius: 100px;
  342. }
  343. &.recom {
  344. background: #fff9f9;
  345. color: $base-color;
  346. &:after {
  347. border-color: #f7bcc8;
  348. }
  349. }
  350. }
  351. }
  352. </style>