timescardDetail.vue 16 KB

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