You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

438 lines
10 KiB

4 years ago
  1. <template>
  2. <view class="app">
  3. <view class="main-wrap" :class="{show: loaded}">
  4. <view class="state-wrap column">
  5. <view class="row" @click="showPopup('timelinePopup')">
  6. <text class="state">{{ data.statusText }}</text>
  7. <text v-if="data.timeline" class="mix-icon icon-you"></text>
  8. </view>
  9. <text v-if="data.status_tip" class="tip">{{ data.status_tip }}</text>
  10. </view>
  11. <!-- 物流信息 -->
  12. <view v-if="expressInfo.context" class="addr-sec wl" @click="navToExpress(data)">
  13. <text class="mix-icon icon-wuliuyunshu"></text>
  14. <view class="con column">
  15. <text class="context">{{ expressInfo.context }}</text>
  16. <text class="time">{{ expressInfo.ftime }}</text>
  17. </view>
  18. <text class="mix-icon icon-you"></text>
  19. </view>
  20. <!-- 地址 -->
  21. <view class="addr-sec">
  22. <text class="mix-icon icon-dizhi"></text>
  23. <view class="con column">
  24. <text class="addr">{{ addr.address.address }} {{ addr.address.room }}</text>
  25. <text class="name">{{ addr.name }} {{ addr.mobile }}</text>
  26. </view>
  27. </view>
  28. <!-- 商品 -->
  29. <view v-if="data.products.length > 0" class="goods-sec">
  30. <product-list :list="data.products"></product-list>
  31. </view>
  32. <!-- 价格信息 -->
  33. <view class="price-sec">
  34. <view class="cell row">
  35. <text class="tit fill">商品金额</text>
  36. <text>{{ data.price_data.goods_price || 0 }}</text>
  37. </view>
  38. <view class="cell row">
  39. <text class="tag"></text>
  40. <text class="tit fill">订单满减</text>
  41. <text>-{{ data.price_data.full_reduction_money || 0 }}</text>
  42. </view>
  43. <view class="cell row">
  44. <text class="tag red"></text>
  45. <text class="tit fill">优惠券</text>
  46. <text>-{{ data.price_data.coupon_money || 0 }}</text>
  47. </view>
  48. <view class="cell row">
  49. <text class="tit fill">配送费</text>
  50. <text>0</text>
  51. </view>
  52. <view class="total row b-t">
  53. <text class="price">{{ data.price_data.pay_price || 0 }}</text>
  54. </view>
  55. </view>
  56. <view class="board">
  57. <view class="cell">
  58. <text class="tit">订单编号</text>
  59. <text class="text">{{ data.order_number || '' }}</text>
  60. <!-- #ifndef H5 -->
  61. <view class="copy-btn center round" @click="copy(data.order_number)">
  62. <text>复制</text>
  63. </view>
  64. <!-- #endif -->
  65. </view>
  66. <view class="cell">
  67. <text class="tit">下单时间</text>
  68. <text class="text">{{ data.add_time | date('Y-m-d H:i:s') }}</text>
  69. </view>
  70. <view v-if="data.pay_type" class="cell">
  71. <text class="tit">支付方式</text>
  72. <text class="text">{{ data.pay_type==='wxpay'?'微信支付':data.pay_type==='alipay'?'支付宝支付':'余额支付' }}</text>
  73. </view>
  74. <view v-if="data.remarks" class="cell">
  75. <text class="tit">订单备注</text>
  76. <text class="text">{{ data.remarks }}</text>
  77. </view>
  78. </view>
  79. <view class="bottom-fill-view"></view>
  80. <view class="page-bottom row">
  81. <view v-if="data.status===4 || data.status===10 || data.status===11 || data.status===14" class="btn center round" @click="deleteOrder(data)">
  82. <text>删除订单</text>
  83. </view>
  84. <view v-if="data.status===0" class="btn center round" @click="cancelOrder(data)">
  85. <text>取消订单</text>
  86. </view>
  87. <view v-if="data.status===0" class="btn center" @click="pay(data)">
  88. <text>立即支付</text>
  89. </view>
  90. <!-- #ifdef MP -->
  91. <button type="default" open-type="contact">
  92. <view v-if="data.status===1" class="btn center round" @click="cancelOrder(item)">
  93. <text>联系客服</text>
  94. </view>
  95. </button>
  96. <!-- #endif -->
  97. <!-- #ifndef H5 -->
  98. <view v-if="data.status===1" class="btn center round" @click="showRefundAction(data)">
  99. <text>申请退款</text>
  100. </view>
  101. <!-- #endif -->
  102. <!-- <view v-if="data.status===1" class="btn center round" @click="navTo('zizhufahuo?id='+data._id)">
  103. <text>自助发货</text>
  104. </view> -->
  105. <view v-if="data.status===2" class="btn center round" @click="navToExpress(data)">
  106. <text>查看物流</text>
  107. </view>
  108. <view v-if="data.status===2" class="btn center" @click="confirmReceipt(data)">
  109. <text>确认收货</text>
  110. </view>
  111. <view v-if="data.status===3" class="btn center" @click="rate(data)">
  112. <text>立即评价</text>
  113. </view>
  114. </view>
  115. </view>
  116. <!-- 时间轴 -->
  117. <uni-popup v-if="data.timeline" ref="timelinePopup">
  118. <view class="timeline-content">
  119. <scroll-view class="timeline-scroll" scroll-y="true">
  120. <mix-timeline :list="data.timeline"></mix-timeline>
  121. </scroll-view>
  122. <text class="mix-icon icon-guanbi1" @click="hidePopup('timelinePopup')"></text>
  123. </view>
  124. </uni-popup>
  125. <mix-loading v-if="isLoading"></mix-loading>
  126. <mix-modal ref="mixModal" title="订单提示" :text="modalText" @onConfirm="onModalConfirm"></mix-modal>
  127. <mix-action-sheet ref="mixActionSheet" @onConfirm="refund"></mix-action-sheet>
  128. </view>
  129. </template>
  130. <script>
  131. import OrderMixin from './mixin/order.js'
  132. import productList from './components/product-list'
  133. export default {
  134. components: {
  135. productList
  136. },
  137. mixins: [OrderMixin],
  138. data() {
  139. return {
  140. modalText: '', //确认对话框内容
  141. addr: {
  142. address: {}
  143. },
  144. data: {
  145. products: [],
  146. price_data: {}
  147. },
  148. expressInfo: {},//物流信息
  149. }
  150. },
  151. onLoad(options){
  152. this.id = options.id;
  153. this.loadData();
  154. },
  155. methods: {
  156. async loadData(){
  157. const res = await this.$request('order', 'getDetail', {
  158. id: this.id
  159. }, {showLoading: !this.loaded})
  160. if(res.status === 0){
  161. this.$util.msg('订单不存在');
  162. setTimeout(()=>{
  163. uni.navigateBack();
  164. }, 1000)
  165. return;
  166. }
  167. const data = res.data;
  168. if(data.express_info && data.express_info.data && data.express_info.data.length > 0){
  169. this.expressInfo = data.express_info.data[0];
  170. }
  171. this.data = data;
  172. console.log(JSON.parse(JSON.stringify(data)));
  173. this.addr = data.address;
  174. },
  175. copy(str){
  176. uni.setClipboardData({
  177. data: str
  178. })
  179. }
  180. }
  181. }
  182. </script>
  183. <style>
  184. page{
  185. background-color: #f7f7f7;
  186. }
  187. </style>
  188. <style scoped lang="scss">
  189. .app{
  190. padding-bottom: 24rpx;
  191. }
  192. .main-wrap{
  193. padding: 0 20rpx;
  194. opacity: 0;
  195. transition: .2s;
  196. &.show{
  197. opacity: 1;
  198. }
  199. }
  200. .state-wrap{
  201. padding: 30rpx 20rpx 30rpx;
  202. .state{
  203. font-size: 38rpx;
  204. color: #333;
  205. font-weight: 700;
  206. }
  207. .tip{
  208. margin-top: 20rpx;
  209. font-size: 26rpx;
  210. color: #666;
  211. }
  212. .icon-you{
  213. margin-left: 10rpx;
  214. font-size: 28rpx;
  215. color: #333;
  216. }
  217. }
  218. .addr-sec{
  219. display: flex;
  220. padding: 20rpx;
  221. margin-bottom: 16rpx;
  222. background-color: #fff;
  223. border-radius: 10rpx;
  224. position: relative;
  225. overflow: hidden;
  226. &.wl{
  227. align-items: center;
  228. .con{
  229. padding-right: 0;
  230. padding-left: 56rpx;
  231. }
  232. .icon-wuliuyunshu{
  233. position: absolute;
  234. top: 22rpx;
  235. font-size: 40rpx;
  236. color: #1d96ff;
  237. }
  238. .context{
  239. margin-bottom: 16rpx;
  240. font-size: 26rpx;
  241. color: #1d96ff;
  242. line-height: 1.4;
  243. word-break: break-all;
  244. text-indent: -10rpx;
  245. }
  246. .time{
  247. font-size: 24rpx;
  248. color: #999;
  249. }
  250. .icon-you{
  251. margin-left: 10rpx;
  252. font-size: 26rpx;
  253. color: #999;
  254. }
  255. }
  256. .icon-dizhi{
  257. transform: translateY(6rpx);
  258. width: 52rpx;
  259. font-size: 36rpx;
  260. color: $base-color;
  261. }
  262. .con{
  263. flex: 1;
  264. padding: 0 80rpx 10rpx 0;
  265. }
  266. .addr{
  267. margin-bottom: 16rpx;
  268. font-size: 30rpx;
  269. color: #333;
  270. line-height: 1.4;
  271. }
  272. .name{
  273. font-size: 28rpx;
  274. color: #999;
  275. }
  276. }
  277. .goods-sec{
  278. background-color: #fff;
  279. border-radius: 10rpx 10rpx 0 0;
  280. overflow: hidden;
  281. /deep/ .list .title{
  282. font-size: 28rpx;
  283. }
  284. }
  285. .price-sec{
  286. padding-top: 14rpx;
  287. border-radius: 0 0 10rpx 10rpx;
  288. background-color: #fff;
  289. .cell{
  290. height: 68rpx;
  291. padding: 0 24rpx;
  292. font-size: 26rpx;
  293. color: #333;
  294. }
  295. .total{
  296. justify-content: flex-end;
  297. height: 80rpx;
  298. padding-right: 20rpx;
  299. margin-top: 16rpx;
  300. font-size: 32rpx;
  301. color: $base-color;
  302. font-weight: 700;
  303. .price:before{
  304. content: '实付款 ';
  305. position: relative;
  306. bottom: 2rpx;
  307. color: #333;
  308. font-size: 28rpx;
  309. font-weight: normal;
  310. }
  311. }
  312. .tag{
  313. padding: 6rpx 8rpx;
  314. margin-right: 8rpx;
  315. font-size: 20rpx;
  316. color: #fff;
  317. border-radius: 8rpx;
  318. background-color: orange;
  319. &.red{
  320. background-color: $base-color;
  321. }
  322. }
  323. }
  324. .board{
  325. padding: 10rpx 20rpx;
  326. margin-top: 16rpx;
  327. border-radius: 10rpx;
  328. background-color: #fff;
  329. .cell{
  330. display: flex;
  331. min-height: 62rpx;
  332. padding: 12rpx 0;
  333. .tit{
  334. font-size: 26rpx;
  335. color: #666;
  336. line-height: 36rpx;
  337. }
  338. .text{
  339. flex: 1;
  340. font-size: 26rpx;
  341. color: #333;
  342. line-height: 36rpx;
  343. }
  344. }
  345. .copy-btn{
  346. padding: 8rpx 12rpx;
  347. font-size: 22rpx;
  348. color: #333;
  349. &:after{
  350. border-radius: 10rpx;
  351. border-color: #bbb;
  352. }
  353. }
  354. }
  355. .page-bottom{
  356. position: fixed;
  357. left: 0;
  358. bottom: 0;
  359. z-index: 90;
  360. justify-content: flex-end;
  361. width: 100%;
  362. height: 100rpx;
  363. box-sizing: content-box;
  364. padding-bottom: constant(safe-area-inset-bottom);
  365. padding-bottom: env(safe-area-inset-bottom);
  366. background-color: #fff;
  367. box-shadow: 0 0 10rpx rgba(0,0,0,.1);
  368. .btn{
  369. width: 168rpx;
  370. height: 68rpx;
  371. margin-right: 24rpx;
  372. font-size: 28rpx;
  373. color: #fff;
  374. background-color: $base-color;
  375. border-radius: 100rpx;
  376. }
  377. .round{
  378. background-color: #fff;
  379. color: #333;
  380. }
  381. }
  382. .bottom-fill-view{
  383. height: 100rpx;
  384. box-sizing: content-box;
  385. padding-bottom: constant(safe-area-inset-bottom);
  386. padding-bottom: env(safe-area-inset-bottom);
  387. }
  388. .timeline-content{
  389. }
  390. .timeline-content{
  391. position: relative;
  392. padding-bottom: 30rpx;
  393. .timeline-scroll{
  394. width: 600rpx;
  395. height: 700rpx;
  396. margin-bottom: 16rpx;
  397. background-color: #fff;
  398. border-radius: 16rpx;
  399. /deep/ {
  400. .mix-timeline{
  401. padding: 40rpx 20rpx 10rpx;
  402. }
  403. }
  404. }
  405. .icon-guanbi1{
  406. position: absolute;
  407. left: 50%;
  408. bottom: -100rpx;
  409. padding: 20rpx;
  410. font-size: 40rpx;
  411. color: #fff;
  412. transform: translateX(-50%);
  413. }
  414. }
  415. </style>