order-detail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. <template>
  2. <view class="order-detail">
  3. <!-- 订单状态 -->
  4. <view class="state-area padding-lr margin-tb-sm">
  5. <view class="padding border-radius bg-base-zhi">
  6. <view v-if="order_data.state == '1'">
  7. <view class="dflex-c fs-lg">
  8. <text class="iconfont icondaifukuan- fs-lg fwb"></text>
  9. <text class="fwb margin-left-sm">订单待支付</text>
  10. </view>
  11. <view class="dflex-c">
  12. 剩余时间:
  13. <uv-count-down v-if="time_remaining" :time="time_remaining" format="mm:ss" @finish="finish()"></uv-count-down>
  14. <!-- <use-count-down :show-days="false" separator="zh" separator-color="#fff" font-size="24"
  15. :timestamp="time_remaining"></use-count-down> -->
  16. </view>
  17. </view>
  18. <view v-if="order_data.state == '2'">
  19. <view class="dflex-c fs-lg">
  20. <text class="iconfont icondaifahuo- fs-lg fwb"></text>
  21. <text class="fwb margin-left-sm">订单备货中</text>
  22. </view>
  23. <view class="dflex-c">预计1天后发货</view>
  24. </view>
  25. <view v-if="order_data.state == '3'">
  26. <view class="dflex-c fs-lg">
  27. <text class="iconfont icondaishouhuo- fs-lg fwb"></text>
  28. <text class="fwb margin-left-sm">订单已发货</text>
  29. </view>
  30. <!-- <view class="dflex-c">还剩15天10时自动确认</view> -->
  31. </view>
  32. <view v-if="order_data.state == '4'">
  33. <view class="dflex-c fs-lg">
  34. <text class="iconfont iconyiwancheng- fs-lg fwb"></text>
  35. <text class="fwb margin-left-sm">订单已收货</text>
  36. </view>
  37. <view class="dflex-c">感谢您的支持</view>
  38. </view>
  39. <view v-if="order_data.state == '5'">
  40. <view class="dflex-c fs-lg">
  41. <text class="iconfont iconyiwancheng- fs-lg fwb"></text>
  42. <text class="fwb margin-left-sm">订单已完成</text>
  43. </view>
  44. <view class="dflex-c">感谢您的支持,期待下次购买</view>
  45. </view>
  46. <view v-if="order_data.state == '6'">
  47. <view class="dflex-c fs-lg">
  48. <text class="iconfont icondaifukuan- fs-lg fwb"></text>
  49. <text class="fwb margin-left-sm">订单已关闭</text>
  50. </view>
  51. <view class="dflex-c">感谢您的支持</view>
  52. </view>
  53. <view v-if="order_data.state == '0'">
  54. <view class="dflex-c fs-lg">
  55. <text class="iconfont icondaifukuan- fs-lg fwb"></text>
  56. <text class="fwb margin-left-sm">已申请售后</text>
  57. </view>
  58. <view class="dflex-c">请耐心等待工作人员处理</view>
  59. </view>
  60. <view v-if="order_data.state == '售后结束'">
  61. <view class="dflex-c fs-lg">
  62. <text class="iconfont iconyiwancheng- fs-lg fwb"></text>
  63. <text class="fwb margin-left-sm">{{order_data.order_refund_state}}</text>
  64. </view>
  65. <view class="dflex-c">感谢您的支持</view>
  66. </view>
  67. </view>
  68. </view>
  69. <!-- 收货人 -->
  70. <view class="address-area padding-lr margin-tb-sm" v-if="order_data.orderConsignee">
  71. <view class="dflex padding border-radius bg-main">
  72. <view class="iconfont icondizhi- margin-right ft-main"></view>
  73. <view class="flex1">
  74. <view class="w-full dflex-wrap-w">
  75. <view class="margin-bottom-xs desc">
  76. <text>{{ order_data.orderConsigneeProvince }}{{ order_data.orderConsigneeCity }}{{ order_data.orderConsigneeDistrict }}
  77. {{ order_data.orderConsigneeAddrDetail }}</text>
  78. </view>
  79. <view>
  80. <text>{{ order_data.orderConsignee }}</text>
  81. <text class="margin-left">{{ order_data.orderConsigneeTel }}</text>
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. <!-- 订单商品明细 -->
  88. <view class="padding margin-lr margin-tb-sm bg-main border-radius">
  89. <view class="goods-area" :class="{ 'margin-top': index > 0 }" v-for="(item, index) in order_detail"
  90. :key="index">
  91. <view class="dflex">
  92. <view class="img">
  93. <image :src="item.goodsMasterImg"></image>
  94. </view>
  95. <view class="margin-left-sm">
  96. <text class="clamp-2">{{ item.goodsName }}</text>
  97. <view class="ft-dark fs-xs padding-top-xs">
  98. <text class="margin-right">× {{item.goodsCount}}</text>
  99. {{ item.goodsAttr || '&nbsp;&nbsp;' }}
  100. </view>
  101. <view class="margin-top-sm">
  102. <text class="price">{{ item.goodsActualPrice }}</text>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. </view>
  108. <!-- 订单数据 -->
  109. <view class="order-area padding margin-lr margin-tb-sm bg-main border-radius">
  110. <view class="item">
  111. <text>订单编号:</text>
  112. <text class="">{{ order_data.orderNo }}</text>
  113. <text class="copy" @click="copy">复制</text>
  114. </view>
  115. <view class="item">
  116. <text>下单时间:</text>
  117. <text class="">{{ order_data.createTime }}</text>
  118. </view>
  119. <view class="item">
  120. <text>支付方式:</text>
  121. <text class="">
  122. <!-- 1 微信支付 2余额支付 3支付宝 4网银 5其他 -->
  123. <template v-if="order_data.payWay==1">微信支付</template>
  124. <template v-if="order_data.payWay==2">余额支付</template>
  125. <template v-if="order_data.payWay==3">支付宝</template>
  126. <template v-if="order_data.payWay==4">网银</template>
  127. <template v-if="order_data.payWay==5">其他</template>
  128. </text>
  129. </view>
  130. <view class="item">
  131. <text>支付编号:</text>
  132. <text class="">{{ order_data.payNo }}</text>
  133. </view>
  134. </view>
  135. <!-- 退款数据 -->
  136. <view class="order-area padding margin-lr margin-tb-sm bg-main border-radius"
  137. v-if="order_data.order_refund_state">
  138. <view class="item">
  139. <text>退款原因:</text>
  140. <text class="">{{ order_data.order_refund_reason }}</text>
  141. </view>
  142. <view class="item">
  143. <text>退款说明:</text>
  144. <text class="">{{ order_data.order_refund_desc }}</text>
  145. </view>
  146. <view class="item">
  147. <text>退款状态:</text>
  148. <text>{{ order_data.order_refund_state }}</text>
  149. </view>
  150. <view class="item">
  151. <text>退款情况:</text>
  152. <text>{{ order_data.order_refund_remark || '' }}</text>
  153. </view>
  154. </view>
  155. <!-- 统计数据 -->
  156. <view class="total-area padding margin-lr margin-tb-sm bg-main border-radius" v-for="(item, index) in order_detail"
  157. :key="index">
  158. <view class="ft-dark">
  159. <view class="item dflex-b">
  160. <text>{{ goods_price_tip}}</text>
  161. <text class="">¥{{ item.goodsTotalAmt }}</text>
  162. </view>
  163. <view class="item dflex-b">
  164. <text>优惠</text>
  165. <text class="">¥{{ order_data.order_coupon_price || 0}}</text>
  166. </view>
  167. <view class="item dflex-b">
  168. <text>运费</text>
  169. <text class="">¥0</text>
  170. </view>
  171. </view>
  172. <view class="item dflex-b">
  173. <text>实付款</text>
  174. <text class="price">{{ order_data.orderActualPrice }}</text>
  175. </view>
  176. </view>
  177. <view style="height: 100rpx;"></view>
  178. <!-- 底部操作区 -->
  179. <view class="oper-area dflex-b padding-right padding-left-sm">
  180. <view class="dflex">
  181. <view class="btn-area dflex dflex-flow-c" @click="tohome">
  182. <text class="iconfont iconshouye-1"></text>
  183. <text>首页</text>
  184. </view>
  185. <!-- #ifndef H5 || MP-360 || MP-ALIPAY -->
  186. <button class="btn no-border" open-type="contact">
  187. <view class="btn-area dflex dflex-flow-c">
  188. <text class="iconfont iconkefu-01"></text>
  189. <text>客服</text>
  190. </view>
  191. </button>
  192. <!-- #endif -->
  193. </view>
  194. <view class="dflex-e">
  195. <view class="dflex" v-if="order_data.state == '1'">
  196. <button class="action-btn" @click="cancelOrder">取消订单</button>
  197. <button v-if="order_data.state == '1'" class="action-btn main-btn"
  198. @click="payment">立即支付</button>
  199. <!-- <button v-if="order_data.order_pay_state == '待核实'" class="action-btn main-btn"
  200. @click="payment">待核实</button> -->
  201. </view>
  202. <!-- <view class="dflex" v-if="order_data.state == '2'">
  203. <button v-if="!order_data.order_refund_state" class="action-btn border-radius-big bg-main"
  204. @click="refund">申请退款</button>
  205. </view> -->
  206. <view class="dflex" v-if="order_data.state == '2'">
  207. <button class="action-btn border-radius-big bg-main"
  208. @click="refund">申请退款</button>
  209. </view>
  210. <!-- <button v-if="!order_data.order_refund_state &&
  211. ['3', '4', '5'].includes(order_data.state)" class="action-btn" @click="toexpress">查看物流</button>
  212. <view class="dflex" v-if="order_data.state == '3'">
  213. <button v-if="!order_data.order_refund_state" class="action-btn main-btn" @click="toreceipt">确认收货</button>
  214. </view> -->
  215. <button v-if="['3',].includes(order_data.state)" class="action-btn" @click="toexpress">查看物流</button>
  216. <view class="dflex" v-if="order_data.state == '3'">
  217. <button class="action-btn main-btn" @click="toreceipt">确认收货</button>
  218. </view>
  219. <view class="dflex" v-if="order_data.state == '4'">
  220. <button class="action-btn main-btn" @click="evaluate">我要评价</button>
  221. </view>
  222. <view v-if="order_data.state == '6'"><button @click="delorder" class="action-btn main-btn">删除订单</button></view>
  223. </view>
  224. </view>
  225. </view>
  226. </template>
  227. <script>
  228. import {
  229. orderinfo,
  230. shouhuo,
  231. orserdelete,
  232. orserclear
  233. } from '../../../utils/api_order.js'
  234. export default {
  235. components: {
  236. // share
  237. },
  238. data() {
  239. return {
  240. // 商品数据
  241. order_detail: [],
  242. // 订单数据
  243. order_data: {},
  244. addressData: [],
  245. sharekefuList: [],
  246. shareEmptyList: [],
  247. orderId: '',
  248. goods_price_tip: '产品总计',
  249. time_remaining: 0,
  250. };
  251. },
  252. onUnload() {
  253. uni.$emit('__event_order', 'refresh');
  254. },
  255. onLoad(options) {
  256. this.orderId = options.order_id;
  257. this.loadData();
  258. },
  259. onShow() {
  260. this.loadData();
  261. },
  262. methods: {
  263. tohome() {
  264. this.$api.tohome();
  265. },
  266. loadData() {
  267. let _this = this;
  268. // 订单详情
  269. var data=_this.orderId
  270. orderinfo(data).then((res) => {
  271. if(res.success){
  272. _this.order_data = res.data;
  273. _this.order_detail = res.data.orderDetails;
  274. let temLockTime = 15
  275. // 兼容ios部分系统转换时间格式
  276. let createTime = res.data.createTime.slice(0, 19).replace(/-/g, '/')
  277. _this.time_remaining = new Date(createTime).getTime() + temLockTime * 60 * 1000 - new Date().getTime()
  278. return
  279. }
  280. _this.$api.msg(res.msg);
  281. })
  282. // this.$func.usemall.call('order/detail', {
  283. // order_id: _this.order_id
  284. // }).then(res => {
  285. // if (res.code === 200) {
  286. // res.datas.order.create_time = this.$api.format(res.datas.order.create_time);
  287. // _this.order_data = res.datas.order;
  288. // _this.order_detail = res.datas.order_detail;
  289. // _this.addressData = res.datas.order_trip;
  290. // if (res.datas.order && res.datas.order.state === '待付款') {
  291. // _this.time_remaining = res.datas.time_remaining;
  292. // }
  293. // _this.order_detail.forEach(data => {
  294. // if (data.goods_opt_id > 0) {
  295. // let desc = '';
  296. // if (data.goods_opt_desc) {
  297. // desc = ' (' + data.goods_opt_desc + ')';
  298. // }
  299. // _this.goods_price_tip = data.goods_opt_name + desc;
  300. // }
  301. // });
  302. // }
  303. // })
  304. },
  305. // 倒计时结束回调
  306. finish() {
  307. this.loadData()
  308. },
  309. // 立即支付
  310. payment() {
  311. if (this.order_data.order_pay_state == '待核实') {
  312. this.$api.msg('订单已支付待核实状态');
  313. return;
  314. }
  315. this.$api.topay({
  316. order_id: this.order_data.orderId,
  317. money: this.order_data.orderActualPrice,
  318. });
  319. },
  320. // 查看物流
  321. toexpress(item) {
  322. // this.$api.msg('查看物流开发中');
  323. uni.navigateTo({
  324. url: `/packageShang/pages/user/order/order-express?order_id=${this.orderId}`
  325. });
  326. },
  327. // 确认发货
  328. toreceipt() {
  329. let _this = this;
  330. uni.showModal({
  331. title: '提示',
  332. content: '确认收货',
  333. success: function(res) {
  334. if (res.confirm) {
  335. uni.showLoading({
  336. title: '请稍后'
  337. });
  338. var data=_this.orderId
  339. shouhuo(data).then((res) => {
  340. if(res.success){
  341. _this.loadData('refresh');
  342. return
  343. }
  344. _this.$api.msg(res.msg);
  345. })
  346. } else if (res.cancel) {
  347. console.log('用户点击取消');
  348. }
  349. },
  350. complete() {
  351. uni.hideLoading();
  352. }
  353. });
  354. },
  355. // 删除订单
  356. delorder() {
  357. let _this = this;
  358. uni.showModal({
  359. title: '提示',
  360. content: '删除订单',
  361. success: function(res) {
  362. if (res.confirm) {
  363. uni.showLoading({
  364. title: '请稍后'
  365. });
  366. var data=_this.orderId
  367. orserdelete(data).then((res) => {
  368. if(res.success){
  369. uni.navigateBack({});
  370. return
  371. }
  372. _this.$api.msg(res.msg);
  373. })
  374. } else if (res.cancel) {
  375. console.log('点击取消');
  376. }
  377. },
  378. complete() {
  379. uni.hideLoading();
  380. }
  381. });
  382. },
  383. // 取消订单
  384. cancelOrder() {
  385. let _this = this;
  386. uni.showModal({
  387. title: '提示',
  388. content: '取消订单',
  389. success: function(res) {
  390. if (res.confirm) {
  391. uni.showLoading({
  392. title: '请稍后'
  393. });
  394. var data=_this.orderId
  395. orserclear(data).then((res) => {
  396. if(res.success){
  397. _this.loadData('refresh');
  398. return
  399. }
  400. _this.$api.msg(res.msg);
  401. })
  402. } else if (res.cancel) {
  403. console.log('用户点击取消');
  404. }
  405. },
  406. complete() {
  407. uni.hideLoading();
  408. }
  409. });
  410. },
  411. // 点击复制
  412. copy() {
  413. let _this = this;
  414. uni.setClipboardData({
  415. data: _this.order_data.orderNo,
  416. success: function(res) {
  417. uni.getClipboardData({
  418. success: function(res) {
  419. uni.showToast({
  420. title: '复制成功'
  421. });
  422. }
  423. });
  424. }
  425. });
  426. },
  427. // 评价
  428. evaluate() {
  429. uni.navigateTo({
  430. url: `/packageShang/pages/user/order/order-evaluate?id=${this.orderId}`
  431. });
  432. },
  433. // 申请退款
  434. refund() {
  435. uni.navigateTo({
  436. url: `/packageShang/pages/user/order/order-refund?order_id=${this.orderId}`
  437. });
  438. },
  439. },
  440. }
  441. </script>
  442. <style lang="scss">
  443. page {
  444. background: $page-color-base;
  445. }
  446. @import url('/packageShang/components/iconfont/iconfont.css');
  447. @import url('/packageShang/common/common.scss');
  448. .order-detail .item text:first-child {
  449. width: 152rpx;
  450. text-align: right;
  451. display: inline-block;
  452. }
  453. /* 状态区 */
  454. .state-area {}
  455. /* 收货人 */
  456. .address-area {}
  457. /* 商品区 */
  458. .goods-area {
  459. &:last-child {
  460. margin-bottom: 0;
  461. }
  462. image {
  463. width: 180rpx;
  464. height: 180rpx;
  465. }
  466. }
  467. /* 订单数据区 */
  468. .order-area {
  469. .item {
  470. line-height: 66rpx;
  471. .copy {
  472. margin-left: 20rpx;
  473. padding: 10rpx 40rpx;
  474. background-color: #f1f1f1;
  475. border-radius: 40rpx;
  476. font-size: 24rpx;
  477. }
  478. }
  479. }
  480. /* 数据统计区 */
  481. .total-area {
  482. .item {
  483. line-height: 48rpx;
  484. text {
  485. padding-right: 16rpx;
  486. }
  487. }
  488. }
  489. /* 操作区 */
  490. .oper-area {
  491. width: 100%;
  492. height: 100rpx;
  493. background-color: #fff;
  494. position: fixed;
  495. z-index: 1;
  496. bottom: 0;
  497. left: 0;
  498. border-top: 1px solid #f0f0f0;
  499. .btn-area {
  500. font-size: $font-sm;
  501. color: $font-color-base;
  502. width: 96rpx;
  503. .iconfont {
  504. font-size: 40rpx;
  505. line-height: 48rpx;
  506. }
  507. }
  508. /* 操作按钮 */
  509. .action-btn {
  510. width: 156rpx;
  511. height: inherit;
  512. line-height: inherit;
  513. margin: 0;
  514. margin-left: 20rpx;
  515. padding: 12rpx 0;
  516. font-size: $font-sm + 2upx;
  517. background: #fff;
  518. border-radius: 100px;
  519. /* #ifdef MP-QQ || MP-ALIPAY */
  520. border: 1px solid;
  521. /* #endif */
  522. &:after {
  523. border-radius: 100px;
  524. }
  525. &.main-btn {
  526. background: #fff9f9;
  527. color: $base-color;
  528. &:after {
  529. border-color: #f7bcc8;
  530. }
  531. }
  532. }
  533. }
  534. </style>