orderdetail.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <view class="hflex acenter">
  5. <!-- <view class="state">{{pageData.status}}</view> -->
  6. <view class="state" v-if="pageData.status == 0">已取消</view>
  7. <view class="state" v-if="pageData.status == 1">预订单</view>
  8. <view class="state" v-if="pageData.status == 2">待付款</view>
  9. <view class="state" v-if="pageData.status == 3">支付中</view>
  10. <view class="state" v-if="pageData.status == 4">待发货</view>
  11. <view class="state" v-if="pageData.status == 5">待收货</view>
  12. <view class="state" v-if="pageData.status == 6">已完成</view>
  13. <view class="state" v-if="pageData.status == 7">待审核</view>
  14. <view class="state" v-if="pageData.status == 8">已取消</view>
  15. <view class="hflex acenter blue_bg2" v-if="pageData.status == 2">
  16. <view class="blue_bg">剩余付款时间</view>
  17. <view class="">
  18. <u-count-down autoStart :time="time" format="mm:ss" @change="onChange">
  19. <view class="time">
  20. <!-- <text class="time__item">{{ timeData.hours>10?timeData.hours:'0'+timeData.hours}}&nbsp;小时</text> -->
  21. <text class="time__item">{{ timeData.minutes>10?timeData.minutes:'0'+timeData.minutes }}&nbsp;分钟</text>
  22. <text class="time__item">{{ timeData.seconds>10?timeData.seconds:'0'+timeData.seconds }}&nbsp;秒</text>
  23. </view>
  24. </u-count-down>
  25. </view>
  26. </view>
  27. <view class="hflex acenter blue_bg2" v-if="pageData.status == 5">
  28. <view class="blue_bg">剩余自动收货时间</view>
  29. <view class="">
  30. <u-count-down autoStart :time="time2" format="mm:ss" @change="onChange2">
  31. <view class="time">
  32. <text class="time__item">{{ timeData2.days }}&nbsp;天</text>
  33. <text class="time__item">{{ timeData2.hours>10?timeData2.hours:'0'+timeData2.hours}}&nbsp;小时</text>
  34. <text class="time__item">{{ timeData2.minutes>10?timeData2.minutes:'0'+timeData2.minutes }}&nbsp;分钟</text>
  35. <text class="time__item">{{ timeData2.seconds>10?timeData2.seconds:'0'+timeData2.seconds }}&nbsp;秒</text>
  36. </view>
  37. </u-count-down>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="subTitle" v-if="pageData.status == 0">{{pageData.cancel_remark}}</view>
  42. <view class="subTitle" v-if="pageData.status == 2">等待买家付款</view>
  43. <view class="subTitle" v-if="pageData.status == 4">已付款,等待商家发货</view>
  44. <view class="subTitle" v-if="pageData.status == 5">商家已发货,请耐心等待收货</view>
  45. <view class="subTitle" v-if="pageData.status == 6">感谢惠顾,期待您的再次光临</view>
  46. <view class="subTitle" v-if="pageData.status == 7">申请中,等待商家审核</view>
  47. </view>
  48. <view>
  49. <view class="box">
  50. <view class="hflex acenter">
  51. <u-icon name="map-fill" color="#506DFF" size="22"></u-icon>
  52. <view class="vflex" style="padding-left: 16rpx;">
  53. <view class="hflex acenter">
  54. <view class="text_style1" style="padding-right: 20rpx;">{{pageData.user_address.address_name}}</view>
  55. <view class="text_style1">{{pageData.user_address.address_phone}}</view>
  56. </view>
  57. <view class="text_style2">{{pageData.user_address.address_province}} {{pageData.user_address.address_city}} {{pageData.user_address.address_area}} {{pageData.user_address.address_content}}</view>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="box">
  62. <block v-for="(item,index) in pageData.goods_item" :key="index">
  63. <view class="cell">
  64. <view class="cell2 hflex acenter " @click="toGoodDetail(item.goods_id)">
  65. <image :src="item.goods_cover" mode="aspectFill" class="img"></image>
  66. <view class="img_right">
  67. <view class="hflex acenter jbetween">
  68. <view class="item_name text_hide" style="width: 374rpx;">{{item.goods_name}}</view>
  69. <view class="item_name">¥{{item.price_selling}}</view>
  70. </view>
  71. <view class="hflex jbetween" style="padding: 20rpx 0 0;">
  72. <view class="norm text_hide">{{item.goods_spec}}</view>
  73. <view class="left_text">X{{item.stock_sales}}</view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </block>
  79. <view class="hflex acenter jbetween cell">
  80. <view class="title">商品金额</view>
  81. <view class="right">¥{{pageData.amount_goods}}</view>
  82. </view>
  83. <!-- <view class="hflex acenter jbetween cell">
  84. <view class="title">优惠金额</view>
  85. <view class="right">¥{{pageData.amount_reduct}}</view>
  86. </view> -->
  87. <view class="hflex acenter jbetween cell">
  88. <view class="title">实付款</view>
  89. <view class="text_red">¥{{pageData.payment_amount}}</view>
  90. </view>
  91. <view class="hflex acenter jbetween cell">
  92. <view class="title">备注</view>
  93. <view class="text_style2">{{pageData.order_remark?pageData.order_remark:'-'}}</view>
  94. </view>
  95. <view class="line"></view>
  96. <view class="hflex acenter jbetween cell">
  97. <view class="title">订单编号</view>
  98. <view class="hflex acenter">
  99. <view class="text_style2">{{pageData.order_no}}</view>
  100. <view class="text_blue">|</view>
  101. <view class="text_blue" @click="copy">复制</view>
  102. </view>
  103. </view>
  104. <view class="hflex acenter jbetween cell">
  105. <view class="title">下单时间</view>
  106. <view class="text_style2">{{pageData.create_at}}</view>
  107. </view>
  108. <view class="hflex acenter jbetween cell" v-if="pageData.payment_datetime">
  109. <view class="title">付款时间</view>
  110. <view class="text_style2">{{pageData.payment_datetime}}</view>
  111. </view>
  112. <view class="hflex acenter jbetween cell" v-if="pageData.payment_status != 0">
  113. <view class="title">支付方式</view>
  114. <view class="text_style2">微信支付</view>
  115. </view>
  116. <view class="hflex acenter jbetween cell" v-if="pageData.user_address.send_datetime">
  117. <view class="title">发货时间</view>
  118. <view class="text_style2">{{pageData.user_address.send_datetime}}</view>
  119. </view>
  120. </view>
  121. </view>
  122. <view class="bottom hflex acenter jend" v-if="pageData.status == 2">
  123. <view class="btn" @click="openCancel">取消订单</view>
  124. <view class="btn btn2" @click="openPay">立即支付</view>
  125. </view>
  126. <view class="bottom hflex acenter jend" v-if="pageData.status == 4">
  127. <view class="btn" @click="remind" v-if="pageData.refund_status !== 1">提醒发货</view>
  128. <view class="btn" v-if="pageData.refund_status == 1" @click="cancel">撤销申请</view>
  129. <view class="btn btn2" v-else @click="apply">申请退款</view>
  130. </view>
  131. <view class="bottom hflex acenter jend" v-if="pageData.status == 5">
  132. <view class="btn btn2">确认收货</view>
  133. </view>
  134. <u-popup :show="cancel_show" :round="20" :closeable="true" mode="bottom" @close="close">
  135. <view class="popu">
  136. <view class="popu_title">订单取消原因</view>
  137. <view class="text_style2">请选择取消订单的原因(必选)</view>
  138. <u-radio-group v-model="cancelReason" placement="column">
  139. <block v-for="(item, index) in cancelList" :key="index" >
  140. <u-radio :name="item.name" @change="radioChange" :customStyle="{padding: '28rpx 0'}" :label="item.name"></u-radio>
  141. </block>
  142. </u-radio-group>
  143. <view class="btn_group hflex acenter jbetween">
  144. <view class="cancel_btn" @click="close">我再想想</view>
  145. <view class="sure_btn" @click="cancelOrder">取消订单</view>
  146. </view>
  147. </view>
  148. </u-popup>
  149. <u-popup :show="pay_show" :round="20" :closeable="true" mode="bottom" @close="close">
  150. <view class="popu">
  151. <view class="popu_title">立即付款</view>
  152. <view class="popu_price hflex acenter jcenter">¥{{pageData.amount_real}}</view>
  153. <view class="type">支付方式</view>
  154. <view class="way hflex acenter jbetween">
  155. <view class="hflex acenter">
  156. <image class="pay_icon" src="/static/images/shop/wx_pay.png"></image>
  157. <view >微信支付</view>
  158. </view>
  159. <u-radio-group v-model="payWay">
  160. <u-radio name="wx"></u-radio>
  161. </u-radio-group>
  162. </view>
  163. <view class="btn_group hflex acenter jbetween">
  164. <view class="sure_btn2" @click="payOrder">确认付款</view>
  165. </view>
  166. </view>
  167. </u-popup>
  168. </view>
  169. </template>
  170. <script>
  171. import $api from '@/static/js/api.js'
  172. var that = ''
  173. export default {
  174. data() {
  175. return {
  176. time: 0,
  177. time2: 0,
  178. timeData: {},
  179. timeData2: {},
  180. pageData: {
  181. },
  182. address: {
  183. },
  184. cancel_show: false,
  185. pay_show: false,
  186. cancelList: [
  187. {
  188. name: '商品无货'
  189. },
  190. {
  191. name: '发货时间问题'
  192. },
  193. {
  194. name: '不想要了'
  195. },
  196. {
  197. name: '商品错选/多选'
  198. },
  199. {
  200. name: '地址信息填写错误'
  201. },
  202. {
  203. name: '其他原因'
  204. }
  205. ],
  206. cancelReason: '',
  207. payWay: 'wx',
  208. id: '',
  209. }
  210. },
  211. onLoad(options) {
  212. that = this
  213. that.id = options.id
  214. that.getData()
  215. },
  216. methods: {
  217. getData() {
  218. $api.req({
  219. url: '/data/api.Order/order_info',
  220. method: 'POST',
  221. data: {
  222. order_id: that.id
  223. }
  224. }, function(res) {
  225. if(res.code == 1) {
  226. that.pageData = res.data
  227. for(var i=0;i<that.pageData.goods_item.length;i++) {
  228. that.pageData.goods_item[i].goods_spec = $api.resetspec(that.pageData.goods_item[0].goods_spec)
  229. }
  230. if(that.pageData.status == 2) {
  231. that.computTime()
  232. } else if(that.pageData.status == 5) {
  233. that.computTime2()
  234. }
  235. }
  236. })
  237. },
  238. // 倒计时
  239. onChange(e) {
  240. that.timeData = e
  241. },
  242. onChange2(e) {
  243. that.timeData2 = e
  244. },
  245. // 计算倒计时
  246. computTime() {
  247. var date = new Date(that.pageData.create_at).getTime() + ( that.pageData.time * 1000);
  248. var nowDate = new Date().getTime()
  249. that.time = date - nowDate
  250. },
  251. computTime2() {
  252. var date = ( that.pageData.order_timeout_end_time * 1000);
  253. var nowDate = new Date().getTime()
  254. that.time2 = that.pageData.order_timeout_end_time * 1000
  255. },
  256. // 复制订单号
  257. copy() {
  258. uni.setClipboardData({
  259. data: that.pageData.order_no,
  260. success: function () {
  261. $api.info('复制成功')
  262. }
  263. });
  264. },
  265. // 关闭
  266. close() {
  267. that.cancel_show = false
  268. that.pay_show = false
  269. },
  270. // 取消订单
  271. openCancel() {
  272. that.cancel_show = true
  273. },
  274. // 立即支付
  275. openPay() {
  276. that.pay_show = true
  277. },
  278. // 选择取消原因
  279. radioChange(e) {
  280. that.cancelReason = e
  281. },
  282. // 确认取消
  283. cancelOrder() {
  284. if(that.cancelReason == '') {
  285. $api.info('请选择取消订单的原因')
  286. } else {
  287. $api.req({
  288. url: '/data/api.Order/cancel_order',
  289. method: 'POST',
  290. data: {
  291. order_id: that.id,
  292. cancel_remark: that.cancelReason
  293. }
  294. }, function(res) {
  295. if(res.code == 1) {
  296. $api.info(res.info)
  297. that.close()
  298. that.getData()
  299. }
  300. })
  301. }
  302. },
  303. remind() {
  304. $api.req({
  305. url: '/data/api.Order/remind',
  306. method: 'POST',
  307. data: {
  308. order_id: that.id
  309. }
  310. }, function(res) {
  311. if(res.code == 1) {
  312. $api.info(res.info)
  313. }
  314. })
  315. },
  316. cancel() {
  317. $api.req({
  318. url: '/data/api.Order/cancel_refund',
  319. method: 'POST',
  320. data: {
  321. order_id: that.pageData.id
  322. }
  323. }, function(res) {
  324. if(res.code == 1) {
  325. $api.info(res.info)
  326. }
  327. })
  328. },
  329. // 确认付款
  330. payOrder() {
  331. var openid = uni.getStorageSync('openid1')
  332. /* if(!openid) {
  333. $api.info("登录验证有误,请重新登录")
  334. return
  335. } */
  336. $api.req({
  337. url: '/data/api.auth.Center/channel',
  338. method: 'POST',
  339. data: {
  340. type: 2,
  341. from: 1
  342. }
  343. }, function(res) {
  344. if(res.code == 1) {
  345. var pay_code = res.data[0].code
  346. $api.req({
  347. url: '/data/api.Order/order_pay',
  348. method: 'POST',
  349. data: {
  350. pay_code: pay_code,
  351. pay_no: that.pageData.payment_trade,
  352. type: 'wechat'
  353. }
  354. }, function(res) {
  355. if(res.code == 1) {
  356. wx.requestPayment({
  357. timeStamp: res.data.pay.timeStamp,
  358. nonceStr: res.data.pay.nonceStr,
  359. package: res.data.pay.package,
  360. signType: 'MD5',
  361. paySign: res.data.pay.paySign,
  362. success (res) {
  363. that.close()
  364. $api.jump('/page_shop/pages/order/paySuccess?id=' + that.id,2)
  365. },
  366. fail (res) { }
  367. })
  368. }
  369. })
  370. }
  371. })
  372. },
  373. apply() {
  374. $api.jump('/page_shop/pages/order/apply?id=' + that.id)
  375. },
  376. toGoodDetail(id) {
  377. $api.jump('/page_shop/pages/good/detail?id=' + id)
  378. }
  379. },
  380. }
  381. </script>
  382. <style lang="scss" scoped>
  383. .content::v-deep {
  384. background: #F4F4F4;
  385. .top {
  386. width: 100%;
  387. padding: 20rpx 30rpx 24rpx;
  388. .state {
  389. font-size: 36rpx;
  390. font-weight: 500;
  391. color: #222222;
  392. line-height: 50rpx;
  393. padding-right: 24rpx;
  394. }
  395. .blue_bg {
  396. // width: 124rpx;
  397. height: 32rpx;
  398. background: #506DFF;
  399. border-radius: 18rpx 0px 18rpx 18rpx;
  400. font-size: 16rpx;
  401. text-align: center;
  402. font-weight: 400;
  403. color: #FFFFFF;
  404. line-height: 32rpx;
  405. box-sizing: border-box;
  406. padding: 0 10rpx;
  407. }
  408. .blue_bg2 {
  409. // width: 256rpx;
  410. height: 32rpx;
  411. background: #E7EBFF;
  412. border-radius: 18rpx;
  413. font-size: 16rpx;
  414. font-weight: bold;
  415. color: #222222;
  416. line-height: 32rpx;
  417. box-sizing: border-box;
  418. padding: 0 10rpx;
  419. white-space: nowrap;
  420. }
  421. .time {
  422. padding-left: 16rpx;
  423. }
  424. .subTitle {
  425. font-size: 24rpx;
  426. font-weight: 400;
  427. color: #888888;
  428. line-height: 34rpx;
  429. }
  430. }
  431. .text_style2 {
  432. font-size: 26rpx;
  433. font-weight: 400;
  434. color: #888888;
  435. line-height: 36rpx;
  436. }
  437. .box {
  438. background: #FFFFFF;
  439. border-radius: 10px;
  440. margin: 20rpx auto 0;
  441. width: 690rpx;
  442. box-sizing: border-box;
  443. padding: 34rpx 20rpx;
  444. .title {
  445. font-size: 32rpx;
  446. font-weight: 500;
  447. color: #222222;
  448. line-height: 44rpx;
  449. }
  450. .text_style1 {
  451. font-size: 28rpx;
  452. font-weight: 500;
  453. color: #222222;
  454. line-height: 40rpx;
  455. }
  456. .text_style2 {
  457. font-size: 26rpx;
  458. font-weight: 400;
  459. color: #888888;
  460. line-height: 36rpx;
  461. }
  462. .text_blue {
  463. font-size: 26rpx;
  464. font-weight: 400;
  465. color: #506DFF;
  466. line-height: 36rpx;
  467. padding-left: 8rpx;
  468. }
  469. .cell {
  470. padding: 20rpx 0 32rpx;
  471. }
  472. .cell2 {
  473. border-bottom: 1rpx solid #F4F4F4;
  474. }
  475. .cell2:nth-last-child(1) {
  476. border: none;
  477. }
  478. .img {
  479. width: 160rpx;
  480. height: 160rpx;
  481. border-radius: 24rpx;
  482. }
  483. .img_right {
  484. width:calc(100% - 160rpx);
  485. padding-left: 20rpx;
  486. .item_name {
  487. font-size: 30rpx;
  488. font-weight: 400;
  489. color: #222222;
  490. line-height: 42rpx;
  491. }
  492. .norm {
  493. width: max-content;
  494. max-width: 288rpx;
  495. // height: 42px;
  496. background: #F5F5F5;
  497. border-radius: 12rpx;
  498. box-sizing: border-box;
  499. padding: 12rpx;
  500. font-size: 20rpx;
  501. font-weight: 400;
  502. color: #888888;
  503. line-height: 28rpx;
  504. }
  505. }
  506. .left_text {
  507. font-size: 24rpx;
  508. font-weight: 500;
  509. color: #888888;
  510. line-height: 28rpx;
  511. }
  512. .right_text {
  513. font-size: 24rpx;
  514. font-weight: bold;
  515. color: #222222;
  516. line-height: 28rpx;
  517. }
  518. .item_bottom {
  519. padding-top: 22rpx;
  520. border-top: 1rpx solid #F4F4F4;
  521. }
  522. .text_red {
  523. font-weight: bold;
  524. color: #EE5850;
  525. }
  526. .pay_icon {
  527. width: 48rpx;
  528. height: 48rpx;
  529. margin-right: 20rpx;
  530. }
  531. .check_icon {
  532. width: 32rpx;
  533. height: 32rpx;
  534. }
  535. .line {
  536. width: 100%;
  537. height: 1px;
  538. background: #F1F8FE;
  539. }
  540. }
  541. .box:nth-last-child(1) {
  542. margin-bottom: 186rpx;
  543. }
  544. .bottom {
  545. width: 100%;
  546. height: 166rpx;
  547. background: #FFFFFF;
  548. z-index: 9;
  549. position: fixed;
  550. bottom: 0;
  551. box-sizing: border-box;
  552. padding: 8rpx 50rpx 74rpx;
  553. .title {
  554. font-size: 24rpx;
  555. font-weight: 400;
  556. color: #222222;
  557. line-height: 34rpx;
  558. }
  559. .text_blue {
  560. font-size: 44rpx;
  561. color: #5270FF;
  562. }
  563. .btn{
  564. margin-left: 16rpx;
  565. width: 188rpx;
  566. height: 76rpx;
  567. border-radius: 38rpx;
  568. border: 1px solid #D2D2D2;
  569. text-align: center;
  570. font-size: 28rpx;
  571. font-weight: 400;
  572. color: #222;
  573. line-height: 76rpx;
  574. }
  575. .btn2 {
  576. border: 1px solid #506DFF;
  577. color: #506DFF;
  578. }
  579. }
  580. .popu {
  581. width: 100%;
  582. background: #FFFFFF;
  583. border-radius: 40rpx 40rpx 0px 0px;
  584. box-sizing: border-box;
  585. padding: 0 30rpx;
  586. .popu_title {
  587. width: 100%;
  588. text-align: center;
  589. padding: 48rpx 0 44rpx;
  590. font-size: 36rpx;
  591. font-weight: 500;
  592. color: #222222;
  593. line-height: 50rpx;
  594. }
  595. .popu_price {
  596. font-size: 36rpx;
  597. font-weight: 400;
  598. color: #FF2626;
  599. line-height: 44rpx;
  600. padding: 0 0 36rpx;
  601. }
  602. .type {
  603. font-size: 30rpx;
  604. font-weight: 400;
  605. color: #222222;
  606. line-height: 42rpx;
  607. }
  608. .way {
  609. width: 100%;
  610. margin: 28rpx 0 60rpx;
  611. background: #F4F4F4;
  612. border-radius: 12px;
  613. box-sizing: border-box;
  614. padding: 36rpx 20rpx;
  615. .pay_icon {
  616. width: 48rpx;
  617. height: 48rpx;
  618. margin-right: 20rpx;
  619. }
  620. }
  621. .btn_group {
  622. width: 100%;
  623. margin: 56rpx 0 20rpx;
  624. .cancel_btn {
  625. width: 330rpx;
  626. height: 84rpx;
  627. background: #F4F6FF;
  628. border-radius: 42rpx;
  629. text-align: center;
  630. font-size: 32rpx;
  631. font-weight: 400;
  632. color: #506DFF;
  633. line-height: 84rpx;
  634. }
  635. .sure_btn {
  636. width: 330rpx;
  637. height: 84rpx;
  638. background: #506DFF;
  639. border-radius: 42rpx;
  640. text-align: center;
  641. font-size: 32rpx;
  642. font-weight: 400;
  643. color: #FFFFFF;
  644. line-height: 84rpx;
  645. }
  646. .sure_btn2 {
  647. width: 100%;
  648. height: 84rpx;
  649. background: #506DFF;
  650. border-radius: 42rpx;
  651. text-align: center;
  652. font-size: 32rpx;
  653. font-weight: 400;
  654. color: #FFFFFF;
  655. line-height: 84rpx;
  656. }
  657. }
  658. .u-radio-group {
  659. flex: unset;
  660. }
  661. }
  662. }
  663. </style>