index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. <template>
  2. <view class="page" >
  3. <view class="state ">
  4. <view class="flex-row justify-center">
  5. <u-icon name="cut" color="#93D21A" size="18"></u-icon>
  6. <text>{{order.orderStatusDesc}}</text>
  7. </view>
  8. <view class="box_4 flex-row justify-center">
  9. <text>{{order.orderDesc}}</text>
  10. </view>
  11. </view>
  12. <view class="detail">
  13. <view :class="order.serviceAttribute == 1? 'serviceAttrDesc':'serviceAttrDesc1'">
  14. <text>{{order.serviceAttrDesc}}</text>
  15. </view>
  16. <view class="flex-row justify-start">
  17. <u-icon name="/static/index/u217.png" color="#93D21A" size="18"></u-icon>
  18. <text class="key">订单编号:</text>
  19. <text class="value">{{order.orderNo}}</text>
  20. </view>
  21. <!-- <view>-->
  22. <!-- <text class="serviceType">{{order.serviceType}}</text>-->
  23. <!-- </view>-->
  24. <view class="flex-row justify-between jishi">
  25. <view class="flex-col ">
  26. <view class=" flex-row">
  27. <u-icon name="/static/order/ud1.png" color="#93D21A" size="18"></u-icon>
  28. <text class="key">服务对象:</text>
  29. <text class="value">{{order.serviceObjectName || ''}}</text>
  30. </view>
  31. <view class="flex-row">
  32. <u-icon name="/static/order/ud2.png" color="#93D21A" size="18"></u-icon>
  33. <text class="key">服务门店:</text>
  34. <text class="value">{{order.storeName}}</text>
  35. </view>
  36. <view class="flex-row">
  37. <u-icon name="clock" size="16"></u-icon>
  38. <text class="key">下单时间:</text>
  39. <text class="value">{{order.createTime}}</text>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="flex-row justify-between yuyue " v-if="order.serviceAttribute == 2">
  44. <view class="flex-col justify-center ">
  45. <view class=" flex-row">
  46. <u-icon name="clock" size="16"></u-icon>
  47. <text class="key">服务日期:</text>
  48. <text class="value">{{order.serviceDate}}</text>
  49. </view>
  50. <view class="flex-row">
  51. <u-icon name="/static/order/ud2.png" color="#93D21A" size="18"></u-icon>
  52. <text class="key">服务时段:</text>
  53. <text class="value">{{order.serviceStartTime}}</text>
  54. </view>
  55. <view class="flex-row">
  56. <u-icon name="/static/order/ud3.png" color="#93D21A" size="18"></u-icon>
  57. <text class="key">服务人员:</text>
  58. <text class="value">{{order.servicePersonName}}</text>
  59. </view>
  60. </view>
  61. </view>
  62. <view class="flex-row justify-center" v-if="order.canScanCode">
  63. <view class="scan flex-row justify-center" @click="scanCodeOrder(order)">
  64. <u-icon name="scan" size="18"></u-icon>
  65. <text>扫码</text>
  66. </view>
  67. </view>
  68. <view class="line"></view>
  69. <view class="flex-row justify-between borderBottom" v-for="(item,index) in order.child" :key="index">
  70. <!-- <view class="flex-col justify-center" v-if="order.orderStatus != 3">-->
  71. <!-- <u-icon v-if="item.tick" name="checkmark-circle-fill" color="#38db38" size="20" @click="tick(item,index)"></u-icon>-->
  72. <!-- <u-icon v-else name="/static/order/ud9.png" color="green" size="20" @click="tick(item,index)"></u-icon>-->
  73. <!-- </view>-->
  74. <view class="flex-col right">
  75. <view class="flex-row justify-between">
  76. <text class="serviceType">{{item.serviceName}}</text>
  77. <text class="projectState">{{item.statusDesc}}</text>
  78. </view>
  79. <view class="flex-row justify-between">
  80. <view class="flex-col justify-around">
  81. <view class="flex-row">
  82. <u-icon name="server-man" size="16"></u-icon>
  83. <text class="key">服务人员:</text>
  84. <text class="value">{{item.servicePerson || ''}}</text>
  85. </view>
  86. <view class="flex-row">
  87. <u-icon name="clock" size="16"></u-icon>
  88. <text class="key">服务时间:</text>
  89. <text class="value">{{item.serviceTime || ''}}</text>
  90. </view>
  91. <view class="flex-row" v-if="item.discountAmount > 0">
  92. <u-icon name="red-packet" size="16"></u-icon>
  93. <text class="key">服务金额:</text>
  94. <text class="projectMoney">¥{{item.payAmount}}</text>
  95. <text class="lineMoney">¥{{item.servicePrice}}</text>
  96. </view>
  97. <view class="flex-row" v-else>
  98. <u-icon name="red-packet" size="16"></u-icon>
  99. <text class="key">服务金额:</text>
  100. <text class="projectMoney">¥{{item.servicePrice}}</text>
  101. </view>
  102. </view>
  103. <view class="flex-col justify-around">
  104. <view class="flex-col justify-center " v-if="item.planNumber">
  105. <view class="planNumber flex-row justify-center">
  106. <text>{{item.planNumber}}</text>
  107. </view>
  108. <view class="plan flex-row justify-center">
  109. <text class="plan">排号</text>
  110. </view>
  111. <!-- <view class="plan flex-row justify-center" v-if="order.serviceAttribute == 2">-->
  112. <!-- <text class="plan">预约号</text>-->
  113. <!-- </view>-->
  114. </view>
  115. <view class="flex-row justify-center" v-if="item.status === 8 || item.status === 1" @click="appeal(item.orderServiceId)">
  116. <u-icon name="/static/order/ud17.png" color="#93D21A" size="14"></u-icon>
  117. <text class="ss_key">申诉</text>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. <view class="bottomHeight"></view>
  125. <view class="bottom1 flex-col" v-if="order.canPay ">
  126. <text class="allMoney"></text>
  127. <view class="bottomBtn flex-row justify-between">
  128. <view class=" flex-row">
  129. <text class="unpaid">合计</text>
  130. <text class="preferentialPrice">¥{{order.payAmount}}</text>
  131. <!-- <text class="unpaid">已优惠</text>-->
  132. <!-- <text class="originalPrice">¥{{totalDiscount}}</text>-->
  133. <!-- <text class="priceDetail">价格明细</text>-->
  134. </view>
  135. <view class="btn" @click="qenPayInfo">
  136. <text class="text_33">一键付款</text>
  137. </view>
  138. <!-- <view v-else class="btn" @click="orderFinish">-->
  139. <!-- <text class="text_33">结束订单</text>-->
  140. <!-- </view>-->
  141. </view>
  142. </view>
  143. <uni-popup ref="appealPopup" :animation="false" :catchtouchmove="true">
  144. <view class="appealView flex-col justify-around">
  145. <view class="popupTitle">
  146. <text>请输入申诉理由</text>
  147. </view>
  148. <view class="lex-row justify-center">
  149. <textarea class="textarea" v-model="appealReason" placeholder="请输入申诉理由"></textarea>
  150. </view>
  151. <view class="flex-row justify-around">
  152. <view class="leftBtn" @click="appealPopupClose">
  153. <text>取消</text>
  154. </view>
  155. <view class="rightBtn" @click="commitAppeal">
  156. <text>确定</text>
  157. </view>
  158. </view>
  159. </view>
  160. </uni-popup>
  161. <uni-popup ref="popup" :catchtouchmove="true" :animation="false" type="bottom">
  162. <view class="payView">
  163. <view class="flex-row justify-between">
  164. <text class="payType">请选择支付方式</text>
  165. <image class="x" src="/static/common/ox.png" @click="closePayPopup"></image>
  166. </view>
  167. <!-- <view class="payTitle">-->
  168. <!-- <text>选择微信支付或余额支付</text>-->
  169. <!-- </view>-->
  170. <view v-if="loveCardList.length>0" class="payItem flex-row" >
  171. <u-icon name="/static/me/familyCard_icon.png" color="#38db38" size="36"></u-icon>
  172. <view class="payName flex-col justify-center flex-grow">
  173. <text>亲情卡支付</text>
  174. <scroll-view scroll-y class="loveCard" :show-scrollbar="true">
  175. <view class="flex-row justify-between loveCardItem " v-for="(item,index) in loveCardList" :key="index" @click="payLoveItem(0,index,item)">
  176. <view class="select flex-col" >
  177. <text>{{item.presentUserName}}({{item.relation}})</text>
  178. <!-- <text class="balance">本月剩余额度:{{item.totalBalance}}</text>-->
  179. </view>
  180. <view class="flex-col justify-center">
  181. <u-icon v-if="curServiceTab === 0 && item.select" name="checkmark-circle-fill" color="#38db38" size="25"></u-icon>
  182. <u-icon v-else name="/static/order/ud9.png" color="green" size="25"></u-icon>
  183. </view>
  184. </view>
  185. </scroll-view>
  186. </view>
  187. </view>
  188. <view class="payItem flex-row justify-between" @click="payItem(1)">
  189. <view class="flex-row">
  190. <u-icon name="/static/me/u701.png" color="#38db38" size="36"></u-icon>
  191. <view class="payName flex-col justify-center">
  192. <text>余额支付</text>
  193. <text class="balance">可用余额{{userInfo.balance || 0}}</text>
  194. </view>
  195. </view>
  196. <view class="flex-col justify-center">
  197. <view v-if="curServiceTab === 1" >
  198. <u-icon name="checkmark-circle-fill" color="#38db38" size="25"></u-icon>
  199. </view>
  200. <view v-else>
  201. <u-icon name="/static/order/ud9.png" color="green" size="25"></u-icon>
  202. </view>
  203. </view>
  204. </view>
  205. <view class="payItem flex-row justify-between" @click="payItem(2)">
  206. <view class="flex-row">
  207. <u-icon name="weixin-circle-fill" color="#38db38" size="36"></u-icon>
  208. <view class="payName flex-col justify-center">
  209. <text>微信支付</text>
  210. </view>
  211. </view>
  212. <view class="flex-col justify-center">
  213. <view v-if="curServiceTab === 2" >
  214. <u-icon name="checkmark-circle-fill" color="#38db38" size="25"></u-icon>
  215. </view>
  216. <view v-else>
  217. <u-icon name="/static/order/ud9.png" color="green" size="25"></u-icon>
  218. </view>
  219. </view>
  220. </view>
  221. <view class="commitBtn" @click="commonGeneralOrder">
  222. <text>确定</text>
  223. </view>
  224. </view>
  225. </uni-popup>
  226. <uni-popup ref="passwordPopup">
  227. <view class="passwordView flex-col">
  228. <view class="flex-row justify-center">
  229. <text>请输入交易密码</text>
  230. </view>
  231. <view class="h-tab-bar flex-row justify-center">
  232. <u-code-input v-model="password" mode="box" dot></u-code-input>
  233. </view>
  234. <view class="flex-row justify-center">
  235. <view class="h-operate-btn flex-row justify-center" @click="balancePay">
  236. <text>确定</text>
  237. </view>
  238. </view>
  239. </view>
  240. </uni-popup>
  241. </view>
  242. </template>
  243. <script>
  244. import UniPopup from "../../uni_modules/uni-popup/components/uni-popup/uni-popup";
  245. export default {
  246. components: {
  247. UniPopup
  248. },
  249. data() {
  250. return {
  251. title: 'Hello',
  252. tabIndex: 3,
  253. order:{},
  254. allPrice:0,
  255. totalDiscount:0,
  256. appealId:'',
  257. appealReason:'',
  258. orderId:'',
  259. curServiceTab:2,
  260. userInfo:{},
  261. tradeNo:'',
  262. password:'',
  263. requestStatus : false,
  264. loveCardId:'',
  265. loveCardList:[],
  266. }
  267. },
  268. onLoad(e) {
  269. this.orderId = e.id
  270. this.getUserInfo();
  271. },
  272. onShow(){
  273. this.getOrderDetailByOrderId(this.orderId )
  274. this.getMyReceiveList()
  275. },
  276. methods: {
  277. getMyReceiveList(){
  278. this.$api.getMyReceiveList().then(res=>{
  279. this.loveCardList = res.data.data
  280. })
  281. },
  282. getUserInfo() {
  283. this.$api.getUserInfo().then(res => {
  284. this.userInfo = res.data.data
  285. uni.setStorageSync('userInfo', res.data.data);
  286. });
  287. },
  288. familyCardPay(){
  289. let that = this;
  290. this.$api.familyCardTradePay({
  291. tradeNo:this.tradeNo,
  292. loveCardId:this.loveCardId,
  293. storeId:this.order.storeId
  294. }).then(res=>{
  295. this.requestStatus=false
  296. uni.hideLoading();
  297. uni.showToast({
  298. title: '支付成功!'
  299. });
  300. that.getOrderDetailByOrderId(that.orderId)
  301. }).catch((err) =>{
  302. this.requestStatus=false
  303. uni.showToast({
  304. title: err.msg,
  305. icon:'error',
  306. duration:3000
  307. })
  308. });
  309. },
  310. balancePay(){
  311. let that = this;
  312. // if(this.password.length< 6 ){
  313. // uni.showToast({
  314. // title: "交易密码不能小于6位"
  315. // })
  316. // return ;
  317. // }
  318. // this.$refs.passwordPopup.close()
  319. this.$api.trade({
  320. tradeNo: this.tradeNo,
  321. password: ''
  322. }).then((res)=>{
  323. this.requestStatus=false
  324. uni.hideLoading();
  325. uni.showToast({
  326. title: '支付成功!'
  327. });
  328. that.getOrderDetailByOrderId(that.orderId)
  329. }).catch((err)=>{
  330. this.requestStatus=false
  331. uni.hideLoading();
  332. uni.showToast({
  333. title: err.msg,
  334. icon:'error'
  335. })
  336. })
  337. },
  338. scanCodeOrder(order){
  339. uni.scanCode({
  340. scanType: ['qrCode'],
  341. success: function (res) {
  342. let json = JSON.parse(res.result)
  343. if(json.storeId != order.storeId){
  344. uni.showToast({
  345. icon: 'error',
  346. duration: 3000,
  347. title: '请扫描订单门店二维码'
  348. });
  349. return
  350. }
  351. uni.navigateTo({
  352. url:'/orderPages/serviceItems/index?serviceStationId='+ json.stationId + '&orderId='+order.orderId + '&serviceObjectId=' + order.serviceObjectId
  353. })
  354. }
  355. })
  356. },
  357. commonGeneralOrder(){
  358. if(this.requestStatus){
  359. return;
  360. }
  361. this.requestStatus=true
  362. uni.showLoading({
  363. title: '支付中'
  364. });
  365. this.$refs.popup.close()
  366. let that =this
  367. if (this.curServiceTab===0){
  368. this.familyCardPay()
  369. }
  370. if (this.curServiceTab===1){
  371. // that.password = '';
  372. // this.$refs.popup.close()
  373. // this.$refs.passwordPopup.open()
  374. this.balancePay()
  375. }
  376. if (this.curServiceTab===2){
  377. this.$api.wechatPayTradeNo({tradeNo:this.tradeNo}).then(res=>{
  378. var param = res.data.data;
  379. uni.requestPayment({
  380. appId: param.appid,
  381. timeStamp: param.timestamp+"",
  382. nonceStr: param.noncestr,
  383. package: "prepay_id="+param.prepayid,
  384. signType: "RSA",
  385. paySign: param.sign,
  386. success: res => {
  387. this.requestStatus=false
  388. uni.hideLoading();
  389. uni.showToast({
  390. title: '支付成功!'
  391. });
  392. that.getOrderDetailByOrderId(that.orderId)
  393. },
  394. fail: res => {
  395. this.requestStatus=false
  396. uni.hideLoading();
  397. uni.showModal({
  398. content: '支付失败',
  399. showCancel: false
  400. });
  401. }
  402. });
  403. })
  404. }
  405. },
  406. orderFinish(){
  407. this.$api.orderFinish(this.order.orderNo).then((res)=>{
  408. uni.$u.toast('操作成功')
  409. this.getOrderDetailByOrderId(this.order.orderId)
  410. })
  411. },
  412. qenPayInfo(){
  413. //
  414. // for(let i=0;i<this.order.child.length;i++){
  415. // if (this.order.child[i].status==3){
  416. // uni.$u.toast('子订单未审核结束')
  417. // return
  418. // }
  419. // }
  420. // let orderServiceIds = []
  421. // this.order.child.forEach(i=>{
  422. // if (i.status !=5){ //排除审核通过的子订单
  423. // orderServiceIds.push(i.orderServiceId)
  424. // }
  425. // })
  426. this.$api.oneClickPay({
  427. orderId:this.order.orderId
  428. }).then(res=>{
  429. this.tradeNo = res.data.data.tradeNo
  430. this.$refs.popup.open()
  431. })
  432. // this.$api.qenPayInfo({
  433. // orderServiceIds:orderServiceIds,
  434. // orderNo:this.order.orderNo
  435. // }).then(res=>{
  436. // this.tradeNo=res.data.data.tradeNo
  437. // this.$refs.popup.open()
  438. // })
  439. },
  440. commitAppeal(){
  441. this.$api.appeal({
  442. childOrderId:this.appealId,
  443. appealReason:this.appealReason
  444. }).then(res=>{
  445. this.appealReason=''
  446. uni.$u.toast('申诉已提交')
  447. this.$refs.appealPopup.close()
  448. this.getOrderDetailByOrderId(this.orderId)
  449. })
  450. },
  451. appealPopupClose(){
  452. this.appealReason=''
  453. this.$refs.appealPopup.close()
  454. },
  455. appeal(id){
  456. this.appealId = id
  457. this.$refs.appealPopup.open()
  458. },
  459. // 原来的计算价格逻辑 选择的时候计算
  460. // tick(item,index){
  461. //
  462. // if (item.status === 1 || item.status === 4){
  463. // this.allPrice = 0
  464. // this.totalDiscount = 0;
  465. // item.tick = !item.tick
  466. // this.$set(this.order.child,index,item)
  467. // this.order.child.forEach(i=>{
  468. // if (i.tick){
  469. // this.totalDiscount += i.discountAmount * 1;
  470. // this.allPrice += i.payAmount *1;
  471. // }
  472. // })
  473. // this.allPrice = this.allPrice.toFixed(2)
  474. // this.totalDiscount = this.totalDiscount.toFixed(2)
  475. // }
  476. // },
  477. //新的价格计算逻辑 订单加载或刷新的时候计算
  478. calculatePrice(){
  479. this.allPrice = 0
  480. this.totalDiscount = 0;
  481. this.order.child.forEach(i=>{
  482. if (i.status !=5){ //不在申诉的子订单
  483. this.totalDiscount += i.discountAmount * 1;
  484. this.allPrice += i.payAmount *1;
  485. }
  486. })
  487. this.allPrice = this.allPrice.toFixed(2)
  488. this.totalDiscount = this.totalDiscount.toFixed(2)
  489. },
  490. getOrderDetailByOrderId(id){
  491. this.$api.getOrderDetailByOrderId({
  492. id:id
  493. }).then(res=>{
  494. this.order= res.data.data
  495. // this.calculatePrice()
  496. })
  497. },
  498. payLoveItem(num,index,loveCard){
  499. // if (loveCard.totalBalance*1 < this.order.payAmount*1 && num == 0){
  500. // uni.$u.toast('余额不足')
  501. // return
  502. // }
  503. this.curServiceTab = num
  504. this.loveCardList.forEach(item=>{
  505. item.select = false
  506. })
  507. loveCard.select=true
  508. this.loveCardId = loveCard.id
  509. this.$set(this.loveCardList,index,loveCard)
  510. },
  511. payItem(num){
  512. if (this.userInfo.balance*1 < this.order.payAmount*1 && num == 1){
  513. uni.$u.toast('余额不足')
  514. return
  515. }
  516. this.curServiceTab = num
  517. },
  518. closePayPopup(){
  519. this.$refs.popup.close()
  520. },
  521. }
  522. }
  523. </script>
  524. <style>
  525. @import '/common/css/common.css';
  526. @import './index.rpx.scss';
  527. </style>