index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810
  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 class="flex-row justify-between key">
  122. <view class="flex-row">
  123. <u-icon size="16" name="coupon"></u-icon>
  124. <text>优惠选择:</text>
  125. </view>
  126. <view class="flex-row value flex1 " style="height: 100%" @click="openCoupon(item,index)">
  127. <text v-if="item.suggestType == 0">选择优惠券或权益卡</text>
  128. <text v-if="item.suggestType == 1">{{ item.suggestCoupon.name }} </text>
  129. <text v-if="item.suggestType == 2">{{ item.suggestEquityCard.equityCardName }} </text>
  130. <view class="flex-col justify-center">
  131. <u-icon v-if="order.orderStatus != 1 || order.orderStatus != 3" size="12" name="arrow-right"></u-icon>
  132. </view>
  133. </view>
  134. </view>
  135. </view>
  136. </view>
  137. </view>
  138. <view class="bottomHeight"></view>
  139. <view class="bottom1 flex-col" v-if="order.canPay ">
  140. <text class="allMoney"></text>
  141. <view class="bottomBtn flex-row justify-between">
  142. <view class=" flex-row">
  143. <text class="unpaid">合计</text>
  144. <text class="preferentialPrice">¥{{order.payAmount}}</text>
  145. <!-- <text class="unpaid">已优惠</text>-->
  146. <!-- <text class="originalPrice">¥{{totalDiscount}}</text>-->
  147. <!-- <text class="priceDetail">价格明细</text>-->
  148. </view>
  149. <view class="btn" @click="qenPayInfo">
  150. <text class="text_33">一键付款</text>
  151. </view>
  152. <!-- <view v-else class="btn" @click="orderFinish">-->
  153. <!-- <text class="text_33">结束订单</text>-->
  154. <!-- </view>-->
  155. </view>
  156. </view>
  157. <uni-popup ref="appealPopup" :animation="false" :catchtouchmove="true">
  158. <view class="appealView flex-col justify-around">
  159. <view class="popupTitle">
  160. <text>请输入申诉理由</text>
  161. </view>
  162. <view class="lex-row justify-center">
  163. <textarea class="textarea" v-model="appealReason" placeholder="请输入申诉理由"></textarea>
  164. </view>
  165. <view class="flex-row justify-around">
  166. <view class="leftBtn" @click="appealPopupClose">
  167. <text>取消</text>
  168. </view>
  169. <view class="rightBtn" @click="commitAppeal">
  170. <text>确定</text>
  171. </view>
  172. </view>
  173. </view>
  174. </uni-popup>
  175. <uni-popup ref="popup" :catchtouchmove="true" :animation="false" type="bottom">
  176. <view class="payView">
  177. <view class="flex-row justify-between">
  178. <text class="payType">请选择支付方式</text>
  179. <image class="x" src="/static/common/ox.png" @click="closePayPopup"></image>
  180. </view>
  181. <!-- <view class="payTitle">-->
  182. <!-- <text>选择微信支付或余额支付</text>-->
  183. <!-- </view>-->
  184. <view v-if="loveCardList.length>0" class="payItem flex-row" >
  185. <u-icon name="/static/me/familyCard_icon.png" color="#38db38" size="36"></u-icon>
  186. <view class="payName flex-col justify-center flex-grow">
  187. <text>亲情卡支付</text>
  188. <scroll-view scroll-y class="loveCard" :show-scrollbar="true">
  189. <view class="flex-row justify-between loveCardItem " v-for="(item,index) in loveCardList" :key="index" @click="payLoveItem(0,index,item)">
  190. <view class="select flex-col" >
  191. <text>{{item.presentUserName}}({{item.relation}})</text>
  192. <!-- <text class="balance">本月剩余额度:{{item.totalBalance}}</text>-->
  193. </view>
  194. <view class="flex-col justify-center">
  195. <u-icon v-if="curServiceTab === 0 && item.select" name="checkmark-circle-fill" color="#38db38" size="25"></u-icon>
  196. <u-icon v-else name="/static/order/ud9.png" color="green" size="25"></u-icon>
  197. </view>
  198. </view>
  199. </scroll-view>
  200. </view>
  201. </view>
  202. <view class="payItem flex-row justify-between" @click="payItem(1)">
  203. <view class="flex-row">
  204. <u-icon name="/static/me/u701.png" color="#38db38" size="36"></u-icon>
  205. <view class="payName flex-col justify-center">
  206. <text>余额支付</text>
  207. <text class="balance">可用余额{{userInfo.balance || 0}}</text>
  208. </view>
  209. </view>
  210. <view class="flex-col justify-center">
  211. <view v-if="curServiceTab === 1" >
  212. <u-icon name="checkmark-circle-fill" color="#38db38" size="25"></u-icon>
  213. </view>
  214. <view v-else>
  215. <u-icon name="/static/order/ud9.png" color="green" size="25"></u-icon>
  216. </view>
  217. </view>
  218. </view>
  219. <view class="payItem flex-row justify-between" @click="payItem(2)">
  220. <view class="flex-row">
  221. <u-icon name="weixin-circle-fill" color="#38db38" size="36"></u-icon>
  222. <view class="payName flex-col justify-center">
  223. <text>微信支付</text>
  224. </view>
  225. </view>
  226. <view class="flex-col justify-center">
  227. <view v-if="curServiceTab === 2" >
  228. <u-icon name="checkmark-circle-fill" color="#38db38" size="25"></u-icon>
  229. </view>
  230. <view v-else>
  231. <u-icon name="/static/order/ud9.png" color="green" size="25"></u-icon>
  232. </view>
  233. </view>
  234. </view>
  235. <view class="commitBtn" @click="commonGeneralOrder">
  236. <text>确定</text>
  237. </view>
  238. </view>
  239. </uni-popup>
  240. <uni-popup ref="passwordPopup">
  241. <view class="passwordView flex-col">
  242. <view class="flex-row justify-center">
  243. <text>请输入交易密码</text>
  244. </view>
  245. <view class="h-tab-bar flex-row justify-center">
  246. <u-code-input v-model="password" mode="box" dot></u-code-input>
  247. </view>
  248. <view class="flex-row justify-center">
  249. <view class="h-operate-btn flex-row justify-center" @click="balancePay">
  250. <text>确定</text>
  251. </view>
  252. </view>
  253. </view>
  254. </uni-popup>
  255. <uni-popup ref="couponPopup" :catchtouchmove="true" :animation="false" type="bottom">
  256. <view class="couponView flex-col">
  257. <view class="flex-row justify-center">
  258. <text>优惠选择</text>
  259. </view>
  260. <scroll-view scroll-y style="height: 700rpx">
  261. <view class="flex-row justify-between coupon1">
  262. <view class="flex-row justify-start">
  263. <view class="flex-col justify-center icon1">
  264. <text>0</text>
  265. </view>
  266. <view class="flex-col justify-center couponMsg">
  267. <view class="flex-col justify-center couponName">
  268. <text>不选择优惠</text>
  269. </view>
  270. </view>
  271. </view>
  272. <view class="flex-col justify-center " style="margin-right: 30rpx">
  273. <text class="couponBtn" @click="use(item,0)">选择</text>
  274. </view>
  275. </view>
  276. <view class="flex-row justify-center" style="margin-top: 30rpx" v-if="availableCouponList.length > 0">
  277. <view class="flex-col justify-center flex1">
  278. <view class="couponLine"></view>
  279. </view>
  280. <text class="couponType">优惠券</text>
  281. <view class="flex-col justify-center flex1">
  282. <view class="couponLine"></view>
  283. </view>
  284. </view>
  285. <view class="flex-row justify-start" :class="[item.canUse? 'coupon2' : 'coupon3']" v-for="(item,index) in availableCouponList" :key="index">
  286. <view class="flex-row justify-start">
  287. <view class="flex-col justify-center " :class="[item.canUse? 'icon2' : 'icon3']">
  288. <text v-if="item.discountsType == 1">减{{item.discountsPrice}}</text>
  289. <text v-if="item.discountsType == 2">{{item.discount}}折</text>
  290. <text class="reachPrice">满{{item.reachPrice}}可用</text>
  291. </view>
  292. <view class="flex-col justify-center couponMsg">
  293. <view class="flex-col justify-center couponName">
  294. <text>{{item.name}}</text>
  295. </view>
  296. <view class="flex-col justify-center couponValue">
  297. <text>使用项目:{{item.useServiceDesc}}</text>
  298. </view>
  299. <view class="flex-col justify-center couponValue">
  300. <text>可用门店:{{item.useStoreDesc}}</text>
  301. </view>
  302. <view class="flex-col justify-center couponValue" v-if="!item.canUse">
  303. <text>不可用原因:{{item.unavailabilityReason}}</text>
  304. </view>
  305. </view>
  306. </view>
  307. <view class="flex-col justify-center" v-if="item.canUse">
  308. <text class="couponBtn" @click="use(item,1)">立即使用</text>
  309. </view>
  310. <view class="flex-col justify-center" v-else>
  311. <text class="couponBtn1">不可用</text>
  312. </view>
  313. </view>
  314. <view class="flex-row justify-center" style="margin-top: 30rpx" v-if="availableEquityCardList.length > 0">
  315. <view class="flex-col justify-center flex1">
  316. <view class="couponLine"></view>
  317. </view>
  318. <text class="couponType">权益卡</text>
  319. <view class="flex-col justify-center flex1">
  320. <view class="couponLine"></view>
  321. </view>
  322. </view>
  323. <view class="flex-row justify-start " :class="[item.canUse? 'coupon2' : 'coupon3']" v-for="(item,index) in availableEquityCardList" :key="index">
  324. <view class="flex-row justify-start">
  325. <view class="flex-col justify-center" :class="[item.canUse? 'icon2' : 'icon3']">
  326. <text>{{item.faceValue}}</text>
  327. </view>
  328. <view class="flex-col justify-center couponMsg">
  329. <view class="flex-col justify-center couponName">
  330. <text>{{item.equityCardName}}</text>
  331. </view>
  332. <view class="flex-col justify-center couponValue">
  333. <text>适用项目:{{item.serviceProjectName || ''}}</text>
  334. </view>
  335. <view class="flex-col justify-center couponValue">
  336. <text>适用门店:{{ item.useStoreDesc || '' }}</text>
  337. </view>
  338. <view class="flex-col justify-center couponValue">
  339. <text>绑定对象:{{item.serviceObjectName}}</text>
  340. </view>
  341. <view class="flex-col justify-center couponValue">
  342. <text>结束期限:{{item.effectiveEndTime.substring(0,10)}}</text>
  343. </view>
  344. <view class="flex-col justify-center couponValue" v-if="!item.canUse">
  345. <text>不可用原因:{{item.unavailabilityReason}}</text>
  346. </view>
  347. </view>
  348. </view>
  349. <view class="flex-col justify-center" v-if="item.canUse">
  350. <text class="couponBtn" @click="use(item,2)">立即使用</text>
  351. </view>
  352. <view class="flex-col justify-center" v-else>
  353. <text class="couponBtn1">不可用</text>
  354. </view>
  355. </view>
  356. </scroll-view>
  357. </view>
  358. </uni-popup>
  359. </view>
  360. </template>
  361. <script>
  362. import UniPopup from "../../uni_modules/uni-popup/components/uni-popup/uni-popup";
  363. export default {
  364. components: {
  365. UniPopup
  366. },
  367. data() {
  368. return {
  369. title: 'Hello',
  370. tabIndex: 3,
  371. order:{},
  372. allPrice:0,
  373. totalDiscount:0,
  374. appealId:'',
  375. appealReason:'',
  376. orderId:'',
  377. curServiceTab:2,
  378. userInfo:{},
  379. tradeNo:'',
  380. password:'',
  381. requestStatus : false,
  382. loveCardId:'',
  383. loveCardList:[],
  384. availableCouponList:[],
  385. availableEquityCardList:[],
  386. availableChild:null,
  387. availableIndex:null
  388. }
  389. },
  390. onLoad(e) {
  391. this.orderId = e.id
  392. this.getUserInfo();
  393. },
  394. onShow(){
  395. this.getOrderDetailByOrderId(this.orderId )
  396. this.getMyReceiveList()
  397. },
  398. methods: {
  399. use(item,suggestType){
  400. if (suggestType == 1){
  401. //使用优惠券
  402. this.availableChild.suggestEquityCard = null
  403. this.availableChild.suggestType = 1
  404. this.availableChild.suggestCoupon = item
  405. if (item.discountsType == 1){
  406. //满减优惠券
  407. this.availableChild.discountAmount = item.discountsPrice
  408. this.availableChild.payAmount = this.availableChild.servicePrice - item.discountsPrice
  409. }else {
  410. //折扣券
  411. this.availableChild.discountAmount = (this.availableChild.servicePrice * (item.discounts / 10).toFixed(2)).toFixed(2)
  412. this.availableChild.payAmount = this.availableChild.servicePrice - this.availableChild.discountAmount
  413. }
  414. }else if (suggestType == 2){
  415. //使用权益卡
  416. this.availableChild.suggestCoupon = null
  417. this.availableChild.suggestType = 2
  418. this.availableChild.suggestEquityCard = item
  419. this.availableChild.discountAmount = this.availableChild.servicePrice - item.faceValue
  420. this.availableChild.payAmount = item.faceValue
  421. }else {
  422. //不使用优惠
  423. this.availableChild.suggestType = 0
  424. this.availableChild.suggestCoupon = null
  425. this.availableChild.suggestEquityCard = null
  426. this.availableChild.discountAmount = 0
  427. this.availableChild.payAmount = this.availableChild.servicePrice
  428. }
  429. this.$set(this.order.child,this.availableIndex,this.availableChild)
  430. let payAmount = 0 //计算订单总支付金额
  431. let discountAmount = 0 //计算订单总优惠金额
  432. for (const child of this.order.child) {
  433. if (child.status == 1){
  434. payAmount += child.payAmount - 0
  435. discountAmount += child.discountAmount - 0
  436. }
  437. }
  438. this.order.payAmount = payAmount
  439. this.order.discountAmount = discountAmount
  440. this.availableChild = null
  441. this.availableIndex = null
  442. this.availableCouponList = []
  443. this.availableEquityCardList = []
  444. this.$refs.couponPopup.close()
  445. },
  446. openCoupon(item,index){
  447. if (this.order.orderStatus == 1 || this.order.orderStatus == 3){
  448. return
  449. }
  450. console.log(item)
  451. this.availableIndex = index
  452. this.availableChild = item
  453. this.availableCoupons(item)
  454. this.availableEquityCards(item)
  455. this.$refs.couponPopup.open()
  456. },
  457. availableEquityCards(item){
  458. this.$api.availableEquityCards({
  459. orderServiceId:item.orderServiceId
  460. }).then(res=>{
  461. this.availableEquityCardList = res.data.data
  462. })
  463. },
  464. availableCoupons(item){
  465. this.$api.availableCoupons({
  466. orderServiceId:item.orderServiceId
  467. }).then(res=>{
  468. this.availableCouponList = res.data.data
  469. })
  470. },
  471. getMyReceiveList(){
  472. this.$api.getMyReceiveList().then(res=>{
  473. this.loveCardList = res.data.data
  474. })
  475. },
  476. getUserInfo() {
  477. this.$api.getUserInfo().then(res => {
  478. this.userInfo = res.data.data
  479. uni.setStorageSync('userInfo', res.data.data);
  480. });
  481. },
  482. familyCardPay(){
  483. let that = this;
  484. this.$api.familyCardTradePay({
  485. tradeNo:this.tradeNo,
  486. loveCardId:this.loveCardId,
  487. storeId:this.order.storeId
  488. }).then(res=>{
  489. this.requestStatus=false
  490. uni.hideLoading();
  491. uni.showToast({
  492. title: '支付成功!'
  493. });
  494. that.getOrderDetailByOrderId(that.orderId)
  495. }).catch((err) =>{
  496. this.requestStatus=false
  497. uni.showToast({
  498. title: err.msg,
  499. icon:'error',
  500. duration:3000
  501. })
  502. });
  503. },
  504. balancePay(){
  505. let that = this;
  506. // if(this.password.length< 6 ){
  507. // uni.showToast({
  508. // title: "交易密码不能小于6位"
  509. // })
  510. // return ;
  511. // }
  512. // this.$refs.passwordPopup.close()
  513. this.$api.trade({
  514. tradeNo: this.tradeNo,
  515. password: ''
  516. }).then((res)=>{
  517. this.requestStatus=false
  518. uni.hideLoading();
  519. uni.showToast({
  520. title: '支付成功!'
  521. });
  522. that.getOrderDetailByOrderId(that.orderId)
  523. }).catch((err)=>{
  524. this.requestStatus=false
  525. uni.hideLoading();
  526. uni.showToast({
  527. title: err.msg,
  528. icon:'error'
  529. })
  530. })
  531. },
  532. scanCodeOrder(order){
  533. uni.scanCode({
  534. scanType: ['qrCode'],
  535. success: function (res) {
  536. let json = JSON.parse(res.result)
  537. if(json.storeId != order.storeId){
  538. uni.showToast({
  539. icon: 'error',
  540. duration: 3000,
  541. title: '请扫描订单门店二维码'
  542. });
  543. return
  544. }
  545. uni.navigateTo({
  546. url:'/orderPages/serviceItems/index?serviceStationId='+ json.stationId + '&orderId='+order.orderId + '&serviceObjectId=' + order.serviceObjectId
  547. })
  548. }
  549. })
  550. },
  551. commonGeneralOrder(){
  552. if(this.requestStatus){
  553. return;
  554. }
  555. this.requestStatus=true
  556. uni.showLoading({
  557. title: '支付中'
  558. });
  559. this.$refs.popup.close()
  560. let that =this
  561. if (this.curServiceTab===0){
  562. this.familyCardPay()
  563. }
  564. if (this.curServiceTab===1){
  565. // that.password = '';
  566. // this.$refs.popup.close()
  567. // this.$refs.passwordPopup.open()
  568. this.balancePay()
  569. }
  570. if (this.curServiceTab===2){
  571. this.$api.wechatPayTradeNo({tradeNo:this.tradeNo}).then(res=>{
  572. var param = res.data.data;
  573. uni.requestPayment({
  574. appId: param.appid,
  575. timeStamp: param.timestamp+"",
  576. nonceStr: param.noncestr,
  577. package: "prepay_id="+param.prepayid,
  578. signType: "RSA",
  579. paySign: param.sign,
  580. success: res => {
  581. this.requestStatus=false
  582. uni.hideLoading();
  583. uni.showToast({
  584. title: '支付成功!'
  585. });
  586. that.getOrderDetailByOrderId(that.orderId)
  587. },
  588. fail: res => {
  589. this.requestStatus=false
  590. uni.hideLoading();
  591. uni.showModal({
  592. content: '支付失败',
  593. showCancel: false
  594. });
  595. }
  596. });
  597. })
  598. }
  599. },
  600. orderFinish(){
  601. this.$api.orderFinish(this.order.orderNo).then((res)=>{
  602. uni.$u.toast('操作成功')
  603. this.getOrderDetailByOrderId(this.order.orderId)
  604. })
  605. },
  606. qenPayInfo(){
  607. let childArr = []
  608. for (const child of this.order.child) {
  609. console.log('+++++++++++++++++++++',child)
  610. let c = {
  611. orderServiceId:child.orderServiceId,
  612. couponId: child.suggestCoupon ? child.suggestCoupon.id : null,
  613. equityCardId: child.suggestEquityCard ? child.suggestEquityCard.id : null,
  614. }
  615. childArr.push(c)
  616. }
  617. this.$api.oneClickPayV2({
  618. orderId:this.order.orderId,
  619. serviceChildren:childArr
  620. }).then(res=>{
  621. this.tradeNo = res.data.data.tradeNo
  622. this.$refs.popup.open()
  623. })
  624. },
  625. commitAppeal(){
  626. this.$api.appeal({
  627. childOrderId:this.appealId,
  628. appealReason:this.appealReason
  629. }).then(res=>{
  630. this.appealReason=''
  631. uni.$u.toast('申诉已提交')
  632. this.$refs.appealPopup.close()
  633. this.getOrderDetailByOrderId(this.orderId)
  634. })
  635. },
  636. appealPopupClose(){
  637. this.appealReason=''
  638. this.$refs.appealPopup.close()
  639. },
  640. appeal(id){
  641. this.appealId = id
  642. this.$refs.appealPopup.open()
  643. },
  644. // 原来的计算价格逻辑 选择的时候计算
  645. // tick(item,index){
  646. //
  647. // if (item.status === 1 || item.status === 4){
  648. // this.allPrice = 0
  649. // this.totalDiscount = 0;
  650. // item.tick = !item.tick
  651. // this.$set(this.order.child,index,item)
  652. // this.order.child.forEach(i=>{
  653. // if (i.tick){
  654. // this.totalDiscount += i.discountAmount * 1;
  655. // this.allPrice += i.payAmount *1;
  656. // }
  657. // })
  658. // this.allPrice = this.allPrice.toFixed(2)
  659. // this.totalDiscount = this.totalDiscount.toFixed(2)
  660. // }
  661. // },
  662. //新的价格计算逻辑 订单加载或刷新的时候计算
  663. calculatePrice(){
  664. this.allPrice = 0
  665. this.totalDiscount = 0;
  666. this.order.child.forEach(i=>{
  667. if (i.status !=5){ //不在申诉的子订单
  668. this.totalDiscount += i.discountAmount * 1;
  669. this.allPrice += i.payAmount *1;
  670. }
  671. })
  672. this.allPrice = this.allPrice.toFixed(2)
  673. this.totalDiscount = this.totalDiscount.toFixed(2)
  674. },
  675. getOrderDetailByOrderId(id){
  676. this.$api.getOrderDetailByOrderId({
  677. id:id
  678. }).then(res=>{
  679. for (const child of res.data.data.child) {
  680. if (child.suggestCoupon){
  681. child.suggestType = 1
  682. }else if (child.suggestEquityCard){
  683. child.suggestType = 2
  684. }else {
  685. child.suggestType = 0
  686. }
  687. }
  688. this.order= res.data.data
  689. // this.calculatePrice()
  690. })
  691. },
  692. payLoveItem(num,index,loveCard){
  693. // if (loveCard.totalBalance*1 < this.order.payAmount*1 && num == 0){
  694. // uni.$u.toast('余额不足')
  695. // return
  696. // }
  697. this.curServiceTab = num
  698. this.loveCardList.forEach(item=>{
  699. item.select = false
  700. })
  701. loveCard.select=true
  702. this.loveCardId = loveCard.id
  703. this.$set(this.loveCardList,index,loveCard)
  704. },
  705. payItem(num){
  706. if (this.userInfo.balance*1 < this.order.payAmount*1 && num == 1){
  707. uni.$u.toast('余额不足')
  708. return
  709. }
  710. this.curServiceTab = num
  711. },
  712. closePayPopup(){
  713. this.$refs.popup.close()
  714. },
  715. }
  716. }
  717. </script>
  718. <style>
  719. @import '/common/css/common.css';
  720. @import './index.rpx.scss';
  721. </style>