timescardDetail.vue 17 KB

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