orderpay.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. <template>
  2. <view class="container">
  3. <view class="tui-order-header">
  4. <image src="/static/images/mall/order/img_detail_bg.png" mode="widthFix" class="tui-img-bg"></image>
  5. <view class="tui-header-content">
  6. <view>
  7. <view class="tui-status-text">{{orderDetail.orderInfo.orderStatus.name}}</view>
  8. </view>
  9. <image v-if="orderDetail.orderInfo.order_status_id==1"
  10. src="/static/images/mall/order/img_order_payment3x.png" class="tui-status-img" mode="widthFix">
  11. </image>
  12. <image v-if="orderDetail.orderInfo.order_status_id==2"
  13. src="/static/images/mall/order/img_order_send3x.png" class="tui-status-img" mode="widthFix"></image>
  14. <image v-if="orderDetail.orderInfo.order_status_id==3"
  15. src="/static/images/mall/order/img_order_received3x.png" class="tui-status-img" mode="widthFix">
  16. </image>
  17. <image v-if="orderDetail.orderInfo.order_status_id==5"
  18. src="/static/images/mall/order/img_order_signed3x.png" class="tui-status-img" mode="widthFix">
  19. </image>
  20. <image v-if="orderDetail.orderInfo.order_status_id==4"
  21. src="/static/images/mall/order/img_order_closed3x.png" class="tui-status-img" mode="widthFix">
  22. </image>
  23. </view>
  24. </view>
  25. <tui-list-cell v-if="orderDetail.orderInfo.is_errands==1" unlined :hover="false">
  26. <view class="tui-flex-box">
  27. <image src="/static/images/mall/order/img_order_address3x.png" class="tui-icon-img"></image>
  28. <view class="tui-addr">
  29. <view class="tui-addr-text">取件地址</view>
  30. <view class="tui-addr-userinfo">联系人:{{orderDetail.orderInfo.take_address.name}}<text
  31. class="tui-addr-tel">{{orderDetail.orderInfo.take_address.telephone}}</text></view>
  32. <view class="tui-addr-text">
  33. 地址:{{orderDetail.orderInfo.take_address.province_name}}{{orderDetail.orderInfo.take_address.city_name}}{{orderDetail.orderInfo.take_address.district_name}}{{orderDetail.orderInfo.take_address.address}}
  34. </view>
  35. </view>
  36. </view>
  37. </tui-list-cell>
  38. <tui-list-cell v-if="orderDetail.orderInfo.deliverymode==1 || orderDetail.orderInfo.deliverymode==3" unlined
  39. :hover="false">
  40. <view class="tui-flex-box">
  41. <image src="/static/images/mall/order/img_order_address3x.png" class="tui-icon-img"></image>
  42. <view class="tui-addr">
  43. <view v-if="orderDetail.orderInfo.is_errands==1" class="tui-addr-text">收件地址</view>
  44. <view class="tui-addr-userinfo">联系人:{{orderDetail.orderInfo.address.name}}<text
  45. class="tui-addr-tel">{{orderDetail.orderInfo.address.telephone}}</text></view>
  46. <view class="tui-addr-text">
  47. 地址:{{orderDetail.orderInfo.address.alladdress}}
  48. </view>
  49. <view v-if="orderDetail.orderInfo.is_errands!=1" class="tui-addr-text">
  50. 预约时间:{{orderDetail.orderInfo.ServiceTime}}</view>
  51. <view class="tui-Technical" @tap="toTel(orderDetail.orderInfo.Technical.tel)" v-if="orderDetail.orderInfo.Technical">接单{{lang.technical}}:{{orderDetail.orderInfo.Technical.title}}<text class="tui-addr-tel" style="color: #5454f3;">{{orderDetail.orderInfo.Technical.tel}}</text></view>
  52. </view>
  53. </view>
  54. </tui-list-cell>
  55. <tui-list-cell v-if="orderDetail.orderInfo.deliverymode==2" unlined :hover="false">
  56. <view class="tui-flex-box">
  57. <image src="/static/images/mall/order/img_order_address3x.png" class="tui-icon-img"></image>
  58. <view class="tui-addr">
  59. <view class="tui-addr-userinfo">门店:{{orderDetail.orderInfo.store.title}}<text
  60. class="tui-addr-tel">{{orderDetail.orderInfo.address.telephone}}</text></view>
  61. <view class="tui-addr-text" @tap="storeopenLocation">
  62. 地址:{{orderDetail.orderInfo.store.province_name}}{{orderDetail.orderInfo.store.city_name}}{{orderDetail.orderInfo.store.district_name}}{{orderDetail.orderInfo.store.region_name}}
  63. <image src="/static/images/map.png" class="map-img"> </image><text
  64. style="color: #5454f3;">导航到这里</text>
  65. </view>
  66. <view class="tui-addr-text">电话:{{orderDetail.orderInfo.store.tel}}</view>
  67. </view>
  68. </view>
  69. </tui-list-cell>
  70. <view class="tui-order-item">
  71. <tui-list-cell :hover="false" :lineLeft="false">
  72. <view class="tui-goods-title">
  73. 服务内容
  74. </view>
  75. </tui-list-cell>
  76. <block v-if="orderDetail.orderInfo.cat_id">
  77. <tui-list-cell padding="0">
  78. <view class="tui-goods-item">
  79. <image :src="orderDetail.orderInfo.cateMap.image || '/static/images/default_img.png'"
  80. class="tui-goods-img" mode="widthFix"></image>
  81. <view class="tui-goods-center">
  82. <view class="tui-goods-name">{{orderDetail.orderInfo.pay_subject}}</view>
  83. </view>
  84. <view class="tui-price-right">
  85. <view>x1</view>
  86. </view>
  87. </view>
  88. </tui-list-cell>
  89. </block>
  90. <block v-else>
  91. <block v-for="(item,index) in orderDetail.goods" :key="index">
  92. <tui-list-cell padding="0">
  93. <view class="tui-goods-item">
  94. <image :src="item.image" class="tui-goods-img" mode="widthFix"></image>
  95. <view class="tui-goods-center">
  96. <view class="tui-goods-name">{{item.name}}</view>
  97. <view v-if="index ==0 && orderDetail.orderInfo.timesmum>0" class="tui-goods-attr">次卡:{{orderDetail.orderInfo.timesmum}}次,剩余:{{orderDetail.orderInfo.remain}}次</view>
  98. <view v-if="item.label" class="tui-goods-attr">{{item.label}}</view>
  99. </view>
  100. <view class="tui-price-right">
  101. <view>¥{{item.price}}</view>
  102. <view>x{{item.quantity}}</view>
  103. </view>
  104. </view>
  105. </tui-list-cell>
  106. </block>
  107. </block>
  108. <tui-list-cell :hover="false" :lineLeft="false">
  109. <view class="tui-goods-title">
  110. 订单备注
  111. </view>
  112. </tui-list-cell>
  113. <block v-if="orderDetail.orderInfo.remark">
  114. <tui-list-cell padding="0">
  115. <view class="tui-goods-item" style="color: #999;">
  116. {{orderDetail.orderInfo.remark}}
  117. </view>
  118. </tui-list-cell>
  119. </block>
  120. <view class="tui-img__box"
  121. v-if="OrderImage && OrderImage.length>0">
  122. <block v-for="(src,index) in OrderImage" :key="index">
  123. <image @tap.stop="previewImage(index)"
  124. :class="{'tui-image':OrderImage.length===1}" :src="src"
  125. :mode="OrderImage.length===1?'widthFix':'aspectFill'"></image>
  126. </block>
  127. </view>
  128. <view v-if="orderDetail.orderInfo.is_additional==1" class="tui-goods-info">
  129. <view class="tui-price-flex tui-size32 tui-pbtm20">
  130. <view class="tui-flex-shrink">预付金额</view>
  131. <view class="tui-goods-price">
  132. <view class="tui-size-24">¥</view>
  133. <view class="tui-price-large"> {{orderDetail.orderInfo.total}}</view>
  134. </view>
  135. </view>
  136. <view v-if="orderDetail.orderInfo.additional>0" class="tui-price-flex tui-size32 tui-pbtm20">
  137. <view class="tui-flex-shrink">尾款</view>
  138. <view class="tui-goods-price">
  139. <view class="tui-size-24">
  140. <text v-if="orderDetail.orderInfo.additional_pay_time>0">已支付</text>
  141. <text v-if="orderDetail.orderInfo.additional_pay_time==0">未支付</text>
  142. </view>
  143. <view class="tui-price-large"> {{orderDetail.orderInfo.additional}}</view>
  144. </view>
  145. </view>
  146. </view>
  147. <view v-else class="tui-goods-info">
  148. <view class="tui-price-flex tui-size32 tui-pbtm20">
  149. <view class="tui-flex-shrink">合计</view>
  150. <view class="tui-goods-price">
  151. <view class="tui-size-24">¥</view>
  152. <view class="tui-price-large"> {{orderDetail.orderInfo.total}}</view>
  153. </view>
  154. </view>
  155. </view>
  156. </view>
  157. <view class="tui-safe-area"></view>
  158. <view class="tui-tabbar tui-order-btn">
  159. <view v-if="orderDetail.orderInfo.payment_code=='wx_pay' && orderDetail.orderInfo.order_status_id==1">
  160. <tui-button type="danger" width="300rpx" height="60rpx" :size="26" shape="circle"
  161. @click="toPayTap(orderDetail.orderInfo.total,orderDetail.orderInfo.id)">立即支付</tui-button>
  162. </view>
  163. </view>
  164. </view>
  165. </template>
  166. <script>
  167. import pay from '@/common/pay.js'
  168. export default {
  169. components: {},
  170. data() {
  171. return {
  172. lang: {},
  173. orderid: '',
  174. //1-待付款 2-付款成功 3-待收货 4-订单已完成 5-交易关闭
  175. status: 1,
  176. orderDetail: [],
  177. OrderImage:[],
  178. is_show: 0,
  179. }
  180. },
  181. onLoad: function(options) {
  182. let _this = this
  183. _this.$request.get('Lang.getlang').then(res => {
  184. if (res.errno == 0) {
  185. _this.lang = res.data;
  186. }
  187. });
  188. _this.orderid = options.id;
  189. if (options && options.scene) {
  190. _this.orderid = options.scene;
  191. }
  192. _this.detail();
  193. },
  194. methods: {
  195. detail() {
  196. let _this = this
  197. let orderid = _this.orderid;
  198. _this.$request.get('order.detail', {
  199. samkey: (new Date()).valueOf(),
  200. id: orderid
  201. }).then(function(res) {
  202. if (res.errno != 0) {
  203. uni.showModal({
  204. title: '错误',
  205. content: res.msg,
  206. showCancel: false
  207. })
  208. return;
  209. }
  210. _this.orderDetail = res.data;
  211. if(_this.orderDetail){
  212. if(_this.orderDetail.orderInfo){
  213. _this.OrderImage = _this.orderDetail.orderInfo.OrderImage
  214. }
  215. }
  216. });
  217. },
  218. getAuthMsg() {
  219. return new Promise(resolve => {
  220. console.log('sssss')
  221. if (this.orderDetail.tmplIds.length > 0) {
  222. uni.requestSubscribeMessage({
  223. tmplIds: this.orderDetail.tmplIds,
  224. fail(res) {
  225. console.log(res);
  226. },
  227. complete() {
  228. resolve();
  229. }
  230. });
  231. } else {
  232. resolve();
  233. }
  234. });
  235. },
  236. toPayTap: function(total, orderid) {
  237. const redirectUrl = "/pagesA/my/publicOrder/orderpay?id=" + this.orderDetail.orderInfo.id;
  238. pay.wxpay('order', total, orderid, redirectUrl);
  239. },
  240. storeopenLocation: function() {
  241. uni.openLocation({
  242. latitude: Number(this.orderDetail.orderInfo.store.latitude), //要去的纬度-地址
  243. longitude: Number(this.orderDetail.orderInfo.store.longitude), //要去的经度-地址
  244. address: this.orderDetail.orderInfo.store.region_name,
  245. success: function() {
  246. console.log('success');
  247. },
  248. fail: function() {
  249. console.log('fail');
  250. }
  251. })
  252. },
  253. toTel: function(tel) {
  254. console.log(tel);
  255. //电话
  256. uni.makePhoneCall({
  257. phoneNumber: tel
  258. });
  259. },
  260. openLocation: function() {
  261. uni.openLocation({
  262. latitude: Number(this.orderDetail.orderInfo.address.latitude), //要去的纬度-地址
  263. longitude: Number(this.orderDetail.orderInfo.address.longitude), //要去的经度-地址
  264. address: this.orderDetail.orderInfo.address.address,
  265. success: function() {
  266. console.log('success');
  267. },
  268. fail: function() {
  269. console.log('fail');
  270. }
  271. })
  272. },
  273. previewImage(current) {
  274. let imgs = this.OrderImage
  275. console.log(imgs);
  276. uni.previewImage({
  277. current: current,
  278. urls: imgs
  279. })
  280. },
  281. },
  282. /**
  283. * 页面相关事件处理函数--监听用户下拉动作
  284. */
  285. onPullDownRefresh: function() {
  286. setTimeout(() => {
  287. uni.stopPullDownRefresh()
  288. }, 200);
  289. },
  290. }
  291. </script>
  292. <style>
  293. .container {
  294. padding-bottom: 118rpx;
  295. }
  296. .tui-order-header {
  297. width: 100%;
  298. height: 160rpx;
  299. position: relative;
  300. background-color: #EB0909;
  301. }
  302. .tui-img-bg {
  303. width: 100%;
  304. height: 160rpx;
  305. }
  306. .tui-header-content {
  307. width: 100%;
  308. height: 160rpx;
  309. position: absolute;
  310. z-index: 10;
  311. left: 0;
  312. top: 0;
  313. display: flex;
  314. align-items: center;
  315. justify-content: space-between;
  316. padding: 0 70rpx;
  317. box-sizing: border-box;
  318. }
  319. .tui-status-text {
  320. font-size: 34rpx;
  321. line-height: 34rpx;
  322. color: #FEFEFE;
  323. }
  324. .tui-reason {
  325. font-size: 24rpx;
  326. line-height: 24rpx;
  327. color: rgba(254, 254, 254, 0.75);
  328. padding-top: 15rpx;
  329. display: flex;
  330. align-items: center;
  331. }
  332. .tui-reason-text {
  333. padding-right: 12rpx;
  334. }
  335. .tui-status-img {
  336. width: 80rpx;
  337. height: 80rpx;
  338. display: block;
  339. }
  340. .tui-flex-box {
  341. width: 100%;
  342. display: flex;
  343. align-items: center;
  344. }
  345. .tui-icon-img {
  346. width: 44rpx;
  347. height: 44rpx;
  348. flex-shrink: 0;
  349. }
  350. .map-img {
  351. width: 50rpx;
  352. height: 50rpx;
  353. margin-left: 10rpx;
  354. margin-right: 10rpx;
  355. margin-top: -30rpx;
  356. margin-bottom: -10rpx;
  357. }
  358. .tui-addr {
  359. display: flex;
  360. flex-direction: column;
  361. justify-content: center;
  362. padding-left: 20rpx;
  363. box-sizing: border-box;
  364. }
  365. .tui-addr-userinfo {
  366. font-size: 30rpx;
  367. line-height: 30rpx;
  368. font-weight: bold;
  369. }
  370. .tui-Technical {
  371. padding-top: 16rpx;
  372. font-size: 30rpx;
  373. line-height: 30rpx;
  374. font-weight: bold;
  375. }
  376. .tui-addr-text {
  377. font-size: 24rpx;
  378. line-height: 32rpx;
  379. padding-top: 16rpx;
  380. }
  381. .tui-addr-tel {
  382. padding-left: 40rpx;
  383. }
  384. .tui-order-item {
  385. margin-top: 20rpx;
  386. border-radius: 10rpx;
  387. overflow: hidden;
  388. }
  389. .tui-goods-title {
  390. width: 100%;
  391. font-size: 28rpx;
  392. line-height: 28rpx;
  393. display: flex;
  394. align-items: center;
  395. justify-content: space-between;
  396. }
  397. .tui-goods-item {
  398. width: 100%;
  399. padding: 20rpx 30rpx;
  400. box-sizing: border-box;
  401. display: flex;
  402. justify-content: space-between;
  403. }
  404. .tui-goods-img {
  405. width: 180rpx;
  406. height: 180rpx;
  407. display: block;
  408. flex-shrink: 0;
  409. }
  410. .tui-goods-center {
  411. flex: 1;
  412. padding: 20rpx 8rpx;
  413. box-sizing: border-box;
  414. }
  415. .tui-goods-name {
  416. max-width: 310rpx;
  417. word-break: break-all;
  418. overflow: hidden;
  419. text-overflow: ellipsis;
  420. display: -webkit-box;
  421. -webkit-box-orient: vertical;
  422. -webkit-line-clamp: 2;
  423. font-size: 26rpx;
  424. line-height: 32rpx;
  425. }
  426. .tui-goods-attr {
  427. font-size: 22rpx;
  428. color: #888888;
  429. line-height: 32rpx;
  430. padding-top: 20rpx;
  431. word-break: break-all;
  432. overflow: hidden;
  433. text-overflow: ellipsis;
  434. display: -webkit-box;
  435. -webkit-box-orient: vertical;
  436. -webkit-line-clamp: 2;
  437. }
  438. .tui-price-right {
  439. text-align: right;
  440. font-size: 24rpx;
  441. color: #888888;
  442. line-height: 30rpx;
  443. padding-top: 20rpx;
  444. }
  445. .tui-color-red {
  446. color: #E41F19;
  447. padding-right: 30rpx;
  448. }
  449. .tui-goods-price {
  450. width: 100%;
  451. display: flex;
  452. align-items: flex-end;
  453. justify-content: flex-end;
  454. font-size: 24rpx;
  455. }
  456. .tui-size-24 {
  457. font-size: 24rpx;
  458. line-height: 24rpx;
  459. }
  460. .tui-price-large {
  461. font-size: 32rpx;
  462. line-height: 30rpx;
  463. }
  464. .tui-goods-info {
  465. width: 100%;
  466. padding: 30rpx;
  467. box-sizing: border-box;
  468. background: #fff;
  469. }
  470. .tui-price-flex {
  471. display: flex;
  472. align-items: center;
  473. justify-content: space-between;
  474. }
  475. .tui-size24 {
  476. padding-bottom: 20rpx;
  477. font-size: 24rpx;
  478. line-height: 24rpx;
  479. color: #888;
  480. }
  481. .tui-size32 {
  482. font-size: 32rpx;
  483. line-height: 32rpx;
  484. font-weight: 500;
  485. }
  486. .tui-pbtm20 {
  487. padding-bottom: 20rpx;
  488. }
  489. .tui-flex-shrink {
  490. flex-shrink: 0;
  491. }
  492. .tui-primary-color {
  493. color: #EB0909;
  494. }
  495. .tui-order-info {
  496. margin-top: 20rpx;
  497. }
  498. .tui-order-title {
  499. position: relative;
  500. font-size: 28rpx;
  501. line-height: 28rpx;
  502. padding-left: 12rpx;
  503. box-sizing: border-box;
  504. }
  505. .tui-order-title::before {
  506. content: '';
  507. position: absolute;
  508. left: 0;
  509. top: 0;
  510. border-left: 4rpx solid #EB0909;
  511. height: 100%;
  512. }
  513. .tui-order-content {
  514. width: 100%;
  515. padding: 24rpx 30rpx;
  516. box-sizing: border-box;
  517. background: #fff;
  518. font-size: 24rpx;
  519. line-height: 30rpx;
  520. }
  521. .tui-order-flex {
  522. display: flex;
  523. padding-top: 18rpx;
  524. }
  525. .tui-order-flex:first-child {
  526. padding-top: 0
  527. }
  528. .tui-item-title {
  529. width: 132rpx;
  530. flex-shrink: 0;
  531. }
  532. .tui-item-content {
  533. color: #666;
  534. line-height: 32rpx;
  535. }
  536. .tui-safe-area {
  537. height: 1rpx;
  538. padding-bottom: env(safe-area-inset-bottom);
  539. }
  540. .tui-tabbar {
  541. width: 100%;
  542. height: 98rpx;
  543. background: #fff;
  544. position: fixed;
  545. left: 0;
  546. bottom: 0;
  547. display: flex;
  548. align-items: center;
  549. justify-content: center;
  550. font-size: 26rpx;
  551. box-shadow: 0 0 1px rgba(0, 0, 0, .3);
  552. padding-bottom: env(safe-area-inset-bottom);
  553. z-index: 996;
  554. }
  555. .tui-btn-mr {
  556. margin-right: 30rpx;
  557. }
  558. .tui-contact {
  559. display: flex;
  560. align-items: center;
  561. justify-content: center;
  562. font-size: 28rpx;
  563. }
  564. .tui-contact image {
  565. width: 36rpx;
  566. height: 36rpx;
  567. margin-right: 16rpx;
  568. }
  569. .tui-img__box {
  570. width: 100%;
  571. font-size: 0;
  572. padding-top: 4rpx;
  573. }
  574. .tui-img__box image {
  575. width: 200rpx;
  576. height: 200rpx;
  577. margin-right: 12rpx;
  578. margin-top: 12rpx;
  579. }
  580. .tui-image {
  581. width: 400rpx !important;
  582. height: auto;
  583. }
  584. </style>