orderDetail.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  1. <template>
  2. <view>
  3. <!-- 订单状态 -->
  4. <div class="info-view order-view">
  5. <div class="order-status" v-if="orderStatusList[order.orderStatus]">
  6. {{ orderStatusList[order.orderStatus].title }}
  7. <div>{{ orderStatusList[order.orderStatus].value }}</div>
  8. </div>
  9. </div>
  10. <!-- 物流信息 -->
  11. <view class="info-view logi-view">
  12. <view class="logi-List" v-if="logiList && logiList.traces.length != 0">
  13. <view class="logi-List-title">
  14. {{logiList.traces[logiList.traces.length-1].AcceptStation}}
  15. </view>
  16. <view class="logi-List-time">
  17. {{logiList.traces[logiList.traces.length-1].AcceptTime}}
  18. </view>
  19. </view>
  20. <view class="logi-List" v-else>
  21. <view class="logi-List-title">
  22. 暂无物流信息
  23. </view>
  24. </view>
  25. </view>
  26. <!-- 地址 -->
  27. <view class="info-view">
  28. <view class="address-view">
  29. <view>
  30. <view class="address-title">
  31. <span>{{ order.consigneeName || "未填写昵称" }}</span>
  32. <span>{{ order.consigneeMobile || "未填写手机号" | secrecyMobile }}</span>
  33. </view>
  34. <view class="address">地址:{{ order.consigneeAddressPath }}
  35. {{ order.consigneeDetail }}</view>
  36. </view>
  37. </view>
  38. </view>
  39. <!-- 商品信息 -->
  40. <view>
  41. <view class="seller-view">
  42. <!-- 店铺名称 -->
  43. <view class="seller-info u-flex u-row-between">
  44. <view class="seller-name" @click="tostore(order)">
  45. <view class="name">{{ order.storeName }}</view>
  46. <view class="status" v-if="orderStatusList[order.orderStatus]"> {{ orderStatusList[order.orderStatus].title }}</view>
  47. </view>
  48. <view class="order-sn"></view>
  49. </view>
  50. <view>
  51. <view v-for="(sku, skuIndex) in orderGoodsList" :key="skuIndex">
  52. <view class="goods-item-view">
  53. <view class="goods-img" @click="gotoGoodsDetail(sku)">
  54. <u-image border-radius="6" width="131rpx" height="131rpx" :src="sku.image"></u-image>
  55. </view>
  56. <view class="goods-info" @click="gotoGoodsDetail(sku)">
  57. <view class="goods-title u-line-2">{{ sku.goodsName }}</view>
  58. <view class="goods-price">
  59. ¥{{ sku.goodsPrice | unitPrice }}
  60. <!-- <span v-if="sku.point">+{{ sku.point }}积分</span> -->
  61. </view>
  62. </view>
  63. <view class="goods-num">
  64. <view>x{{ sku.num }}</view>
  65. <view class="good-complaint">
  66. <u-tag size="mini" mode="plain" @click="complaint(sku)" v-if="sku.complainStatus == 'NO_APPLY'" text="投诉" type="info" />
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="info-view">
  75. <view>
  76. <view class="order-info-view">
  77. <view class="title">商品总价:</view>
  78. <view class="value">¥{{ order.goodsPrice | unitPrice }}</view>
  79. </view>
  80. <view class="order-info-view">
  81. <view class="title">运费:</view>
  82. <view class="value">¥{{ order.freightPrice | unitPrice }}</view>
  83. </view>
  84. <view class="order-info-view">
  85. <view class="title">优惠券:</view>
  86. <view class="value">¥{{ order.couponPrice | unitPrice }}</view>
  87. </view>
  88. <view class="order-info-view">
  89. <view class="title">活动优惠:</view>
  90. <view class="value">¥{{ order.discountPrice | unitPrice }}</view>
  91. </view>
  92. <!-- <view class="order-info-view" v-if="order.use_point">
  93. <view class="title">使用积分:</view>
  94. <view class="value">{{ order.use_point }}</view>
  95. </view> -->
  96. </view>
  97. </view>
  98. <!-- 客户服务, 售后,取消订单,查看物流,投诉等 -->
  99. <view class="info-view" v-if="orderDetail.allowOperationVO && orderDetail.allowOperationVO.cancel == true || order.orderStatus == 'DELIVERED' || order.orderStatus != 'UNPAID' && order.orderType =='PINTUAN'">
  100. <view style="width: 100%">
  101. <view class="order-info-view">
  102. <view class="title">服务</view>
  103. </view>
  104. <view class="customer-list">
  105. <view class="customer-service" v-if="orderDetail.allowOperationVO && orderDetail.allowOperationVO.cancel == true" @click="onCancel(order.sn)">取消订单</view>
  106. <view class="customer-service" v-if="order.orderStatus == 'DELIVERED'" @click="onLogistics(order)">查看物流</view>
  107. <view class="customer-service" v-if="order.orderStatus != 'UNPAID' && order.orderType =='PINTUAN' " @click="ByUserMessage(order)">查看拼团信息</view>
  108. </view>
  109. </view>
  110. </view>
  111. <view class="info-view">
  112. <view style="width: 100%">
  113. <view class="order-info-view">
  114. <view class="title">订单编号:</view>
  115. <view class="value">
  116. {{ order.sn }}
  117. <u-tag class="copy" text="复制" type="info" size="mini" @click="onCopy(order.sn)" />
  118. </view>
  119. </view>
  120. <view class="order-info-view">
  121. <view class="title">下单时间:</view>
  122. <view class="value">{{
  123. order.createTime
  124. }}</view>
  125. </view>
  126. <view class="order-info-view">
  127. <view class="title">支付状态:</view>
  128. <view class="value">
  129. {{
  130. order.payStatus == "UNPAID"
  131. ? "未付款"
  132. : order.payStatus == "PAID"
  133. ? "已付款"
  134. : ""
  135. }}</view>
  136. </view>
  137. <view class="order-info-view">
  138. <view class="title">支付方式:</view>
  139. <view class="value">{{ orderDetail.paymentMethodValue }}</view>
  140. </view>
  141. </view>
  142. </view>
  143. <view class="info-view" v-if="order.payStatus == 'PAID'">
  144. <view>
  145. <view class="invoice-info-view">
  146. <view class="ltitle">发票信息:</view>
  147. <view v-if="!order.needReceipt" class="value">无需发票</view>
  148. <view v-else class="value" @click="onReceipt(order.receiptVO)">查看发票</view>
  149. </view>
  150. </view>
  151. </view>
  152. <view style="padding-bottom: 150rpx"></view>
  153. <view class="bottom_view">
  154. <view class="btn-view u-flex u-row-between">
  155. <view class="description">
  156. <!-- 全部 -->
  157. <!-- 等待付款 -->
  158. <text v-if="order.payStatus === 'PAID'">已付金额:</text>
  159. <text v-else>应付金额:</text>
  160. <text class="price" v-if="order.priceDetailDTO">¥{{ order.priceDetailDTO.flowPrice | unitPrice }}</text>
  161. </view>
  162. <view>
  163. <!-- 全部 -->
  164. <!-- 等待付款 -->
  165. <u-button type="error" ripple size="mini" v-if=" order.allowOperationVO && order.allowOperationVO.pay" @click="toPay(order)">立即付款</u-button>
  166. <!-- <u-button class="rebuy-btn" size="mini" v-if="order.order_operate_allowable_vo.allow_service_cancel"> 提醒发货</u-button> -->
  167. <!-- <div class="pay-btn">确认收货</div> -->
  168. <u-button shape="circle" ripple type="warning" size="mini" v-if="order.orderStatus == 'DELIVERED'" @click="onRog(order.sn)">确认收货</u-button>
  169. <!-- 交易完成 未评价 -->
  170. <u-button shape="circle" ripple size="mini" v-if="order.orderStatus == 'COMPLETE'" @click="onComment(order.sn)">评价商品</u-button>
  171. </view>
  172. </view>
  173. </view>
  174. <u-popup class="cancel-popup" v-model="cancelShow" mode="bottom" length="60%">
  175. <view class="header">取消订单</view>
  176. <view class="body">
  177. <view class="title">取消订单后,本单享有的优惠可能会一并取消,是否继续?</view>
  178. <view>
  179. <u-radio-group v-model="reason">
  180. <view class="value">
  181. <view class="radio-view" v-for="(item, index) in cancelList" :key="index">
  182. <u-radio :active-color="lightColor" label-size="25" shape="circle" :name="item.reason" @change="reasonChange">{{ item.reason }}</u-radio>
  183. </view>
  184. </view>
  185. </u-radio-group>
  186. </view>
  187. </view>
  188. <view class="footer">
  189. <u-button size="medium" v-if="reason" shape="circle" @click="submitCancel">提交</u-button>
  190. </view>
  191. </u-popup>
  192. <u-toast ref="uToast" />
  193. <u-modal v-model="rogShow" :show-cancel-button="true" :content="'是否确认收货?'" @confirm="confirmRog"></u-modal>
  194. <!-- 分享 -->
  195. <shares v-if="shareFlage " :thumbnail="orderDetail.orderItems[0].image" :goodsName="orderDetail.orderItems[0].goodsName" @close="shareFlage = false" />
  196. </view>
  197. </template>
  198. <script>
  199. import { getExpress } from "@/api/trade.js";
  200. import { cancelOrder, confirmReceipt, getOrderDetail } from "@/api/order.js";
  201. import {h5Copy} from "@/js_sdk/h5-copy/h5-copy.js";
  202. import shares from "@/components/m-share/index"; //分享
  203. import { getClearReason } from "@/api/after-sale.js";
  204. export default {
  205. components: {
  206. shares,
  207. },
  208. data() {
  209. return {
  210. lightColor: this.$lightColor,
  211. logiList: "", //物流信息
  212. shareFlage: false, //拼团分享开关
  213. orderStatusList: {
  214. UNPAID: {
  215. title: "未付款",
  216. value: "商品暂未付款",
  217. },
  218. PAID: {
  219. title: "已付款",
  220. value: "买家已付款",
  221. },
  222. UNDELIVERED: {
  223. title: "待发货",
  224. value: "商品等待发货中",
  225. },
  226. DELIVERED: {
  227. title: "已发货",
  228. value: "商品已发货,请您耐心等待",
  229. },
  230. CANCELLED: {
  231. title: "已取消",
  232. value: "订单已取消",
  233. },
  234. COMPLETED: {
  235. title: "已完成",
  236. value: "订单已完成,祝您生活愉快",
  237. },
  238. TAKE: {
  239. title: "带核验",
  240. },
  241. },
  242. order: {},
  243. cancelShow: false, //取消订单
  244. orderSn: "",
  245. orderGoodsList: "", //订单中商品集合
  246. orderDetail: "", //订单详情信息
  247. sn: "",
  248. cancelList: "",
  249. rogShow: false,
  250. reason: "",
  251. };
  252. },
  253. onLoad(options) {
  254. this.loadData(options.sn);
  255. this.loadLogistics(options.sn);
  256. this.sn = options.sn;
  257. },
  258. methods: {
  259. tostore(val) {
  260. uni.navigateTo({
  261. url: "/pages/product/shopPage?id=" + val.storeId,
  262. });
  263. },
  264. // 获取物流信息
  265. loadLogistics(sn) {
  266. getExpress(sn).then((res) => {
  267. this.logiList = res.data.result;
  268. });
  269. },
  270. // 分享当前拼团信息
  271. inviteGroup() {
  272. this.shareFlage = true;
  273. },
  274. // #TODO 这块需要写一下 目前没有拼团的详细信息
  275. ByUserMessage(order) {
  276. uni.navigateTo({
  277. url:
  278. "/pages/cart/payment/shareOrderGoods?sn=" +
  279. order.sn +
  280. "&sku=" +
  281. this.orderGoodsList[0].skuId +
  282. "&goodsId=" +
  283. this.orderGoodsList[0].goodsId,
  284. });
  285. },
  286. loadData(sn) {
  287. uni.showLoading({
  288. title: "加载中",
  289. });
  290. getOrderDetail(sn).then((res) => {
  291. const order = res.data.result;
  292. this.order = order.order;
  293. this.orderGoodsList = order.orderItems;
  294. this.orderDetail = res.data.result;
  295. uni.hideLoading();
  296. });
  297. },
  298. onReceipt(val) {
  299. uni.navigateTo({
  300. url: "/pages/order/invoice/invoiceDetail?id=" + val.id,
  301. });
  302. },
  303. gotoGoodsDetail(sku) {
  304. uni.navigateTo({
  305. url: `/pages/product/goods?id=${sku.id}&goodsId=${sku.goodsId}`,
  306. });
  307. },
  308. onCopy(sn) {
  309. // #ifdef H5
  310. if (sn === null || sn === undefined) {
  311. sn = "";
  312. } else sn = sn + "";
  313. const result = h5Copy(sn);
  314. if (result === false) {
  315. uni.showToast({
  316. title: "不支持",
  317. });
  318. } else {
  319. uni.showToast({
  320. title: "复制成功",
  321. icon: "none",
  322. });
  323. }
  324. // #endif
  325. // #ifndef H5
  326. uni.setClipboardData({
  327. data: sn,
  328. success: function () {
  329. uni.showToast({
  330. title: "复制成功!",
  331. duration: 2000,
  332. icon: "none",
  333. });
  334. },
  335. });
  336. // #endif
  337. },
  338. /**
  339. * 投诉
  340. */
  341. complaint(sku) {
  342. uni.navigateTo({
  343. url:
  344. "/pages/order/complain/complain?sn=" +
  345. this.sn +
  346. "&skuId=" +
  347. sku.skuId,
  348. });
  349. },
  350. //售后按钮
  351. onAfterSales(sn, sku) {
  352. uni.navigateTo({
  353. url: `./afterSales/afterSalesSelect?sn=${sn}&sku=${encodeURIComponent(
  354. JSON.stringify(sku)
  355. )}`,
  356. });
  357. },
  358. // 去支付
  359. toPay(val) {
  360. val.sn
  361. ? uni.navigateTo({
  362. url: "/pages/cart/payment/payOrder?order_sn=" + val.sn,
  363. })
  364. : false;
  365. }, //删除订单
  366. deleteOrder(index) {
  367. uni.showLoading({
  368. title: "请稍后",
  369. });
  370. setTimeout(() => {
  371. this.navList[this.tabCurrentIndex].orderList.splice(index, 1);
  372. uni.hideLoading();
  373. }, 600);
  374. },
  375. //取消订单
  376. onCancel(sn) {
  377. this.orderSn = sn;
  378. uni.showLoading({
  379. title: "加载中",
  380. });
  381. getClearReason().then((res) => {
  382. if (res.data.result.length >= 1) {
  383. this.cancelList = res.data.result;
  384. }
  385. uni.hideLoading();
  386. });
  387. this.cancelShow = true;
  388. },
  389. //提交取消订单(未付款)
  390. submitCancel() {
  391. cancelOrder(this.orderSn, { reason: this.reason }).then((res) => {
  392. if (res.data.success) {
  393. uni.showToast({
  394. title: "已取消",
  395. duration: 2000,
  396. icon: "none",
  397. });
  398. this.cancelShow = false;
  399. setTimeout(() => {
  400. uni.reLaunch({
  401. url: "/pages/order/myOrder?status=0",
  402. });
  403. }, 500);
  404. } else {
  405. uni.showToast({
  406. title: res.data.message,
  407. duration: 2000,
  408. icon: "none",
  409. });
  410. this.cancelShow = false;
  411. }
  412. });
  413. },
  414. //确认收货
  415. onRog(sn) {
  416. this.orderSn = sn;
  417. this.rogShow = true;
  418. },
  419. confirmRog() {
  420. confirmReceipt(this.orderSn).then((res) => {
  421. if (res.data.success) {
  422. this.$refs.uToast.show({
  423. title: "已确认收货",
  424. type: "success",
  425. });
  426. this.rogShow = false;
  427. this.loadData(options.sn);
  428. }
  429. });
  430. },
  431. //评价商品
  432. onComment(sn) {
  433. uni.navigateTo({
  434. url: "./evaluate/myEvaluate",
  435. });
  436. }, //查看物流
  437. onLogistics(order) {
  438. uni.navigateTo({
  439. url:
  440. "/pages/mine/msgTips/packageMsg/logisticsDetail?logi_id=" +
  441. order.logi_id +
  442. "&ship_no=" +
  443. order.ship_no +
  444. "&order_sn=" +
  445. order.sn,
  446. });
  447. },
  448. //选择取消原因
  449. reasonChange(reason) {
  450. this.reason = reason;
  451. },
  452. reBuy(order) {
  453. uni.navigateTo({
  454. url:
  455. "/pages/product/goods?id=" + order.id + "&goodsId=" + order.goodsId,
  456. });
  457. },
  458. },
  459. };
  460. </script>
  461. <style lang="scss">
  462. @import "./goods.scss";
  463. .empty {
  464. width: 100%;
  465. }
  466. .customer-service {
  467. background: #ededed;
  468. // padding: 12rpx 40rpx;
  469. width: 48%;
  470. margin: 0 1%;
  471. height: 55rpx;
  472. line-height: 55rpx;
  473. margin-bottom: 10rpx;
  474. text-align: center;
  475. font-size: 24rpx;
  476. border-radius: 10rpx;
  477. }
  478. .customer-list {
  479. display: flex;
  480. flex-wrap: wrap;
  481. }
  482. .logi-view {
  483. justify-content: space-between;
  484. padding: 30rpx !important;
  485. margin: 0 !important;
  486. transform: translateY(-10px);
  487. }
  488. .order-status {
  489. color: #fff;
  490. width: 100%;
  491. text-align: center;
  492. font-size: 36rpx;
  493. margin-top: 40rpx;
  494. > div {
  495. font-size: 24rpx;
  496. margin-top: 10rpx;
  497. }
  498. }
  499. .logi-List-title {
  500. margin-bottom: 10rpx;
  501. font-size: 26rpx;
  502. }
  503. .logi-List-time {
  504. font-size: 24rpx;
  505. color: #999;
  506. }
  507. .info-detail {
  508. margin-right: 30rpx;
  509. color: #333;
  510. }
  511. .order-view {
  512. margin: 0 !important;
  513. border-radius: 0 !important;
  514. width: 100%;
  515. height: 200rpx;
  516. padding: 0 !important;
  517. background-image: linear-gradient(
  518. to right,
  519. $light-color 0%,
  520. $aider-light-color 100%
  521. ) !important;
  522. }
  523. page,
  524. .content {
  525. background: #f1f1f1;
  526. height: 100%;
  527. }
  528. .info-line {
  529. align-items: center;
  530. display: flex;
  531. border-radius: 30rpx;
  532. flex-direction: row;
  533. justify-content: space-between;
  534. background-color: #fff;
  535. width: 100%;
  536. height: 110rpx;
  537. color: #333333;
  538. font-size: 28rpx;
  539. border-bottom: 1rpx solid #eeeeee;
  540. .info-title {
  541. margin: 0 30rpx;
  542. padding: 16rpx 0rpx;
  543. }
  544. }
  545. .seller-view {
  546. margin: 20rpx 0;
  547. padding: 15rpx 0;
  548. border-radius: 30rpx;
  549. }
  550. .address-title {
  551. font-size: 26rpx;
  552. font-weight: bold;
  553. > span {
  554. margin-right: 20rpx;
  555. }
  556. }
  557. .info-view {
  558. display: flex;
  559. margin: 0 0 20rpx 0;
  560. border-radius: 30rpx;
  561. flex-direction: row;
  562. padding: 15rpx 30rpx;
  563. margin-bottom: 20rpx;
  564. background-color: #fff;
  565. .address-view {
  566. display: flex;
  567. flex-direction: row;
  568. padding: 16rpx 0;
  569. .address {
  570. color: $font-color-light;
  571. overflow: hidden;
  572. line-height: 1.75;
  573. font-size: 22rpx;
  574. }
  575. }
  576. .order-info-view {
  577. line-height: 60rpx;
  578. display: flex;
  579. flex-direction: row;
  580. width: 100%;
  581. margin: 10rpx 0rpx;
  582. .title {
  583. color: #666;
  584. width: 140rpx;
  585. font-size: 24rpx;
  586. font-weight: 600;
  587. }
  588. .value {
  589. color: #666;
  590. font-size: 24rpx;
  591. }
  592. .copy {
  593. font-size: 20rpx;
  594. color: #333;
  595. border: 1px solid #dddddd;
  596. margin-left: 30rpx;
  597. }
  598. }
  599. .invoice-info-view {
  600. display: flex;
  601. flex-direction: row;
  602. justify-content: space-between;
  603. width: 100%;
  604. margin: 10rpx 0rpx;
  605. .ltitle {
  606. width: 550rpx;
  607. font-size: 28rpx;
  608. color: #333333;
  609. }
  610. .value {
  611. color: $font-color-light;
  612. }
  613. }
  614. }
  615. .bottom_view {
  616. width: 100%;
  617. height: 100rpx;
  618. background-color: #ffffff;
  619. position: fixed;
  620. bottom: 0;
  621. left: 0;
  622. .btn-view {
  623. padding: 0 30rpx;
  624. line-height: 100rpx;
  625. font-size: 26rpx;
  626. .description {
  627. color: #909399;
  628. size: 25rpx;
  629. .price {
  630. color: $main-color;
  631. }
  632. }
  633. }
  634. .cancel-btn {
  635. color: #999999;
  636. border-color: #999999;
  637. margin-left: 15rpx;
  638. height: 60rpx;
  639. }
  640. }
  641. .cancel-popup {
  642. .header {
  643. display: flex;
  644. flex-direction: row;
  645. justify-content: center;
  646. margin: 15rpx 0rpx;
  647. }
  648. .body {
  649. padding: 30rpx;
  650. .title {
  651. font-weight: 600;
  652. }
  653. .value {
  654. display: flex;
  655. flex-direction: column;
  656. .radio-view {
  657. margin: 10rpx 0rpx;
  658. }
  659. }
  660. }
  661. .footer {
  662. text-align: center;
  663. }
  664. }
  665. </style>