orderdetail.vue 16 KB

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