index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  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">
  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 class="flex-col">
  43. <view class="planNumber flex-row justify-center">
  44. <text>{{order.planNumber}}</text>
  45. </view>
  46. <view class="plan flex-row justify-center">
  47. <text class="plan">排号</text>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="flex-row justify-center">
  52. <view class="scan flex-row justify-center" @click="scanCodeOrder(order)">
  53. <u-icon name="scan" size="18"></u-icon>
  54. <text>扫码</text>
  55. </view>
  56. </view>
  57. <view class="line"></view>
  58. <view class="flex-row justify-between borderBottom" v-for="(item,index) in order.child" :key="index">
  59. <view class="flex-col justify-center">
  60. <u-icon v-if="item.tick" name="checkmark-circle-fill" color="#38db38" size="20" @click="tick(item,index)"></u-icon>
  61. <u-icon v-else name="/static/order/ud9.png" color="green" size="20" @click="tick(item,index)"></u-icon>
  62. </view>
  63. <view class="flex-col right">
  64. <view class="flex-row justify-between">
  65. <text class="serviceType">{{item.serviceName}}</text>
  66. <text class="projectState">{{item.statusDesc}}</text>
  67. </view>
  68. <view class="box_11">
  69. <view class="group_2"></view>
  70. <view class="group_3">
  71. <view class="flex-row">
  72. <u-icon name="server-man" size="16"></u-icon>
  73. <text class="key">服务人员:</text>
  74. <text class="value">{{item.servicePerson || ''}}</text>
  75. </view>
  76. <view class="flex-row">
  77. <u-icon name="clock" size="16"></u-icon>
  78. <text class="key">服务时间:</text>
  79. <text class="value">{{item.serviceTime || ''}}</text>
  80. </view>
  81. </view>
  82. </view>
  83. <view class="flex-row justify-between">
  84. <view>
  85. <text class="key">金额:</text>
  86. <text class="projectMoney">¥{{item.servicePrice}}</text>
  87. </view>
  88. <view class="flex-row" v-if="item.status === 1" @click="appeal(item.orderServiceId)">
  89. <u-icon name="/static/order/ud17.png" color="#93D21A" size="18"></u-icon>
  90. <text class="key">申诉</text>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. <view class="bottomHeight"></view>
  97. <view class="bottom1 flex-col">
  98. <text class="allMoney">合计价格:¥{{allPrice}}</text>
  99. <view class="bottomBtn flex-row justify-between">
  100. <view class=" flex-row">
  101. <text class="unpaid">待支付</text>
  102. <text class="preferentialPrice">¥{{allPrice}}</text>
  103. <text class="originalPrice">¥{{allPrice}}</text>
  104. <text class="priceDetail">价格明细</text>
  105. </view>
  106. <view class="btn" @click="qenPayInfo">
  107. <text lines="1" class="text_33">提交</text>
  108. </view>
  109. </view>
  110. </view>
  111. <uni-popup ref="appealPopup" :animation="false" :catchtouchmove="true">
  112. <view class="appealView flex-col justify-around">
  113. <view class="popupTitle">
  114. <text>请输入申诉理由</text>
  115. </view>
  116. <view class="lex-row justify-center">
  117. <textarea class="textarea" v-model="appealReason" placeholder="请输入申诉理由"></textarea>
  118. </view>
  119. <view class="flex-row justify-around">
  120. <view class="leftBtn" @click="appealPopupClose">
  121. <text>取消</text>
  122. </view>
  123. <view class="rightBtn" @click="commitAppeal">
  124. <text>确定</text>
  125. </view>
  126. </view>
  127. </view>
  128. </uni-popup>
  129. <uni-popup ref="popup" :catchtouchmove="true" :animation="false" type="bottom">
  130. <view class="payView">
  131. <view class="flex-row justify-between">
  132. <text class="payType">请选择支付方式</text>
  133. <image class="x" src="/static/common/ox.png" @click="closePayPopup"></image>
  134. </view>
  135. <view class="payTitle">
  136. <text>选择微信支付或余额支付</text>
  137. </view>
  138. <view class="payItem flex-row justify-between" @click="payItem(1)">
  139. <view class="flex-row">
  140. <u-icon name="/static/me/u701.png" color="#38db38" size="36"></u-icon>
  141. <view class="payName flex-col justify-center">
  142. <text>余额支付</text>
  143. <text class="balance">可以余额¥{{userInfo.balance || 0}}</text>
  144. </view>
  145. </view>
  146. <view class="flex-col justify-center">
  147. <view v-if="curServiceTab === 1" >
  148. <u-icon name="checkmark-circle-fill" color="#38db38" size="25"></u-icon>
  149. </view>
  150. <view v-else>
  151. <u-icon name="/static/order/ud9.png" color="green" size="25"></u-icon>
  152. </view>
  153. </view>
  154. </view>
  155. <view class="payItem flex-row justify-between" @click="payItem(2)">
  156. <view class="flex-row">
  157. <u-icon name="weixin-circle-fill" color="#38db38" size="36"></u-icon>
  158. <view class="payName flex-col justify-center">
  159. <text>微信支付</text>
  160. </view>
  161. </view>
  162. <view class="flex-col justify-center">
  163. <view v-if="curServiceTab === 2" >
  164. <u-icon name="checkmark-circle-fill" color="#38db38" size="25"></u-icon>
  165. </view>
  166. <view v-else>
  167. <u-icon name="/static/order/ud9.png" color="green" size="25"></u-icon>
  168. </view>
  169. </view>
  170. </view>
  171. <view class="commitBtn" @click="commonGeneralOrder">
  172. <text>确定</text>
  173. </view>
  174. </view>
  175. </uni-popup>
  176. <uni-popup ref="passwordPopup">
  177. <view class="passwordView flex-col">
  178. <view class="flex-row justify-center">
  179. <text>请输入交易密码</text>
  180. </view>
  181. <view class="h-tab-bar flex-row justify-center">
  182. <u-code-input v-model="password" mode="box" dot></u-code-input>
  183. </view>
  184. <view class="flex-row justify-center">
  185. <view class="h-operate-btn flex-row justify-center" @click="balancePay">
  186. <text>确定</text>
  187. </view>
  188. </view>
  189. </view>
  190. </uni-popup>
  191. </view>
  192. </template>
  193. <script>
  194. import UniPopup from "../../uni_modules/uni-popup/components/uni-popup/uni-popup";
  195. export default {
  196. components: {
  197. UniPopup
  198. },
  199. data() {
  200. return {
  201. title: 'Hello',
  202. tabIndex: 3,
  203. order:{},
  204. allPrice:0,
  205. appealId:'',
  206. appealReason:'',
  207. orderId:'',
  208. curServiceTab:1,
  209. userInfo:{},
  210. tradeNo:'',
  211. password:''
  212. }
  213. },
  214. onLoad(e) {
  215. this.orderId = e.id
  216. this.getOrderDetailByOrderId(e.id)
  217. this.userInfo = uni.getStorageSync('userInfo')
  218. },
  219. methods: {
  220. balancePay(){
  221. let that = this;
  222. if(this.password.length< 6 ){
  223. uni.showToast({
  224. title: "交易密码不能小于6位"
  225. })
  226. return ;
  227. }
  228. this.$refs.passwordPopup.close()
  229. // 用户信息
  230. this.$api.trade({
  231. tradeNo: this.tradeNo,
  232. password: this.password
  233. }).then((res)=>{
  234. uni.switchTab({
  235. url:'/pages/order/index'
  236. })
  237. }).catch(() =>{
  238. uni.showToast({
  239. title: "操作失败"
  240. })
  241. });
  242. },
  243. scanCodeOrder(order){
  244. uni.scanCode({
  245. scanType: ['qrCode'],
  246. success: function (res) {
  247. uni.navigateTo({
  248. url:'/orderPages/serviceItems/index?serviceStationId='+ res.result + '&orderId='+order.orderId
  249. })
  250. }
  251. })
  252. },
  253. commonGeneralOrder(){
  254. let that =this
  255. if (this.curServiceTab===1){
  256. this.$refs.popup.close()
  257. this.$refs.passwordPopup.open()
  258. }else {
  259. this.$api.wechatPayTradeNo({tradeNo:this.tradeNo}).then(res=>{
  260. var param = res.data.data;
  261. uni.requestPayment({
  262. appId: param.appid,
  263. timeStamp: param.timestamp+"",
  264. nonceStr: param.noncestr,
  265. package: "prepay_id="+param.prepayid,
  266. signType: "RSA",
  267. paySign: param.sign,
  268. success: res => {
  269. uni.showToast({
  270. title: '支付成功!'
  271. });
  272. that.$refs.popup.close()
  273. that.$refs.MescrollItem[that.tabIndex].downCallback()
  274. },
  275. fail: res => {
  276. console.log(res)
  277. uni.showModal({
  278. content: '支付失败',
  279. showCancel: false
  280. });
  281. that.$refs.popup.close()
  282. that.$refs.MescrollItem[that.tabIndex].downCallback()
  283. }
  284. });
  285. }).catch(() =>{
  286. uni.showToast({
  287. title: "操作失败"
  288. })
  289. });
  290. }
  291. },
  292. qenPayInfo(){
  293. let orderServiceIds = []
  294. this.order.child.forEach(i=>{
  295. if (i.tick){
  296. orderServiceIds.push(i.orderServiceId)
  297. }
  298. })
  299. this.$api.qenPayInfo({
  300. orderServiceIds:orderServiceIds,
  301. orderNo:this.order.orderNo
  302. }).then(res=>{
  303. this.tradeNo=res.data.data.tradeNo
  304. this.$refs.popup.open()
  305. })
  306. },
  307. commitAppeal(){
  308. this.$api.appeal({
  309. childOrderId:this.appealId,
  310. appealReason:this.appealReason
  311. }).then(res=>{
  312. this.appealReason=''
  313. uni.$u.toast('申诉已提交')
  314. this.$refs.appealPopup.close()
  315. this.getOrderDetailByOrderId(this.orderId)
  316. })
  317. },
  318. appealPopupClose(){
  319. this.appealReason=''
  320. this.$refs.appealPopup.close()
  321. },
  322. appeal(id){
  323. this.appealId = id
  324. this.$refs.appealPopup.open()
  325. },
  326. tick(item,index){
  327. if (item.status === 1 || item.status === 4){
  328. this.allPrice = 0
  329. item.tick = !item.tick
  330. this.$set(this.order.child,index,item)
  331. this.order.child.forEach(i=>{
  332. if (i.tick){
  333. this.allPrice += i.servicePrice *1
  334. }
  335. })
  336. this.allPrice = this.allPrice.toFixed(2)
  337. }
  338. },
  339. getOrderDetailByOrderId(id){
  340. this.$api.getOrderDetailByOrderId({
  341. id:id
  342. }).then(res=>{
  343. this.order= res.data.data
  344. })
  345. },
  346. payItem(num){
  347. if (this.userInfo.balance < this.price){
  348. return
  349. }
  350. this.curServiceTab = num
  351. },
  352. closePayPopup(){
  353. this.$refs.popup.close()
  354. },
  355. }
  356. }
  357. </script>
  358. <style>
  359. @import '/common/css/common.css';
  360. @import './index.rpx.scss';</style>