order-detail.vue 16 KB

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