detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. <template>
  2. <view>
  3. <CustomToast ref="customToast" />
  4. <view class="region pad-24 mar-t-10" v-if="order.isAfter==3">
  5. <view @tap="checkAfterSaleStatus" class="flex-items-between">
  6. <view>
  7. <view class="font-red">
  8. 售后已关闭
  9. </view>
  10. <view v-if="orderAfter.status==4">
  11. <view class="font38 font-bold ">
  12. 商家审核不通过
  13. </view>
  14. <view class="font28">
  15. 原因:{{orderAfter.approveRemark}}
  16. </view>
  17. </view>
  18. <view v-if="orderAfter.status==5">
  19. <view class="font38 font-bold ">
  20. 商家不同意退款
  21. </view>
  22. <view class="font28">
  23. 原因:{{orderAfter.approveRemark}}
  24. </view>
  25. </view>
  26. <view v-if="orderAfter.status==6">
  27. <view class="font38 font-bold ">
  28. 您已取消售后
  29. </view>
  30. </view>
  31. </view>
  32. <uni-icons color="#a8aeb4" type="right" size="20"></uni-icons>
  33. </view>
  34. </view>
  35. <view class="region pad-24 mar-t-10">
  36. <view v-if="order.isAfter==0||order.isAfter==3">
  37. <!-- 待付款状态 -->
  38. <view v-if="order.status==1">
  39. <view class="font38 font-bold ">
  40. 订单待付款,点击立即付款
  41. </view>
  42. </view>
  43. <!-- 待发货状态 -->
  44. <view v-if="order.status==2" class="flex-items-plus ">
  45. <uni-icons color="#63b43d" type="checkbox-filled" size="30"></uni-icons>
  46. <view class="font34 font-bold">
  47. 买家已付款
  48. </view>
  49. </view>
  50. <!-- 待收货状态 -->
  51. <view v-if="order.status==3" class="flex-items-between" @tap="checkLogistics">
  52. <view class="font34 font-bold ">
  53. 订单已发货,点击查看物流
  54. </view>
  55. <uni-icons color="#a8aeb4" type="right" size="20"></uni-icons>
  56. </view>
  57. <!-- 已完成状态 -->
  58. <view v-if="order.status==4">
  59. <!-- 是否已评价 0否,1是-->
  60. <view class="flex-items-between ">
  61. <view class="flex-items">
  62. <uni-icons color="#63b43d" type="checkbox-filled" size="30"></uni-icons>
  63. <view class="font34 font-bold">
  64. 订单已完成
  65. </view>
  66. </view>
  67. <view class="flex-items font-blue font28" @tap="goScore" v-if="order.isEvaluate==0">
  68. 去评价
  69. <uni-icons color="#646464" type="right" size="20"></uni-icons>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <view v-if="order.isAfter==1">
  75. <!-- 售后状态 -->
  76. <view class="flex-items-between mar-t-10" @tap="checkAfterSaleStatus">
  77. <view class="font38 font-bold " v-if="orderAfter.status==0">
  78. 售后已提交,请等待商家审核
  79. </view>
  80. <view class="font38 font-bold " v-if="orderAfter.status==1">
  81. 商家已审核通过,请寄回商品
  82. </view>
  83. <view class="font38 font-bold " v-if="orderAfter.status==2">
  84. 商品已寄出,等待商家退款
  85. </view>
  86. <view>
  87. <uni-icons color="#7f8388" type="right" size="20"></uni-icons>
  88. </view>
  89. </view>
  90. </view>
  91. <view v-if="order.isAfter==2">
  92. <view v-if="orderAfter.status==3">
  93. <view class="flex-items-plus">
  94. <uni-icons color="#63b43d" type="checkbox-filled" size="30"></uni-icons>
  95. <view class="font38 font-bold ">
  96. 售后完成
  97. </view>
  98. </view>
  99. <view class="text-align mar-t-10">
  100. 钱款{{orderAfter.afterPrice}}元已退回到你**账户
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. <view class="region pad-24 mar-t-10">
  106. <view class="flex-items-between">
  107. <view class="flex-items">
  108. <uni-icons type="location" size="30"></uni-icons>
  109. <view class="font-bold">
  110. {{order.province}}{{order.city}}{{order.area}}{{order.address}}
  111. </view>
  112. </view>
  113. <view class="font-blue" @tap="updateAddress"
  114. v-if="(order.isAfter==0||order.isAfter==3)&&order.status==2">
  115. 修改>
  116. </view>
  117. </view>
  118. <view class="mar-t-10 mar-l-40">
  119. {{order.name}} {{order.mobile}}
  120. </view>
  121. </view>
  122. <view class="gray-line"></view>
  123. <view class="pad-24 region">
  124. <view class="flex-items " @tap="goProduct">
  125. <view>
  126. <image class=" mar-l-20 productImg" :src="order.images" mode="cover"></image>
  127. </view>
  128. <view class="mar-l-20 mar-r-20">
  129. <view class="font28 pad-b-10 ">
  130. {{order.productName}}
  131. </view>
  132. <view class="pad-tb-16 font-gray">
  133. <text>
  134. 规格: {{order.skuName}}
  135. </text>
  136. <text class="mar-l-20">
  137. x{{order.count}}
  138. </text>
  139. </view>
  140. <view class="pad-t-10 ">
  141. <text class=" font-red font32 font-bold">
  142. ¥{{order.paymentPrice}}
  143. </text>
  144. </view>
  145. <view class="mar-r-16">
  146. </view>
  147. </view>
  148. </view>
  149. <view class="gray-line"></view>
  150. <view class="pad-24">
  151. <view class="flex-items-between">
  152. <text>
  153. 商品总价
  154. </text>
  155. <text>
  156. {{order.paymentPrice}}
  157. </text>
  158. </view>
  159. <view class="flex-items-between mar-t-40">
  160. <text>
  161. 运费
  162. </text>
  163. <text>
  164. 0
  165. </text>
  166. </view>
  167. <view class="flex-items-between mar-t-40">
  168. <text>
  169. 实付款
  170. </text>
  171. <text>
  172. {{order.paymentPrice}}
  173. </text>
  174. </view>
  175. <view class="flex-items-between mar-t-40">
  176. <text>
  177. 订单编号
  178. </text>
  179. <text>
  180. {{order.orderCode}}
  181. </text>
  182. </view>
  183. <!-- <view class="flex-items-between mar-t-40">
  184. <text>
  185. 收货信息
  186. </text>
  187. <view>
  188. <view>
  189. {{order.province}}{{order.city}}{{order.area}}{{order.address}}
  190. </view>
  191. <view class="mar-t-10">
  192. {{order.mobile}} {{order.name}}
  193. </view>
  194. </view>
  195. </view> -->
  196. <view class="flex-items-between mar-t-40">
  197. <text>
  198. 创建时间
  199. </text>
  200. <text>
  201. {{order.createTime}}
  202. </text>
  203. </view>
  204. <view class="flex-items-between mar-t-40">
  205. <text>
  206. 付款时间
  207. </text>
  208. <text>
  209. {{order.payTime}}
  210. </text>
  211. </view>
  212. <view class="flex-items-between mar-t-40" v-if="order.status==3||order.status==4">
  213. <text>
  214. 发货时间
  215. </text>
  216. <text>
  217. {{order.shipTime}}
  218. </text>
  219. </view>
  220. <view class="flex-items-between mar-t-40" v-if="order.status==4">
  221. <text>
  222. 成交时间
  223. </text>
  224. <text>
  225. {{order.confirmTime}}
  226. </text>
  227. </view>
  228. </view>
  229. </view>
  230. <view class="navigation">
  231. <view class="flex-items-between">
  232. <view class="mar-l-20" @click="$Router.pushTab({name: 'index'})">
  233. <u-icon name="chat" color="#F95B5B" size="22"></u-icon>
  234. <view>客服</view>
  235. </view>
  236. <view>
  237. <view v-if="order.isAfter==0||order.isAfter==3">
  238. <!-- 待付款状态 -->
  239. <view class="flex-items" v-if="order.status === 1">
  240. <button class="grayBut mar-r-20" @click="cancelOrder">取消订单</button>
  241. <button class="orgBut mar-r-20" @click="payOrder">去付款</button>
  242. </view>
  243. <!-- 待发货状态 -->
  244. <view class="flex-items" v-if="order.status === 2">
  245. <button class="grayBut mar-r-20" @click="submitAfterSale">申请售后</button>
  246. <button class="orgBut mar-r-20" @click="onceAgainOrder">再来一单</button>
  247. </view>
  248. <!-- 待收货状态 -->
  249. <view class="flex-items" v-if="order.status === 3">
  250. <button class="grayBut mar-r-20" @click="submitAfterSale">申请售后</button>
  251. <button class="grayBut mar-r-20" @click="checkLogistics">查看物流</button>
  252. <button class="orgBut mar-r-20" @click="confirmReceiptDialog">确认收货</button>
  253. </view>
  254. <!-- 已完成状态 -->
  255. <view class="flex-items" v-if="order.status === 4">
  256. <button class="grayBut mar-r-20" @click="deleteOrder">删除订单</button>
  257. <button class="grayBut mar-r-20" @click="submitAfterSale">申请售后</button>
  258. <button class="orgBut mar-r-20" @click="onceAgainOrder">再来一单</button>
  259. </view>
  260. </view>
  261. <!-- 售后中状态 -->
  262. <view v-if="order.isAfter === 1" class="flex-items">
  263. <button class="grayBut mar-r-20" @click="onCancelAfter">取消售后</button>
  264. <button class="orgBut mar-r-20" @click="checkAfterSaleStatus">查看售后进度</button>
  265. </view>
  266. <!-- 售后完成状态 -->
  267. <view v-if="order.isAfter === 2" class="flex-items">
  268. <button class="grayBut mar-r-20" @click="checkAfterSaleStatus">售后详情</button>
  269. <button class="orgBut mar-r-20" @click="onceAgainOrder">再来一单</button>
  270. </view>
  271. </view>
  272. </view>
  273. </view>
  274. <uni-popup ref="dialog" type="dialog">
  275. <uni-popup-dialog type="warn" cancelText="取消" confirmText="确认" title="提示" content="确认要取消售后?"
  276. @confirm="cancel()"></uni-popup-dialog>
  277. </uni-popup>
  278. <uni-popup ref="dialog" type="dialog">
  279. <uni-popup-dialog type="warn" cancelText="取消" confirmText="确认" title="提示" content="确认收货?"
  280. @confirm="confirmReceipt()"></uni-popup-dialog>
  281. </uni-popup>
  282. </view>
  283. </template>
  284. <script>
  285. import {
  286. orderDetail,
  287. cancelAfter,
  288. orderAfterDetail,
  289. confirmReceipt
  290. } from '../../config/api.js';
  291. import CustomToast from '../../components/CustomToast.vue';
  292. export default {
  293. components: {
  294. CustomToast,
  295. },
  296. data() {
  297. return {
  298. orderAfter: {},
  299. orderId: "",
  300. order: {},
  301. form: {},
  302. isFirstLoad: true, // 新增标志位,用于判断是否是首次加载
  303. };
  304. },
  305. methods: {
  306. goScore() {
  307. this.$route('/pages/order/score?orderId=' + this.order.id)
  308. },
  309. updateAddress() {
  310. this.$route('/pages/order/update-address?orderId=' + this.order.id)
  311. },
  312. cancel() {
  313. cancelAfter({
  314. id: this.orderAfter.id
  315. }).then((res) => {
  316. if (res.code == 200) {
  317. this.$refs.customToast.showToast('操作成功');
  318. this.$refs.dialog.close()
  319. this.getOrderDetail();
  320. }
  321. })
  322. },
  323. onCancelAfter() {
  324. this.$refs.dialog.open()
  325. },
  326. goProduct() {
  327. this.$route('/packageShop/pages/detail/index?id=' + this.order.productId)
  328. },
  329. getOrderDetail() {
  330. orderDetail({
  331. id: this.orderId
  332. }).then((res) => {
  333. this.order = res.data;
  334. this.getAfterDetail()
  335. });
  336. },
  337. getAfterDetail() {
  338. orderAfterDetail({
  339. orderId: this.orderId
  340. }).then((res) => {
  341. this.orderAfter = res.data
  342. })
  343. },
  344. cancelOrder() {
  345. console.log('取消订单,订单号:', this.order.orderCode);
  346. },
  347. payOrder() {
  348. // 跳转到支付页面
  349. this.$route('/pages/order/payment?orderId=' + this.order.id);
  350. },
  351. submitAfterSale() {
  352. this.$route('/pages/order/after?id=' + this.order.id);
  353. },
  354. checkLogistics() {
  355. this.$route('/pages/order/logistics?expressCode=' + this.order.expressCode);
  356. },
  357. confirmReceiptDialog() {
  358. this.$refs.dialog.open()
  359. this.form = this.order
  360. },
  361. confirmReceipt() {
  362. confirmReceipt(this.form).then((res) => {
  363. if (res.code == 200) {
  364. this.$refs.dialog.close()
  365. this.$refs.customToast.showToast('操作成功');
  366. this.getOrderDetail()
  367. }
  368. })
  369. },
  370. deleteOrder() {
  371. console.log('删除订单,订单号:', this.order.orderCode);
  372. },
  373. addToCart() {
  374. console.log('加入购物车,订单号:', this.order.orderCode);
  375. },
  376. onceAgainOrder() {
  377. console.log('再来一单,订单号:', this.order.orderCode);
  378. },
  379. checkAfterSaleStatus() {
  380. this.$route('/pages/order/after-progress?id=' + this.orderAfter.id);
  381. }
  382. },
  383. onLoad(op) {
  384. this.orderId = op.id;
  385. this.getOrderDetail();
  386. setTimeout(() => {
  387. this.isFirstLoad = false; // 首次加载完成,将标志位设为 false
  388. }, 1000)
  389. },
  390. onShow() {
  391. if (!this.isFirstLoad) {
  392. // 如果不是首次加载,再调用 方法
  393. this.getOrderDetail();
  394. }
  395. }
  396. };
  397. </script>
  398. <style>
  399. .navigation {
  400. position: fixed;
  401. bottom: 0;
  402. width: 100%;
  403. border: solid 2rpx #f2f2f2;
  404. background-color: #ffffff;
  405. padding: 16rpx 0;
  406. }
  407. .grayBut {
  408. background-color: #f2f2f2;
  409. padding: 5rpx 30rpx 5rpx 30rpx;
  410. font-size: 26rpx;
  411. color: #1b1b1b;
  412. }
  413. .orgBut {
  414. background-color: #F95B5B;
  415. padding: 5rpx 30rpx 5rpx 30rpx;
  416. font-size: 26rpx;
  417. color: #ffffff;
  418. }
  419. button::after {
  420. border: none;
  421. }
  422. </style>