orderDetail.vue 19 KB

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