pay.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192
  1. <template>
  2. <view class="older-detail" style="padding-bottom: 300rpx;">
  3. <view style="font-weight: bold;font-size: 36rpx;color: #1EDA94;">
  4. <view v-if="order.status ==1">待付款...</view>
  5. <view v-if="order.status ==2">待服务</view>
  6. <view v-if="order.status ==5">已完成</view>
  7. <view v-if="order.status ==6">服务中</view>
  8. <view v-if="order.status ==7">已出发</view>
  9. <view v-if="order.status ==8">已到达</view>
  10. <view v-if="order.status ==3">待评价</view>
  11. <view v-if="order.status ==4" style="color: #999999;">已取消</view>
  12. </view>
  13. <view class=" bg"
  14. @tap="bindGps(order.latitude,order.longitude,order.address)">
  15. <view>
  16. <view class="flex align-center justify-between" style="font-weight: bold;font-size: 32rpx;color: #222222;" @tap.stop="copyAddress()"
  17. v-if="order.status !=1 && order.status !=5 && order.status !=3 && order.status !=4">
  18. <text>{{order.userName}}</text>
  19. <text>{{order.phone ? order.phone.substring(0,3) + '****' + order.phone.substring(7,11) : ''}}</text>
  20. <!-- <u-icon name="file-text"></u-icon> -->
  21. </view>
  22. <view class="flex align-center justify-between" style="font-weight: bold;font-size: 32rpx;color: #222222;" v-else>
  23. <text>{{order.userName}}</text>
  24. <text>{{order.phone ? order.phone.substring(0,3) + '****' + order.phone.substring(7,11) : ''}}</text>
  25. </view>
  26. <view style="font-size: 28rpx;color: #AAAAAA; margin-top:20rpx;">地址:{{order.address}}</view>
  27. </view>
  28. </view>
  29. <view class="u-skeleton">
  30. <view class="u-skeleton-fillet">
  31. <view class="bg ">
  32. <view class="flex justify-around">
  33. <view class="" style="width: 160rpx;height: 160rpx;">
  34. <image :src="order.ordersMassageList[0].massageType.massageImg"
  35. style="width: 100%;height: 100%;border-radius: 32rpx;"></image>
  36. </view>
  37. <view class="u-flex-1 margin-left-sm">
  38. <view class="flex">
  39. <!-- <image src="../../static/images/geren.png" style="width: 35rpx;height: 35rpx;">
  40. </image> -->
  41. <view class=" u-skeleton-fillet"
  42. style="display: inline-block;width: 400rpx; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;font-weight: bold;font-size: 32rpx;color: #222222;margin-top: 24rpx;">
  43. {{order.ordersMassageList[0].massageType.title}}
  44. </view>
  45. </view>
  46. <view class="flex justify-between" style="font-size: 28rpx;color: #AAAAAA;margin-top: 20rpx;">
  47. <view>时长:{{order.ordersMassageList[0].massageType.duration}}分钟
  48. x{{order.ordersMassageList[0].num}}</view>
  49. </view>
  50. </view>
  51. </view>
  52. <view style="display: flex;justify-content: space-between;padding-top: 20rpx;border-top:1rpx solid #F0F0F0;margin-top: 24rpx;">
  53. <view class="" style="font-size: 28rpx;">
  54. 实付:
  55. </view>
  56. <view style="font-weight: bold;font-size: 40rpx;color: #F24E4E;">¥{{order.payMoney}}</view>
  57. </view>
  58. </view>
  59. <!-- <view class="flex justify-between margin-top-lg" v-if="order.artificerTaxiMoney">
  60. <view style="width: 180upx;">出行交通费用</view>
  61. <view class="">¥{{order.artificerTaxiMoney}}</view>
  62. </view> -->
  63. <view class="bg" style="padding-top: 0;">
  64. <view class="flex justify-between padding-top" v-if="order.couponMoney">
  65. <view style="width: 120upx;" class="label" >优惠券</view>
  66. <view class="value">¥{{order.couponMoney}}</view>
  67. </view>
  68. <view class="flex justify-between padding-top" v-if="order.addNum">
  69. <view style="width: 120upx;" class="label">加钟次数</view>
  70. <view class="value">{{order.addNum}}</view>
  71. </view>
  72. <view class="flex justify-between padding-top" v-if="order.addTime">
  73. <view style="width: 120upx;" class="label">加钟时长</view>
  74. <view class="value">{{order.addTime}}分钟</view>
  75. </view>
  76. <view class="flex justify-between padding-top" v-if="order.addMoney">
  77. <view style="width: 120upx;" class="label">加钟费用</view>
  78. <view class="value">¥{{order.addMoney}}</view>
  79. </view>
  80. </view>
  81. <!-- <view class="flex align-center " style="margin-top:35rpx">
  82. <image :src="order.artificer.artificerImg" style="width:100upx;height: 100upx;border-radius: 50%;"></image>
  83. <view class="margin-left-sm">
  84. <view class="flex align-center">
  85. <view class="text-bold text-df ">{{order.artificer.artificerName}}</view>
  86. <image src="../../static/img/phone.png" style="width: 10px;height: 13px;margin-left: 11px;"
  87. @click="bindphone(order.artificer.phone)"></image>
  88. </view>
  89. <view class="flex align-center flex-wrap">
  90. <view class="margin-right">
  91. <image src="../../static/images/start.png" style="width: 24rpx;height: 22rpx;"></image>
  92. <text style="color: #F93731;margin-left: 5rpx;">5.0</text>
  93. </view>
  94. <text class="margin-bottom-xs box" style="margin-right: 10upx;">健康理疗师</text>
  95. </view>
  96. </view>
  97. </view> -->
  98. <view class="bg">
  99. <view class="sub-title">
  100. 订单信息
  101. </view>
  102. <view class="margin-right-xs">
  103. <view class="flex justify-between margin-top-lg">
  104. <view style="width: 120upx;" class="label">订单编号</view>
  105. <view class="flex align-center" @tap="copy(order.ordersNo)">
  106. <view class="value">{{order.ordersNo}}</view>
  107. <u-icon name="file-text"></u-icon>
  108. </view>
  109. </view>
  110. <view class="flex justify-between margin-top-lg" style="color: red;">
  111. <view style="width: 120upx;" class="label">预约时间</view>
  112. <view class="value">{{order.serveTime}}</view>
  113. </view>
  114. <view class="flex justify-between margin-top-lg">
  115. <view style="width: 120upx;" class="label">下单时间</view>
  116. <view class="value">{{order.createTime}}</view>
  117. </view>
  118. <view class="flex justify-between margin-top-lg" v-if="order.startTime">
  119. <view style="width: 200rpx;" class="label">开始服务时间</view>
  120. <view class="value">{{order.startTime}}</view>
  121. </view>
  122. <view class="flex justify-between margin-top-lg" v-if="order.endTimes">
  123. <view style="width: 200rpx;" class="label">结束服务时间</view>
  124. <view class="value">{{order.endTimes}}</view>
  125. </view>
  126. <view class="flex justify-between margin-top-lg" v-if="order.endTime">
  127. <view style="width: 200rpx;" class="label">预估结束时间</view>
  128. <view class="value">{{order.endTime}}</view>
  129. </view>
  130. <view class="flex justify-between margin-top-lg" v-if="order.tripWay">
  131. <view style="width: 120upx;" class="label">出行方式</view>
  132. <view class="value" v-if="order.tripWay == 1">公交</view>
  133. <view class="value" v-if="order.tripWay == 2">出租</view>
  134. <view class="value" v-if="order.tripWay == 3">免费</view>
  135. </view>
  136. <view class="flex justify-between margin-top-lg" v-if="order.km">
  137. <view style="width: 120upx;" class="label">全程距离</view>
  138. <view class="value">{{order.km}}km</view>
  139. </view>
  140. <view class="flex justify-between margin-top-lg" v-if="order.artificerTaxiMoney">
  141. <view style="width: 120upx;" class="label">出行费用</view>
  142. <view class="value">¥{{order.artificerTaxiMoney}}</view>
  143. </view>
  144. <!-- <view class="flex justify-between margin-top-lg" v-if="order.pingMoney">
  145. <view style="width: 120upx;">平台费用</view>
  146. <view class="">¥{{order.pingMoney}}</view>
  147. </view> -->
  148. <!-- <view class="flex justify-between margin-top-lg" v-if="order.pingTaxiMoney">
  149. <view style="width: 240rpx;">平台扣除交通费用</view>
  150. <view class="">¥{{order.pingTaxiMoney}}</view>
  151. </view> -->
  152. <view class="flex justify-between margin-top-lg" v-if="sumMoney">
  153. <view style="width: 120upx;" class="label">项目费用</view>
  154. <view class="value">¥{{sumMoney}}</view>
  155. </view>
  156. <view class="flex justify-between margin-top-lg"
  157. v-if="order.status !=1 && order.status !=5 && order.status !=3 && order.status !=4">
  158. <view style="width: 170rpx;" class="label">联系客户</view>
  159. <view class="value" @click="bindphone(order.phone)">
  160. {{order.phone ? order.phone.substring(0,3) + '****' + order.phone.substring(7,11) : ''}}
  161. <image src="../../static/images/phone.png" style="width: 15px;height: 15px;"></image>
  162. </view>
  163. </view>
  164. <view class="flex justify-between margin-top-lg" v-if="order.remark">
  165. <view style="width: 170rpx;" class="label">备注内容</view>
  166. <view class="flex">
  167. <view class="value">
  168. {{order.remark}}
  169. </view>
  170. </view>
  171. </view>
  172. </view>
  173. <view class="flex justify-between margin-top-lg" style="padding-top: 30rpx;border-top: 1rpx solid #F0F0F0;">
  174. <view class="sub-title">预计收益</view>
  175. <view style="font-size: 28rpx;font-weight: bold;color: #F24E4E;">¥<text style="font-size: 40rpx;font-weight: bold;color: #F24E4E;">{{order.sumArtificerMoney}}</text>
  176. </view>
  177. </view>
  178. </view>
  179. </view>
  180. <view class="bg" v-if="order.startImg && startImgSel != '否'">
  181. <view class="sub-title">服务前照片</view>
  182. <view class="flex flex-wrap justify-between">
  183. <view class="flex margin-bottom-sm"
  184. style="width: 48%;height: 200rpx;margin-right: 5rpx;position: relative;"
  185. v-for="(image,index) in order.startImg" :key="index" @click="saveImg( order.startImg,index)">
  186. <image :src="image" style="width: 100%;height: 100%;border-radius: 10upx;" mode="aspectFill">
  187. </image>
  188. </view>
  189. </view>
  190. </view>
  191. <view class="bg" v-if="order.status==8 && startImgSel != '否'">
  192. <view class="text-lg text-bold margin-bottom">服务前照片</view>
  193. <view class="flex flex-wrap">
  194. <view v-if="startImgs.length">
  195. <view class="flex margin-right-sm flex-wrap">
  196. <view class="flex"
  197. style="width: 200rpx;height: 200rpx;margin-right: 5rpx;position: relative;"
  198. v-for="(image,index) in startImgs" :key="index">
  199. <image :src="image" style="width: 100%;height: 100%;"></image>
  200. <view style="z-index: 9;position: absolute;top: -15rpx;right: -15rpx;"
  201. @click="removeImg(index,1)">
  202. <u-icon name="close-circle-fill" color="#2979ff" size="50rpx"></u-icon>
  203. </view>
  204. </view>
  205. </view>
  206. </view>
  207. <view class="flex align-center justify-center padding-tb "
  208. style="background: #f5f5f5;width: 200rpx;height: 200rpx;">
  209. <view class="text-center" @click="addImage(1)">
  210. <image src="../static/photo.png" style="width:60upx;height: 50upx;"></image>
  211. <view class="text-sm">上传照片</view>
  212. </view>
  213. </view>
  214. </view>
  215. </view>
  216. <!-- <view class="bg padding radius margin-top-sm">
  217. <view class="text-lg text-bold">
  218. 服务信息
  219. </view>
  220. <view class="margin-right-xs">
  221. <view class="flex justify-between margin-top-lg">
  222. <view style="width: 170rpx;">服务时间</view>
  223. <view class="">
  224. <text>{{order.serveTime}}</text>
  225. </view>
  226. </view>
  227. <view class="flex justify-between margin-top-lg">
  228. <view style="width: 170rpx;">服务地点</view>
  229. <view class="flex" @tap="bindGps(order.latitude,order.longitude,order.address)">
  230. <view class="">
  231. {{order.address}}
  232. <image src="../../static/images/address.png" style="width: 13px;height: 15px;"></image>
  233. </view>
  234. </view>
  235. </view>
  236. <view class="flex justify-between margin-top-lg">
  237. <view style="width: 170rpx;">联系方式</view>
  238. <view class="" @click="bindphone(order.phone)">
  239. {{order.phone}}
  240. <image src="../../static/images/phone.png" style="width: 15px;height: 15px;"></image>
  241. </view>
  242. </view>
  243. <view class="flex justify-between margin-top-lg" v-if="order.remark">
  244. <view style="width: 170rpx;">备注内容</view>
  245. <view class="flex">
  246. <view class="">
  247. {{order.remark}}
  248. </view>
  249. </view>
  250. </view>
  251. </view>
  252. </view> -->
  253. <view class="flex tabber padding-top-sm padding-bottom-sm align-center">
  254. <u-button @click="cancelOrder(order)" shape="circle" class="margin-right" :custom-style="customStyle"
  255. :hair-line="false" v-if="order.status == 2">取消订单
  256. </u-button>
  257. <!-- 当订单状态为2 时 按钮为 现在出发 当状态为7时 按钮为 我已到达 然后状态为8 的时候 按钮就是现在的 开始服务 -->
  258. <u-button @click="cxOrder(order)" class="margin-right" shape="circle" :custom-style="customStyle2"
  259. :hair-line="false" v-if="order.status == 2">现在出发
  260. </u-button>
  261. <u-button @click="cxOrder(order)" class="margin-right" shape="circle" :custom-style="customStyle2"
  262. :hair-line="false" v-if="order.status == 7">我已到达
  263. </u-button>
  264. <u-button @click="fuwuOrder(order)" class="margin-right" shape="circle" :custom-style="customStyle2"
  265. :hair-line="false" v-if="order.status == 8">开始服务
  266. </u-button>
  267. <u-button @click="cancel(order)" class="margin-right" shape="circle" :custom-style="customStyle2"
  268. :hair-line="false" v-if="order.status == 6">服务完成
  269. </u-button>
  270. <u-button class="margin-right" :custom-style="customStyle2" shape="circle" :plain="true"
  271. @click="goChat">联系客服</u-button>
  272. </view>
  273. </view>
  274. <u-skeleton :loading="loading" :animation="true" bgColor="#FFF"></u-skeleton>
  275. <!-- #ifndef H5 -->
  276. <image src="../../static/images/index/jinji.png" class="bj_view" @tap="goBaoJing"></image>
  277. <!-- #endif -->
  278. <!-- 支付方式 -->
  279. <u-popup v-model="showpay" mode="bottom" :closeable="closeable">
  280. <view class="popup_pay">
  281. <view style="background-color: #fff;">
  282. <view style="padding: 0 20upx;margin-top: 60rpx;margin-bottom: 20rpx;">
  283. <view
  284. style="display: flex;height: 100upx;align-items: center;padding: 20upx 0;justify-content: center;"
  285. v-for="(item,index) in openLists" :key='index'>
  286. <image :src="item.image" style="width: 55upx;height: 55upx;border-radius: 50upx;">
  287. </image>
  288. <view style="font-size: 30upx;margin-left: 20upx;width: 70%;">
  289. {{item.text}}
  290. </view>
  291. <radio-group name="openWay" style="margin-left: 45upx;" @tap='selectWay(item)'>
  292. <label class="tui-radio">
  293. <radio color="#1777FF" :checked="openWay === item.id ? true : false" />
  294. </label>
  295. </radio-group>
  296. </view>
  297. </view>
  298. </view>
  299. <view class="pay_btn" @click="pay()">确认支付</view>
  300. </view>
  301. </u-popup>
  302. </view>
  303. </template>
  304. <script>
  305. import configdata from '../../common/config.js';
  306. export default {
  307. data() {
  308. return {
  309. startImgs: [],
  310. startImg: '',
  311. endImgs: [],
  312. endImg: '',
  313. latitude: '',
  314. longitude: '',
  315. loading: true,
  316. customStyle: {
  317. border: '2rpx solid #AAAAAA',
  318. background: '#FFFFFF',
  319. color: '#222222',
  320. margin: '0 20upx',
  321. width: '214rpx',
  322. height: '100rpx',
  323. lineHeight: '100rpx',
  324. borderRadius: '60rpx',
  325. fontWeight: 'bold',
  326. fontSize: '32rpx',
  327. },
  328. customStyle2: {
  329. backgroundColor: '#1EDA94',
  330. color: '#FFFFFF',
  331. margin: '0 20upx',
  332. width: '214rpx',
  333. height: '100rpx',
  334. lineHeight: '100rpx',
  335. borderRadius: '60rpx',
  336. fontWeight: 'bold',
  337. fontSize: '32rpx',
  338. },
  339. id: '',
  340. order: {
  341. user: {},
  342. game: {}
  343. },
  344. isTrue: 0,
  345. sumMoney: 0,
  346. phone: '',
  347. isVip: false,
  348. birthDate: '',
  349. age: '',
  350. showpay: false,
  351. openLists: [],
  352. openWay: 1,
  353. closeable: true,
  354. startImgSel: '否'
  355. }
  356. },
  357. onLoad(e) {
  358. this.startImgSel = this.$queue.getData('startImgSel');
  359. uni.showLoading({
  360. title: '加载中......'
  361. })
  362. let that = this;
  363. uni.getLocation({
  364. type: 'wgs84',
  365. success: function(res) {
  366. console.log('当前位置的经度:' + res.longitude);
  367. console.log('当前位置的纬度:' + res.latitude);
  368. that.$queue.setData('longitude', res.longitude);
  369. that.$queue.setData('latitude', res.latitude);
  370. that.latitude = res.latitude
  371. that.longitude = res.longitude
  372. }
  373. });
  374. // setTimeout(() => {
  375. // // this.loading = false;
  376. // }, 2000)
  377. this.isTrue = e.isTrue
  378. if (this.isTrue) {
  379. uni.setNavigationBarTitle({
  380. title: '订单详情'
  381. })
  382. }
  383. this.ordersId = e.ordersId
  384. // this.getOrder()
  385. },
  386. onShow() {
  387. let that = this;
  388. this.getOrder()
  389. this.token = uni.getStorageSync('token')
  390. if (uni.getStorageSync('token')) {
  391. this.getIsVip()
  392. }
  393. // #ifdef APP
  394. this.openLists = [{
  395. image: '../../static/images/icon_weixin.png',
  396. text: '微信',
  397. id: 2
  398. }, {
  399. image: '../../static/images/lingqian.png',
  400. text: '零钱支付',
  401. id: 1
  402. }, {
  403. image: '../../static/images/zhifubao.png',
  404. text: '支付宝支付',
  405. id: 3
  406. }],
  407. this.openWay = 1;
  408. // #endif
  409. // #ifdef MP-WEIXIN
  410. this.openLists = [{
  411. image: '../../static/images/icon_weixin.png',
  412. text: '微信',
  413. id: 2
  414. }, {
  415. image: '../../static/images/lingqian.png',
  416. text: '零钱支付',
  417. id: 1
  418. }],
  419. this.openWay = 1;
  420. // #endif
  421. // #ifdef H5
  422. this.openLists = [{
  423. image: '../../static/images/lingqian.png',
  424. text: '零钱支付',
  425. id: 1
  426. }, {
  427. image: '../../static/images/zhifubao.png',
  428. text: '支付宝支付',
  429. id: 3
  430. }],
  431. this.openWay = 1;
  432. // #endif
  433. },
  434. methods: {
  435. goBaoJing() {
  436. uni.navigateTo({
  437. url: '/pages/index/jinji'
  438. });
  439. },
  440. goChat() {
  441. let kefu = this.$queue.getData('kefu'); // 用户端联系方式 1 手机号 2企业微信
  442. let kefuPhone = this.$queue.getData('kefuPhone');
  443. if (uni.getStorageSync('token')) {
  444. if (kefu == 1) {
  445. uni.makePhoneCall({
  446. phoneNumber: kefuPhone //仅为示例
  447. });
  448. } else {
  449. // #ifdef MP-WEIXIN
  450. let that = this
  451. try {
  452. wx.openCustomerServiceChat({
  453. extInfo: {
  454. url: that.$queue.getData('kefuUrl')
  455. },
  456. corpId: that.$queue.getData('kefuAppId'),
  457. success(res) {},
  458. fail(res) {
  459. console.error(res)
  460. }
  461. })
  462. } catch (error) {
  463. console.error("catchcatch" + error)
  464. uni.showToast({
  465. title: '请更新至微信最新版本'
  466. });
  467. }
  468. // #endif
  469. // #ifndef MP-WEIXIN
  470. let url = this.$queue.getData('kefuUrl');
  471. if (url.indexOf('/pages/') !== -1 || url.indexOf('/my/') !== -1) {
  472. uni.navigateTo({
  473. url
  474. });
  475. } else {
  476. //#ifndef H5
  477. uni.navigateTo({
  478. url: '/pages/index/webView?url=' + url
  479. });
  480. //#endif
  481. //#ifdef H5
  482. window.location.href = url;
  483. //#endif
  484. }
  485. // #endif
  486. }
  487. } else {
  488. uni.showModal({
  489. title: '提示',
  490. content: '您还未登录,请先登录',
  491. success: function(res) {
  492. if (res.confirm) {
  493. console.log('用户点击确定');
  494. uni.navigateTo({
  495. url: '/pages/public/login'
  496. })
  497. } else if (res.cancel) {
  498. console.log('用户点击取消');
  499. }
  500. }
  501. })
  502. }
  503. },
  504. copy(num) {
  505. uni.setClipboardData({
  506. data: num,
  507. success: r => {
  508. this.$queue.showToast('复制成功');
  509. }
  510. });
  511. },
  512. //支付选择
  513. selectWay: function(item) {
  514. this.openWay = item.id;
  515. },
  516. //换算年龄
  517. getAge(e) {
  518. console.log('出生日期:' + e)
  519. this.birthDate = e
  520. //创建系统日期
  521. var today = new Date();
  522. //把出生日期转换成日期
  523. this.birthDate = new Date(this.birthDate);
  524. //分别获取到年份后相减
  525. this.age = today.getFullYear() - this.birthDate.getFullYear();
  526. // console.log(this.age+'当前年龄')
  527. },
  528. // 修改订单地址
  529. undateAdd(order) {
  530. if (order.state == 0) {
  531. uni.navigateTo({
  532. url: '../address/address?order=' + order.ordersId + '&id=' + 3
  533. })
  534. }
  535. },
  536. copyAddress() {
  537. uni.setClipboardData({
  538. data: this.order.userName + '\n' + this.order.phone + '\n' + this.order.address,
  539. success: r => {
  540. this.$queue.showToast('复制成功');
  541. }
  542. });
  543. },
  544. // 一键导航
  545. bindGps(latitude, longitude, name, detailsadd) {
  546. console.log(latitude, longitude, name, detailsadd)
  547. uni.openLocation({
  548. latitude: latitude - 0, //要去的纬度-地址
  549. longitude: longitude - 0, //要去的经度-地址
  550. name: name, //地址名称
  551. address: detailsadd, //详细地址名称
  552. success: function() {
  553. console.log('导航成功');
  554. },
  555. fail: function(error) {
  556. console.log(error)
  557. }
  558. });
  559. },
  560. // 拨打电话
  561. bindphone(phone) {
  562. let that = this
  563. uni.showModal({
  564. title: '提示',
  565. content: '是否拨打电话',
  566. confirmColor:"#1EDA94",
  567. success: function(res) {
  568. if (res.confirm) {
  569. console.log('用户点击确定', phone);
  570. uni.makePhoneCall({
  571. phoneNumber: phone //仅为示例
  572. });
  573. } else if (res.cancel) {
  574. console.log('用户点击取消');
  575. }
  576. }
  577. });
  578. },
  579. goNav(e) {
  580. uni.navigateTo({
  581. url: e
  582. })
  583. },
  584. ysPhone(phoneA, phoneB) {
  585. this.$Request.getT('/app/user/insertVirtualPhone?phoneA=' + phoneA + '&phoneB=' + phoneB).then(res => {
  586. if (res.code == 0) {
  587. this.order.phone = res.data;
  588. }
  589. });
  590. },
  591. getOrder() {
  592. let data = {
  593. ordersId: this.ordersId
  594. }
  595. this.$Request.get('/app/artificer/selectOrdersDetails', data).then(res => {
  596. if (res.code == 0) {
  597. this.loading = false
  598. uni.hideLoading()
  599. this.order = res.data
  600. if (this.order.artificerTaxiMoney && this.order.sumArtificerMoney) {
  601. this.sumMoney = parseFloat(parseFloat(this.order.sumArtificerMoney) - parseFloat(this
  602. .order.artificerTaxiMoney)).toFixed(2);
  603. } else {
  604. this.sumMoney = this.order.sumArtificerMoney;
  605. }
  606. if (this.order.startImg) {
  607. this.order.startImg = this.order.startImg.split(',')
  608. }
  609. if (this.order.endServiceImg) {
  610. this.order.endServiceImg = this.order.endServiceImg.split(',')
  611. }
  612. let aliphone = this.$queue.getData('aliphone');
  613. if (aliphone === '是' && this.order.artificer) {
  614. this.ysPhone(this.order.phone, this.order.artificer.phone);
  615. }
  616. }
  617. })
  618. },
  619. delOrder(e) {
  620. let that = this
  621. uni.showModal({
  622. title: '提示',
  623. content: '确定删除订单吗?',
  624. confirmColor:"#1EDA94",
  625. success: function(res) {
  626. if (res.confirm) {
  627. let data = {
  628. ordersId: e.ordersId,
  629. }
  630. that.$queue.showLoading('删除中...')
  631. that.$Request.post('/app/artificer/removeOrders', data).then(res => {
  632. uni.hideLoading();
  633. if (res.code == 0) {
  634. uni.showToast({
  635. name: "删除成功"
  636. })
  637. uni.navigateBack()
  638. } else {
  639. that.$queue.showToast(res.msg);
  640. }
  641. })
  642. } else if (res.cancel) {
  643. console.log('用户点击取消');
  644. }
  645. }
  646. });
  647. },
  648. getIsVip() {
  649. this.$Request.get("/app/UserVip/isUserVip").then(res => {
  650. if (res.code == 0) {
  651. this.isVip = res.data
  652. uni.setStorageSync('isVIP', res.data)
  653. }
  654. });
  655. },
  656. openpay() {
  657. this.showpay = true
  658. },
  659. // 支付订单
  660. pay() {
  661. let that = this
  662. if (that.openWay == 1) { //零钱支付
  663. uni.showModal({
  664. title: '付款提示',
  665. content: '确认支付' + that.order.payMoney + '元吗?',
  666. confirmColor:"#1EDA94",
  667. success: function(re) {
  668. if (re.confirm) {
  669. console.log('用户点击确定');
  670. that.$queue.showLoading('支付中...')
  671. that.$Request.post("/app/artificer/payOrders", {
  672. ordersId: that.order.ordersId,
  673. }).then(res => {
  674. uni.hideLoading();
  675. if (res.code == 0) {
  676. uni.showToast({
  677. title: '支付成功'
  678. })
  679. that.getOrder()
  680. } else {
  681. uni.showToast({
  682. title: res.msg,
  683. icon: 'none'
  684. })
  685. }
  686. });
  687. } else if (re.cancel) {
  688. console.log('用户点击取消');
  689. }
  690. }
  691. })
  692. } else if (that.openWay == 2) { //微信支付
  693. // #ifdef MP-WEIXIN
  694. let data = {
  695. orderId: that.order.ordersId,
  696. // type: 3
  697. }
  698. that.$Request.post('/app/wxPay/wxPayMpOrder', data).then(ret => {
  699. console.log(ret)
  700. if (ret.code == 0) {
  701. this.showpay = false
  702. uni.requestPayment({
  703. provider: 'wxpay',
  704. timeStamp: ret.data.timestamp,
  705. nonceStr: ret.data.noncestr,
  706. package: ret.data.package,
  707. signType: ret.data.signType,
  708. paySign: ret.data.sign,
  709. success: function(ret) {
  710. console.log(ret)
  711. uni.showToast({
  712. title: '支付成功',
  713. icon: 'none'
  714. })
  715. that.getOrder()
  716. // this.$queue.showToast('支付成功');
  717. // uni.switchTab({
  718. // url: '/pages/my/index'
  719. // })
  720. },
  721. fail: function(err) {
  722. // this.$queue.showToast('支付失败');
  723. uni.showToast({
  724. title: '支付失败',
  725. icon: 'nones'
  726. });
  727. that.getOrder()
  728. }
  729. });
  730. }
  731. });
  732. // #endif
  733. // #ifdef H5
  734. let data = {
  735. orderId: that.order.ordersId,
  736. // type: 2
  737. }
  738. that.$Request.post('/app/wxPay/wxPayJsApiOrder', data).then(rea => {
  739. that.showpay = false
  740. that.callPay(rea);
  741. });
  742. // #endif
  743. // #ifdef APP
  744. let data = {
  745. orderId: that.order.ordersId,
  746. // type: 1
  747. }
  748. that.$Request.post('/app/wxPay/payAppOrder', data).then(rea => {
  749. console.log(rea)
  750. that.showpay = false
  751. if (rea.code == 0) {
  752. that.isCheckPay(rea.code, 'wxpay', JSON.stringify(rea.data));
  753. }
  754. });
  755. // #endif
  756. } else if (that.openWay == 3) { //支付宝支付
  757. // #ifdef H5
  758. let data = {
  759. ordersId: that.order.ordersId,
  760. type: 2
  761. }
  762. that.$Request.post('/app/aliPay/payOrder', data).then(
  763. rea => {
  764. that.showpay = false
  765. const div = document.createElement('div')
  766. div.innerHTML = rea.data //此处form就是后台返回接收到的数据
  767. document.body.appendChild(div)
  768. document.forms[0].submit()
  769. });
  770. // #endif
  771. // #ifdef APP-PLUS
  772. let data = {
  773. ordersId: that.order.ordersId,
  774. type: 1
  775. }
  776. that.$Request.post('/app/aliPay/payOrder', data).then(
  777. rea => {
  778. that.showpay = false
  779. that.setPayment('alipay', rea.data);
  780. });
  781. // #endif
  782. }
  783. },
  784. callPay: function(response) {
  785. if (typeof WeixinJSBridge === "undefined") {
  786. if (document.addEventListener) {
  787. document.addEventListener('WeixinJSBridgeReady', this.onBridgeReady(response), false);
  788. } else if (document.attachEvent) {
  789. document.attachEvent('WeixinJSBridgeReady', this.onBridgeReady(response));
  790. document.attachEvent('onWeixinJSBridgeReady', this.onBridgeReady(response));
  791. }
  792. } else {
  793. this.onBridgeReady(response);
  794. }
  795. },
  796. onBridgeReady: function(response) {
  797. let that = this;
  798. if (!response.package) {
  799. return;
  800. }
  801. WeixinJSBridge.invoke(
  802. 'getBrandWCPayRequest', {
  803. "appId": response.appid, //公众号名称,由商户传入
  804. "timeStamp": response.timestamp, //时间戳,自1970年以来的秒数
  805. "nonceStr": response.noncestr, //随机串
  806. "package": response.package,
  807. "signType": response.signType, //微信签名方式:
  808. "paySign": response.sign //微信签名
  809. },
  810. function(res) {
  811. if (res.err_msg === "get_brand_wcpay_request:ok") {
  812. // 使用以上方式判断前端返回,微信团队郑重提示:
  813. //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
  814. uni.hideLoading();
  815. uni.showToast({
  816. title: '支付成功',
  817. icon: 'none'
  818. })
  819. that.getOrder()
  820. } else {
  821. uni.hideLoading();
  822. }
  823. WeixinJSBridge.log(response.err_msg);
  824. }
  825. );
  826. },
  827. isCheckPay(code, name, order) {
  828. if (code == 0) {
  829. this.setPayment(name, order);
  830. } else {
  831. uni.hideLoading();
  832. uni.showToast({
  833. title: '支付信息有误'
  834. });
  835. }
  836. },
  837. setPayment(name, order) {
  838. let that = this
  839. uni.requestPayment({
  840. provider: name,
  841. orderInfo: order, //微信、支付宝订单数据
  842. success: function(res) {
  843. uni.hideLoading();
  844. uni.showToast({
  845. title: '支付成功',
  846. icon: 'none'
  847. })
  848. that.getOrder()
  849. },
  850. fail: function(err) {
  851. uni.hideLoading();
  852. },
  853. complete() {
  854. uni.hideLoading();
  855. }
  856. });
  857. },
  858. cxOrder(e) {
  859. let contentName = '确认已经出发了吗?';
  860. if (e.status == 7) {
  861. contentName = '确认到达服务地点准备开始服务了吗?';
  862. }
  863. let that = this
  864. uni.showModal({
  865. title: '提示',
  866. content: contentName,
  867. confirmColor:"#1EDA94",
  868. success: function(res) {
  869. if (res.confirm) {
  870. let data = {
  871. ordersId: e.ordersId
  872. }
  873. that.$queue.showLoading('提交中...')
  874. that.$Request.post('/app/artificer/artificerStartOrEndTime', data).then(res => {
  875. uni.hideLoading();
  876. if (res.code == 0) {
  877. that.getOrder()
  878. } else {
  879. that.$queue.showToast(res.msg);
  880. }
  881. })
  882. } else if (res.cancel) {
  883. console.log('用户点击取消');
  884. }
  885. }
  886. });
  887. },
  888. fuwuOrder(e) {
  889. let startImg = '';
  890. if (this.startImgSel === '是') {
  891. if (this.startImgs.length == 0) {
  892. this.$queue.showToast('请上传开始服务图片!');
  893. return;
  894. }else{
  895. startImg = this.startImgs.toString();
  896. }
  897. }
  898. let that = this
  899. uni.showModal({
  900. title: '提示',
  901. content: '确认开始服务吗?',
  902. confirmColor:"#1EDA94",
  903. success: function(res) {
  904. if (res.confirm) {
  905. let data = {
  906. ordersId: e.ordersId,
  907. startLongitude: that.longitude,
  908. startLatitude: that.latitude,
  909. startImg: startImg
  910. }
  911. that.$queue.showLoading('提交中...')
  912. that.$Request.post('/app/artificer/startOrders', data).then(res => {
  913. uni.hideLoading();
  914. if (res.code == 0) {
  915. that.getOrder()
  916. } else {
  917. that.$queue.showToast(res.msg);
  918. }
  919. })
  920. } else if (res.cancel) {
  921. console.log('用户点击取消');
  922. }
  923. }
  924. });
  925. },
  926. // 取消订单
  927. cancelOrder(e) {
  928. let that = this
  929. uni.showModal({
  930. title: '提示',
  931. content: '确认取消订单吗?取消订单将会被扣除信用分!',
  932. confirmColor:"#1EDA94",
  933. success: function(res) {
  934. if (res.confirm) {
  935. let data = {
  936. ordersId: e.ordersId
  937. }
  938. that.$queue.showLoading('提交中...')
  939. that.$Request.post('/app/artificer/deleteOrders', data).then(res => {
  940. uni.hideLoading();
  941. if (res.code == 0) {
  942. that.getOrder()
  943. } else {
  944. that.$queue.showToast(res.msg);
  945. }
  946. })
  947. } else if (res.cancel) {
  948. console.log('用户点击取消');
  949. }
  950. }
  951. });
  952. },
  953. // 查看图片
  954. saveImg(imgs, index) {
  955. if (this.LBSelect) {
  956. if (index == this.LBIndex - 1) {
  957. return;
  958. }
  959. }
  960. // console.log(imgs)
  961. let that = this;
  962. let imgArr = imgs
  963. // imgArr.push(imgs);
  964. // //预览图片
  965. uni.previewImage({
  966. urls: imgArr,
  967. current: imgArr[index]
  968. });
  969. },
  970. removeImg(index, state) {
  971. if (state == 1) {
  972. this.startImgs.splice(index, 1)
  973. } else if (state == 2) {
  974. this.endImgs.splice(index, 1)
  975. }
  976. },
  977. // 图片上传
  978. addImage(e) {
  979. let that = this
  980. uni.chooseImage({
  981. count: 6,
  982. sourceType: ['album', 'camera'],
  983. success: res => {
  984. for (let i = 0; i < res.tempFilePaths.length; i++) {
  985. that.$queue.showLoading("上传中...");
  986. uni.uploadFile({ // 上传接口
  987. url: that.config("APIHOST1") + '/alioss/upload', //真实的接口地址
  988. filePath: res.tempFilePaths[i],
  989. name: 'file',
  990. success: (uploadFileRes) => {
  991. if (e == 1) {
  992. console.log(JSON.parse(uploadFileRes.data).data)
  993. that.startImgs.push(JSON.parse(uploadFileRes.data).data)
  994. } else if (e == 2) {
  995. that.endImgs.push(JSON.parse(uploadFileRes.data).data)
  996. }
  997. uni.hideLoading();
  998. }
  999. });
  1000. }
  1001. }
  1002. })
  1003. },
  1004. // 完成订单
  1005. cancel(e) {
  1006. let that = this
  1007. uni.showModal({
  1008. title: '提示',
  1009. content: '如果服务未完成点击完成订单会遭到平台违规处理,请确认服务是否完毕?',
  1010. confirmColor:"#1EDA94",
  1011. success: function(res) {
  1012. if (res.confirm) {
  1013. let data = {
  1014. ordersId: e.ordersId,
  1015. accomplishLongitude: that.longitude,
  1016. accomplishLatitude: that.latitude
  1017. }
  1018. that.$queue.showLoading('提交中...')
  1019. that.$Request.post('/app/artificer/accomplishOrders', data).then(res => {
  1020. uni.hideLoading();
  1021. if (res.code == 0) {
  1022. uni.navigateBack()
  1023. } else {
  1024. that.$queue.showToast(res.msg);
  1025. }
  1026. })
  1027. } else if (res.cancel) {
  1028. console.log('用户点击取消');
  1029. }
  1030. }
  1031. });
  1032. },
  1033. goMsg() {
  1034. let data = {
  1035. userId: uni.getStorageSync('userId'),
  1036. focusedUserId: this.order.user.userId
  1037. }
  1038. this.$Request.postJson('/app/chat/insertChatConversation ', data).then(res => {
  1039. if (res.code == 0) {
  1040. let id = this.order.user.userId == res.data.userId ? res.data.focusedUserId : this.order
  1041. .user.userId
  1042. uni.navigateTo({
  1043. url: '/pages/msg/im?chatConversationId=' + res.data.chatConversationId +
  1044. '&byUserId=' + id
  1045. })
  1046. }
  1047. })
  1048. },
  1049. config: function(name) {
  1050. var info = null;
  1051. if (name) {
  1052. var name2 = name.split("."); //字符分割
  1053. if (name2.length > 1) {
  1054. info = configdata[name2[0]][name2[1]] || null;
  1055. } else {
  1056. info = configdata[name] || null;
  1057. }
  1058. if (info == null) {
  1059. let web_config = cache.get("web_config");
  1060. if (web_config) {
  1061. if (name2.length > 1) {
  1062. info = web_config[name2[0]][name2[1]] || null;
  1063. } else {
  1064. info = web_config[name] || null;
  1065. }
  1066. }
  1067. }
  1068. }
  1069. return info;
  1070. },
  1071. }
  1072. }
  1073. </script>
  1074. <style lang="scss">
  1075. .older-detail {
  1076. background: #F5F6F6;
  1077. padding: 20rpx 32rpx;
  1078. .sub-title{
  1079. font-weight: bold;
  1080. font-size: 32rpx;
  1081. color: #222222;
  1082. margin-bottom: 20rpx;
  1083. }
  1084. .label{
  1085. font-size: 28rpx;
  1086. color: #AAAAAA;
  1087. }
  1088. .value{
  1089. font-size: 28rpx;
  1090. color: #222222;
  1091. }
  1092. }
  1093. .bj_view {
  1094. width: 100rpx;
  1095. height: 100rpx;
  1096. border-radius: 100rpx;
  1097. position: fixed;
  1098. right: 30rpx;
  1099. bottom: 180rpx;
  1100. }
  1101. .bg {
  1102. background: #FFFFFF;
  1103. border-radius: 32rpx 32rpx 32rpx 32rpx;
  1104. padding: 24rpx;
  1105. margin-top: 20rpx;
  1106. }
  1107. .tabber {
  1108. width: 100%;
  1109. background: #ffffff;
  1110. position: fixed;
  1111. bottom: 0;
  1112. left: 0;
  1113. right: 0;
  1114. justify-content: flex-end;
  1115. height: 127rpx;
  1116. padding-right: 30rpx;
  1117. box-shadow: 0rpx -6rpx 12rpx 2rpx rgba(0,0,0,0.09);
  1118. border-radius: 32rpx 32rpx 0rpx 0rpx;
  1119. }
  1120. .box {
  1121. /* border: 1px solid #005dff; */
  1122. background: #E8FAE1;
  1123. border-radius: 4rpx;
  1124. color: #2FB57A;
  1125. padding: 5upx 10upx;
  1126. font-size: 22rpx;
  1127. margin-top: 10rpx;
  1128. }
  1129. .popup_pay {
  1130. width: 100%;
  1131. position: relative;
  1132. padding-bottom: 45rpx;
  1133. /* height: 160px; */
  1134. /* #ifndef MP-WEIXIN */
  1135. /* height: 130px; */
  1136. /* #endif */
  1137. }
  1138. .pay_btn {
  1139. width: 90%;
  1140. margin: 0 auto;
  1141. text-align: center;
  1142. background: #2FB57A;
  1143. height: 80rpx;
  1144. border-radius: 16rpx;
  1145. color: #ffffff;
  1146. line-height: 80rpx;
  1147. }
  1148. </style>