index.vue 30 KB

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