pay.vue 37 KB

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