orderDetail.vue 17 KB

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