detail.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894
  1. <template>
  2. <!-- #ifdef MP-WEIXIN -->
  3. <uv-navbar
  4. :fixed="false"
  5. :title="title"
  6. @leftClick="onClickBack"
  7. />
  8. <!-- #endif -->
  9. <view class="container" style="padding:20rpx;">
  10. <view style="padding-bottom: 100rpx;" v-if="orderData.orderType != 'due'">
  11. <view class="bg-white">
  12. <view class="section">
  13. <!-- store info begin -->
  14. <list-cell :hover="false">
  15. <view class="w-100 d-flex align-items-center">
  16. <view class="d-flex align-center w-60">
  17. <uv-avatar :src="orderData.shop.image"></uv-avatar>
  18. <view class="ml-1 font-weight-bolder w-100 font-size-lg text-color-base text-truncate">{{ orderData.shop.name }}</view>
  19. </view>
  20. <view class="d-flex justify-content-end align-items-center w-40">
  21. <view class="iconfont-yshop icon-mobile" @click="makePhoneCall(orderData.shop)" style="font-size: 45rpx;margin-right: 40rpx;"></view>
  22. <view class="iconfont-yshop icon-location" @click="openLocation(orderData.shop)" style="font-size: 45rpx;"></view>
  23. </view>
  24. </view>
  25. </list-cell>
  26. <!-- store info end -->
  27. <list-cell :hover="false" padding="50rpx 20rpx">
  28. <view class="w-100 d-flex flex-column">
  29. <view class="flex flex-column align-center" v-if="orderData.orderType == 'desk'">
  30. <view><uv-text text="桌号"></uv-text></view>
  31. <view><uv-text :text="orderData.deskNumber" :size="30" color="#059825"></uv-text></view>
  32. </view>
  33. <view class="flex flex-column align-center content-center" v-else>
  34. <view class="mb-1"><uv-text text="取餐号"></uv-text></view>
  35. <view><uv-text :text="orderData.numberId" :size="30" color="#059825"></uv-text></view>
  36. </view>
  37. <!-- goods begin -->
  38. <view class="w-100 d-flex flex-column position-relative mt-30" style="margin-bottom: -40rpx;">
  39. <view class="w-100 d-flex align-items-center mb-40" v-for="(good, index) in orderData.products" :key="index">
  40. <view class="d-flex flex-column w-60 overflow-hidden">
  41. <view class="font-size-lg text-color-base mb-10 text-truncate">{{ good.title }}</view>
  42. <view class="font-size-sm text-color-assist text-truncate">{{ good.spec }}</view>
  43. </view>
  44. <view class="d-flex w-40 align-items-center justify-content-between pl-30">
  45. <view class="font-size-base text-color-base">x{{ good.number }}</view>
  46. <view class="font-size-base text-color-base font-weight-bold">¥{{ good.price }}</view>
  47. </view>
  48. </view>
  49. </view>
  50. <!-- goods end -->
  51. </view>
  52. </list-cell>
  53. </view>
  54. <view class="section">
  55. <!-- goods begin -->
  56. <list-cell :hover="false" padding="50rpx 20rpx">
  57. <view class="w-100 d-flex flex-column position-relative">
  58. <view>
  59. <uv-text text="商品明细" :bold="true" :size="16"></uv-text>
  60. <uv-divider text="" textPosition="left"></uv-divider>
  61. </view>
  62. <view class="cart-popup" v-if="orderData.appDeskOrderVo">
  63. <scroll-view class="cart-list" scroll-y>
  64. <view class="wrapper2">
  65. <view class="item" style="background: linear-gradient(to bottom, #e9f1ee, #fcfcf4);padding: 10rpx 30rpx;margin: 15rpx 0;border-radius: 20rpx;" v-for="(item, index) in orderData.appDeskOrderVo" :key="index">
  66. <view class="flex align-center">
  67. <view><uv-avatar :src="item.uavatar"></uv-avatar></view>
  68. <view class="flex flex-1 justify-between font-size-sm text-color-assist">
  69. <view class="flex flex-column ml-2">
  70. <text>{{item.unickname}}</text>
  71. <text>{{formatDateTime(item.addTime) }}</text>
  72. </view>
  73. <view v-if="isMer == 1">
  74. <text style="color: #9acafc;font-weight: bold;">{{item.uidType == 'user' ? '用户点餐' : '员工帮点'}}</text>
  75. <text style="color: #5ac725;">({{item.isOrder == 0 ? '未出餐' : '已出餐'}})</text>
  76. </view>
  77. </view>
  78. </view>
  79. <uv-divider :hairline="false" text=""></uv-divider>
  80. <view class="flex align-center" v-for="(good,index2) in item.appDeskOrderGoodsVos" :key="index2">
  81. <view><image :src="good.image" style="width: 100rpx;height: 100rpx;"></image></view>
  82. <view class="flex flex-1 flex-column ml-2 font-size-sm">
  83. <view class="flex justify-between"><text class="font-weight-bolder">{{good.title}}</text><text style="color: #f56c6c;">{{good.spec}}</text></view>
  84. <view class="flex justify-between mt-1"><text>¥{{good.price}}</text><text>x{{good.number}}</text></view>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. </scroll-view>
  90. </view>
  91. <view v-else>
  92. <view class="w-100 d-flex align-items-center mb-40" v-for="(good, index) in orderData.cartInfo" :key="index">
  93. <image :src="good.image" mode="aspectFill" class="image"></image>
  94. <view class="d-flex flex-column w-60 overflow-hidden">
  95. <view class="font-size-lg text-color-base mb-10 text-truncate">{{ good.title }}</view>
  96. <view class="font-size-sm text-color-assist text-truncate">{{ good.spec }}</view>
  97. </view>
  98. <view class="d-flex w-40 align-items-center justify-content-between pl-30">
  99. <view class="font-size-base text-color-base">x{{ good.number }}</view>
  100. <view class="font-size-base text-color-base font-weight-bold">¥{{ good.price }}</view>
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. </list-cell>
  106. <!-- goods end -->
  107. </view>
  108. <view class="section">
  109. <list-cell :hover="false" padding="50rpx 30rpx 20rpx" last>
  110. <view class="w-100 d-flex flex-column">
  111. <view>
  112. <view class="flex align-center">
  113. <uv-text text="配送信息" :bold="true" :size="16"></uv-text>
  114. <view v-if="orderData.sameCityTaskId != ''">
  115. <uv-icon size="18" name="reload" @click="detail(orderData.orderId)"></uv-icon>
  116. </view>
  117. </view>
  118. <uv-divider text="" textPosition="left"></uv-divider>
  119. </view>
  120. <view class="pay-cell">
  121. <view>享用方式</view>
  122. <view class="font-weight-bold">
  123. <text v-if="orderData.orderType == 'takein'">自取</text>
  124. <text v-if="orderData.orderType == 'takeout'">外卖({{orderData.sameCityTaskId != '' ? orderData.expressName: '商家自配送'}})</text>
  125. <text v-if="orderData.orderType == 'desk'">堂食</text>
  126. <text v-if="orderData.orderType == 'due'">预约</text>
  127. </view>
  128. </view>
  129. <view v-if="orderData.sameCityTaskId != ''">
  130. <view class="pay-cell">
  131. <view>配送员</view>
  132. <view class="font-weight-bold">{{orderData.sameCityDeliveryCourierName ? orderData.sameCityDeliveryCourierName : '--'}}</view>
  133. </view>
  134. <view class="pay-cell">
  135. <view>配送员电话</view>
  136. <view class="font-weight-bold">{{orderData.sameCityDeliveryCourierMobile ? orderData.sameCityDeliveryCourierMobile : '--'}}</view>
  137. </view>
  138. <view class="pay-cell">
  139. <view>配送状态</view>
  140. <view class="font-weight-bold">{{orderData.sameCityDeliveryStatusDes ? orderData.sameCityDeliveryStatusDes : '--'}}</view>
  141. </view>
  142. <view class="pay-cell">
  143. <view>配送时间</view>
  144. <view class="font-weight-bold">{{orderData.sameCityDeliveryTime ? orderData.sameCityDeliveryTime : '--'}}</view>
  145. </view>
  146. <view class="pay-cell">
  147. <view>送达时间</view>
  148. <view class="font-weight-bold">{{orderData.sameCityDeliveryExpectFinishTime ? orderData.sameCityDeliveryExpectFinishTime : '--'}}</view>
  149. </view>
  150. </view>
  151. <view v-else>
  152. <view class="pay-cell">
  153. <view>取餐时间</view>
  154. <view class="font-weight-bold">{{orderData.getTime ? formatDateTime(orderData.getTime) : '立即就餐'}}</view>
  155. </view>
  156. <view class="pay-cell">
  157. <view>制作完成时间</view>
  158. <view class="font-weight-bold">{{ orderData.deliveryTime ? formatDateTime(orderData.deliveryTime) : '无' }}</view>
  159. </view>
  160. </view>
  161. </view>
  162. </list-cell>
  163. </view>
  164. <view class="section">
  165. <list-cell :hover="false" padding="50rpx 20rpx">
  166. <view class="w-100 d-flex flex-column">
  167. <view>
  168. <uv-text text="订单信息" :bold="true" :size="16"></uv-text>
  169. <uv-divider text="" textPosition="left"></uv-divider>
  170. </view>
  171. <view class="pay-cell">
  172. <view>订单号</view>
  173. <view class="font-weight-bold">{{ orderData.orderId }}</view>
  174. </view>
  175. <view class="pay-cell">
  176. <view>订单状态</view>
  177. <view class="font-weight-bold">{{ orderData.statusDto.title }}</view>
  178. </view>
  179. <view class="pay-cell">
  180. <view>下单时间</view>
  181. <view class="font-weight-bold">{{ formatDateTime(orderData.createTime )}}</view>
  182. </view>
  183. <view class="pay-cell">
  184. <view>支付方式</view>
  185. <view class="font-weight-bold">{{ orderData.statusDto.payType }}</view>
  186. </view>
  187. <view class="pay-cell">
  188. <view>订单金额</view>
  189. <view class="font-weight-bold">¥{{ orderData.totalPrice }}</view>
  190. </view>
  191. <view class="pay-cell" v-if="orderData.orderType == 'takeout'">
  192. <view>配送费</view>
  193. <view class="font-weight-bold">¥{{ orderData.freightPrice }}</view>
  194. </view>
  195. <view class="pay-cell">
  196. <view>优惠金额</view>
  197. <view class="font-weight-bold">-¥{{ orderData.couponPrice }}</view>
  198. </view>
  199. <view class="pay-cell">
  200. <view>折扣金额</view>
  201. <view class="font-weight-bold">-¥{{ orderData.deductionPrice }}</view>
  202. </view>
  203. <view class="pay-cell">
  204. <view>实付金额</view>
  205. <view class="font-weight-bold">¥{{ orderData.payPrice }}</view>
  206. </view>
  207. <view class="pay-cell">
  208. <view>备注</view>
  209. <view class="font-weight-bold">{{ orderData.remark ? orderData.remark : '无' }}</view>
  210. </view>
  211. </view>
  212. </list-cell>
  213. </view>
  214. </view>
  215. <view class="fixed-bottom bg-white p-3">
  216. <view v-if="orderData.paid > 0 && orderData.refundStatus == 0" class="flex justify-end ">
  217. <view class="mr-1"><uv-button type="success" v-if="orderData.status < 2" :plain="true" size="small" text="确认收到餐" @click="receive(orderData)"></uv-button></view>
  218. <view><uv-button type="error" :plain="true" size="small" text="申请退款" @click="refund(orderData)"></uv-button></view>
  219. </view>
  220. <view v-if="orderData.paid == 0 && orderData.orderType == 'desk'" class="flex justify-end ">
  221. <view class="mr-1"><uv-button type="info" text="去加餐" @click="addFood(orderData)"></uv-button></view>
  222. <view v-if="isMer == 1"><uv-button color="#059825" text="线下确认收款" @click="offPayOrder(orderData)"></uv-button></view>
  223. <view v-else><uv-button color="#059825" text="去买单" @click="goPay()"></uv-button></view>
  224. </view>
  225. <view v-if="orderData.paid == 0 && orderData.orderType != 'desk'" class="flex justify-end ">
  226. <view><uv-button type="warning" text="立即支付" @click="goPay()"></uv-button></view>
  227. </view>
  228. </view>
  229. <uv-popup ref="popup" mode="bottom" zIndex='9999' custom-style="height: 400rpx;">
  230. <view class="content">
  231. <view class="payment">
  232. <list-cell last :hover="false"><text>支付方式</text></list-cell>
  233. <list-cell>
  234. <view class="d-flex align-items-center justify-content-between w-100 disabled"
  235. @click="setPayType('yue')">
  236. <view class="iconfont iconbalance line-height-100 payment-icon"></view>
  237. <view class="flex-fill">余额支付(余额¥{{ member.nowMoney }})</view>
  238. <view class="font-size-sm" v-if="member.nowMoney == 0">余额不足</view>
  239. <view class="iconfont line-height-100 checkbox checked iconradio-button-on" v-if="payType == 'yue'">
  240. </view>
  241. <view class="iconfont line-height-100 checkbox iconradio-button-off" v-else></view>
  242. </view>
  243. </list-cell>
  244. <list-cell last>
  245. <view class="d-flex align-items-center justify-content-between w-100" @click="setPayType('weixin')">
  246. <view class="iconfont iconwxpay line-height-100 payment-icon" style="color: #7EB73A"></view>
  247. <view class="flex-fill">微信支付</view>
  248. <view class="iconfont line-height-100 checkbox checked iconradio-button-on" v-if="payType == 'weixin'">
  249. </view>
  250. <view class="iconfont line-height-100 checkbox iconradio-button-off" v-else></view>
  251. </view>
  252. </list-cell>
  253. <list-cell>
  254. <view class="flex justify-center w-100">
  255. <view >
  256. <uv-button type="error" :plain="true" size="normal" text="立即支付" @click="pay(orderData)"></uv-button>
  257. </view>
  258. </view>
  259. </list-cell>
  260. </view>
  261. </view>
  262. </uv-popup>
  263. </view>
  264. <view style="padding-bottom: 100rpx;" v-else>
  265. <view class="bg-white">
  266. <view class="section">
  267. <!-- store info begin -->
  268. <list-cell :hover="false" v-if="orderData.orderType != 'desk'">
  269. <view class="w-100 d-flex align-items-center">
  270. <view class="d-flex flex-column w-60">
  271. <view class="w-100 font-size-lg text-color-base text-truncate">{{ orderData.shop.name }}</view>
  272. </view>
  273. <view class="d-flex justify-content-end align-items-center w-40">
  274. <view class="iconfont-yshop icon-mobile" @click="makePhoneCall(orderData.shop)" style="font-size: 45rpx;margin-right: 40rpx;"></view>
  275. <view class="iconfont-yshop icon-location" @click="openLocation(orderData.shop)" style="font-size: 45rpx;"></view>
  276. </view>
  277. </view>
  278. </list-cell>
  279. <!-- store info end -->
  280. <list-cell :hover="false" padding="50rpx 30rpx">
  281. <view class="w-100 d-flex flex-column">
  282. <!-- steps begin -->
  283. <view class="d-flex just-content-center">
  284. <view class="steps d-flex flex-column w-80">
  285. <view class="steps__text-column">
  286. <view class="steps__text-column-item " :class="{active: orderData.dueStatus == 1}">
  287. <view class="steps__column-item-line bg-transparent"></view>
  288. <view class="steps__text-column-item-text">预约中</view>
  289. <view class="steps__column-item-line"></view>
  290. </view>
  291. <view class="steps__text-column-item activ" :class="{active: orderData.dueStatus == 2}">
  292. <view class="steps__column-item-line"></view>
  293. <view class="steps__text-column-item-text">已取消</view>
  294. <view class="steps__column-item-line"></view>
  295. </view>
  296. <view class="steps__text-column-item" :class="{active: orderData.dueStatus == 3}">
  297. <view class="steps__column-item-line"></view>
  298. <view class="steps__text-column-item-text">
  299. 已完成
  300. </view>
  301. <view class="steps__column-item-line bg-transparent"></view>
  302. </view>
  303. </view>
  304. </view>
  305. </view>
  306. <!-- goods begin -->
  307. <view class="w-100 d-flex flex-column position-relative mt-30" style="margin-bottom: -40rpx;">
  308. <view class="w-100 d-flex align-items-center mb-40">
  309. <view class="d-flex flex-column w-60 overflow-hidden">
  310. <view class="font-size-lg text-color-base mb-10 text-truncate">{{ orderData.appShopDeskVO.title }}</view>
  311. <view class="font-size-sm text-color-assist text-truncate">桌号:{{ orderData.appShopDeskVO.number }}</view>
  312. </view>
  313. <view class="d-flex w-40 align-items-center justify-content-between pl-30">
  314. <view class="font-size-base text-color-base">x1</view>
  315. <view class="font-size-base text-color-base font-weight-bold">¥0.00</view>
  316. </view>
  317. </view>
  318. </view>
  319. <!-- goods end -->
  320. </view>
  321. </list-cell>
  322. </view>
  323. <view class="section">
  324. <list-cell :hover="false" padding="50rpx 30rpx">
  325. <view class="w-100 d-flex flex-column">
  326. <view class="pay-cell">
  327. <view>预约人</view>
  328. <view class="font-weight-bold">{{ orderData.realName }}</view>
  329. </view>
  330. <view class="pay-cell">
  331. <view>预约时间</view>
  332. <view class="font-weight-bold">{{ formatDateTime(orderData.dueTime) }}</view>
  333. </view>
  334. <view class="pay-cell">
  335. <view>到店时间</view>
  336. <view class="font-weight-bold">{{ orderData.reachTime }}</view>
  337. </view>
  338. <view class="pay-cell">
  339. <view>预约桌号</view>
  340. <view class="font-weight-bold">{{ orderData.deskNumber }}</view>
  341. </view>
  342. <view class="pay-cell">
  343. <view>就餐人数</view>
  344. <view class="font-weight-bold">{{ orderData.deskPeople }}</view>
  345. </view>
  346. <view class="pay-cell">
  347. <view>预留电话</view>
  348. <view class="font-weight-bold">{{ orderData.userPhone }}</view>
  349. </view>
  350. </view>
  351. </list-cell>
  352. <!-- payment and amount end -->
  353. </view>
  354. <view class="section">
  355. <!-- order info begin -->
  356. <list-cell :hover="false" padding="50rpx 30rpx">
  357. <view class="w-100 d-flex flex-column">
  358. <view class="pay-cell">
  359. <view>下单时间</view>
  360. <view class="font-weight-bold">{{ formatDateTime(orderData.createTime )}}</view>
  361. </view>
  362. <view class="pay-cell">
  363. <view>订单号</view>
  364. <view class="font-weight-bold">{{ orderData.orderId }}</view>
  365. </view>
  366. </view>
  367. </list-cell>
  368. <!-- order info end -->
  369. </view>
  370. <!-- order other info begin -->
  371. <list-cell :hover="false" padding="50rpx 30rpx 20rpx" last v-if="orderData.orderType != 'desk'">
  372. <view class="w-100 d-flex flex-column">
  373. <view class="pay-cell">
  374. <view>享用方式</view>
  375. <view class="font-weight-bold">预约到店就餐</view>
  376. </view>
  377. <view class="pay-cell">
  378. <view>备注</view>
  379. <view class="font-weight-bold">{{ orderData.remark ? orderData.remark : '无' }}</view>
  380. </view>
  381. </view>
  382. </list-cell>
  383. <!-- order other info end -->
  384. </view>
  385. <view class="fixed-bottom bg-white p-3">
  386. <view v-if="orderData.dueStatus == 1" class="flex justify-end ">
  387. <view><uv-button type="warning" text="取消预约" @click="cancelDueOrder(orderData)"></uv-button></view>
  388. <view class="ml-1"><uv-button type="error" text="去点餐" @click="addFood(orderData)"></uv-button></view>
  389. </view>
  390. </view>
  391. </view>
  392. </view>
  393. </template>
  394. <script setup>
  395. import {
  396. ref
  397. } from 'vue'
  398. import { onLoad} from '@dcloudio/uni-app'
  399. import { formatDateTime, isWeixin } from '@/utils/util'
  400. import {
  401. orderDetail,
  402. orderReceive,
  403. payUnify,
  404. getWechatConfig,
  405. cancelDue,
  406. offPay
  407. } from '@/api/order'
  408. import { useMainStore } from '@/store/store'
  409. import { storeToRefs } from 'pinia'
  410. // #ifdef H5
  411. import * as jweixin from 'weixin-js-sdk'
  412. // #endif
  413. const main = useMainStore()
  414. const { member,isMer } = storeToRefs(main)
  415. const title = ref('订单详情')
  416. const orderData = ref({
  417. shop:{name:''},
  418. statusDto:{payType:''}
  419. })
  420. const order = ref({})
  421. const numForMading = ref(5)
  422. const popup = ref()
  423. const payType = ref('weixin') // 付款方式
  424. //const isMer = ref(0) //是否商家协助点餐
  425. onLoad((option) => {
  426. if(option.isMer){
  427. isMer.value = option.isMer
  428. main.SET_MER(1)
  429. main.SET_UID_TYPE('admin')
  430. }
  431. detail(option.id);
  432. })
  433. const onClickBack = () => {
  434. const mypage = getCurrentPages()
  435. let length = mypage.length
  436. if(length == 1) {
  437. uni.switchTab({
  438. url: '/pages/index/index'
  439. })
  440. return
  441. }
  442. if(length > 1) {
  443. if(mypage[length - 2].route == 'pages/components/pages/pay/pay'){
  444. uni.switchTab({
  445. url: '/pages/menu/menu'
  446. })
  447. return
  448. }
  449. }
  450. uni.navigateBack()
  451. }
  452. const detail = async(id) => {
  453. orderData.value = await orderDetail(id);
  454. }
  455. const openLocation = () => {
  456. let shop = orderData.value.shop;
  457. uni.openLocation({
  458. address: shop.addressMap + shop.address + " " + shop.name,
  459. latitude: parseFloat(shop.lat),
  460. longitude: parseFloat(shop.lng),
  461. fail(res) {
  462. }
  463. });
  464. }
  465. const makePhoneCall = () =>{
  466. let shop = orderData.value.shop;
  467. uni.makePhoneCall({
  468. phoneNumber: shop.mobile,
  469. fail(res) {
  470. }
  471. })
  472. }
  473. // 确认收到货
  474. const receive = async(order) => {
  475. let data = await orderReceive({uni:order.orderId});
  476. if (data) {
  477. await detail(order.orderId)
  478. }
  479. }
  480. const cancelDueOrder = async(order) => {
  481. let data = await cancelDue({id:order.id});
  482. if (data) {
  483. await detail(order.orderId)
  484. }
  485. }
  486. const offPayOrder = async(order) => {
  487. let data = await offPay({id:order.id});
  488. if (data) {
  489. await detail(order.orderId)
  490. }
  491. }
  492. //提交退款
  493. const refund = (order) => {
  494. uni.navigateTo({
  495. url: '/pages/components/pages/orders/refund?orderId=' + order.orderId + '&payPrice=' + order.payPrice + '&totalPrice=' + order.totalPrice
  496. })
  497. }
  498. //加餐
  499. const addFood = (order) => {
  500. main.SET_DESK({id: order.deskId, number:order.deskNumber, shopId: order.shopId, people: order.deskPeople,orderId: order.orderId})
  501. main.SET_ORDER_TYPE('desk')
  502. main.SET_STORE(order.shop)
  503. uni.switchTab({
  504. url: '/pages/menu/menu'
  505. })
  506. }
  507. const goPay = () => {
  508. popup.value.open()
  509. }
  510. const pay = async(order) => {
  511. if (payType.value == 'weixin') {
  512. // 微信支付
  513. weixinPay(order);
  514. } else if (payType.value == 'yue') {
  515. // 余额支付
  516. balancePay(order);
  517. }
  518. }
  519. // 更改支付方式
  520. const setPayType = (paytype) => {
  521. payType.value = 'weixin';
  522. payType.value= paytype;
  523. uni.setStorage({
  524. key: 'paytype',
  525. data: paytype
  526. })
  527. }
  528. const balancePay = async(order) => {
  529. let from = 'routine'
  530. // #ifdef H5
  531. from = 'h5'
  532. // #endif
  533. let pay = await payUnify({
  534. uni: order.orderId,
  535. from: from,
  536. paytype: 'yue'
  537. });
  538. uni.hideLoading();
  539. if (!pay) {
  540. return;
  541. }
  542. uni.removeStorageSync('cart');
  543. popup.value.close();
  544. detail(order.orderId)
  545. }
  546. const weixinPay = async(order) => {
  547. let from = 'routine'
  548. // #ifdef H5
  549. from = 'h5'
  550. if(isWeixin()){
  551. from = 'wechat'
  552. }
  553. // #endif
  554. //let that = this;
  555. let data = await payUnify({
  556. uni: order.orderId,
  557. from: from,
  558. paytype: 'weixin'
  559. });
  560. if (!data) {
  561. uni.hideLoading();
  562. return;
  563. }
  564. if (data.trade_type == 'MWEB') {
  565. // #ifdef H5
  566. // 微信外的H5
  567. location.href = data.data;
  568. // #endif
  569. } else if (data.trade_type == 'JSAPI') {
  570. // #ifdef MP-WEIXIN
  571. uni.requestPayment({
  572. provider: 'wxpay',
  573. timeStamp: data.data.timeStamp,
  574. nonceStr: data.data.nonceStr,
  575. package: data.data.package,
  576. signType: 'MD5',
  577. paySign: data.data.paySign,
  578. success: function(res) {
  579. uni.removeStorageSync('cart');
  580. popup.value.close();
  581. detail(order.orderId)
  582. // uni.switchTab({
  583. // url: '/pages/order/order'
  584. // });
  585. },
  586. fail: function(err) {
  587. }
  588. });
  589. // #endif
  590. } else if (data.trade_type == 'W-JSAPI'){
  591. //公众号支付
  592. let config = await getWechatConfig();
  593. if (config) {
  594. jweixin.config({
  595. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  596. appId: config.appId, // 必填,公众号的唯一标识
  597. timestamp: config.timestamp, // 必填,生成签名的时间戳
  598. nonceStr: config.nonceStr, // 必填,生成签名的随机串
  599. signature: config.signature, // 必填,签名
  600. jsApiList: [
  601. 'chooseWXPay'
  602. ] ,
  603. }
  604. );
  605. jweixin.ready(function() {
  606. jweixin.chooseWXPay({
  607. timestamp: data.data.timeStamp,
  608. nonceStr: data.data.nonceStr,
  609. package: data.data.package,
  610. signType: 'MD5',
  611. paySign: data.data.paySign,
  612. success: function(res) {
  613. uni.removeStorageSync('cart');
  614. popup.value.close();
  615. detail(order.orderId)
  616. // uni.switchTab({
  617. // url: '/pages/order/order'
  618. // });
  619. },
  620. fail: function(err) {
  621. }
  622. });
  623. });
  624. jweixin.error(function(res) {
  625. });
  626. } else {
  627. //console.log(res)
  628. }
  629. }
  630. }
  631. </script>
  632. <style lang="scss" scoped>
  633. .cart-list {
  634. background-color: #ffffff;
  635. width: 100%;
  636. overflow: hidden;
  637. min-height: 1vh;
  638. max-height: 60vh;
  639. }
  640. .image {
  641. width: 120rpx;
  642. height: 120rpx;
  643. margin-right: 30rpx;
  644. border-radius: 8rpx;
  645. }
  646. .pay-cell {
  647. width: 100%;
  648. display: flex;
  649. align-items: center;
  650. justify-content: space-between;
  651. font-size: $font-size-base;
  652. color: $text-color-base;
  653. margin-bottom: 40rpx;
  654. &:nth-last-child(1) {
  655. margin-bottom: 0;
  656. }
  657. }
  658. .desk-num {
  659. font-size: 30rpx;
  660. font-weight: bold;
  661. color: $text-color-base;
  662. }
  663. .sort-num {
  664. font-size: 64rpx;
  665. font-weight: bold;
  666. color: $text-color-base;
  667. line-height: 2;
  668. }
  669. .invote-box {
  670. position: absolute;
  671. width: 100%;
  672. left: 0;
  673. top: 0;
  674. display: flex;
  675. justify-content: center;
  676. align-items: center;
  677. image {
  678. width: 30rpx;
  679. height: 30rpx;
  680. }
  681. }
  682. .btn-box {
  683. background-color: #ffffff;
  684. position: fixed;
  685. bottom: 0;
  686. left: 0;
  687. right: 0;
  688. height: 120rpx;
  689. box-shadow: 0 0 20rpx rgba($color: #000000, $alpha: 0.1);
  690. display: flex;
  691. align-items: center;
  692. justify-content: space-evenly;
  693. z-index: 11;
  694. .item {
  695. display: flex;
  696. align-items: center;
  697. justify-content: center;
  698. padding: 20rpx 10rpx;
  699. flex: 1;
  700. flex-shrink: 0;
  701. button {
  702. width: 100%;
  703. border-radius: 50rem !important;
  704. height: 80rpx;
  705. display: flex;
  706. align-items: center;
  707. justify-content: center;
  708. padding: 0;
  709. }
  710. }
  711. }
  712. .payment {
  713. margin-bottom: 30rpx;
  714. .disabled {
  715. color: $text-color-grey;
  716. }
  717. .payment-icon {
  718. font-size: 44rpx;
  719. margin-right: 10rpx;
  720. }
  721. .checkbox {
  722. font-size: 36rpx;
  723. margin-left: 10rpx;
  724. }
  725. .checked {
  726. color: $color-primary;
  727. }
  728. }
  729. /* #ifdef H5 */
  730. page {
  731. min-height: 100%;
  732. background-color: $bg-color;
  733. }
  734. /* #endif */
  735. .order-box {
  736. padding: 20rpx;
  737. /* #ifdef H5 */
  738. margin-bottom: 100rpx;
  739. /* #endif */
  740. }
  741. .drinks-img {
  742. width: 260rpx;
  743. height: 260rpx;
  744. }
  745. .tips {
  746. margin: 60rpx 0 80rpx;
  747. line-height: 48rpx;
  748. }
  749. .drink-btn {
  750. width: 320rpx;
  751. border-radius: 50rem !important;
  752. margin-bottom: 40rpx;
  753. font-size: $font-size-base;
  754. line-height: 3.0;
  755. }
  756. @mixin arch {
  757. content: "";
  758. position: absolute;
  759. background-color: $bg-color;
  760. width: 30rpx;
  761. height: 30rpx;
  762. bottom: -15rpx;
  763. z-index: 10;
  764. border-radius: 100%;
  765. }
  766. .section {
  767. position: relative;
  768. &::before {
  769. @include arch;
  770. left: -15rpx;
  771. }
  772. &::after {
  773. @include arch;
  774. right: -15rpx;
  775. }
  776. }
  777. .pay-cell {
  778. width: 100%;
  779. display: flex;
  780. align-items: center;
  781. justify-content: space-between;
  782. font-size: $font-size-base;
  783. color: $text-color-base;
  784. margin-bottom: 40rpx;
  785. &:nth-last-child(1) {
  786. margin-bottom: 0;
  787. }
  788. }
  789. .steps__img-column {
  790. display: flex;
  791. margin: 30rpx 0;
  792. .steps__img-column-item {
  793. flex: 1;
  794. display: flex;
  795. align-items: center;
  796. justify-content: center;
  797. image {
  798. width: 80rpx;
  799. height: 80rpx;
  800. }
  801. .unactive {
  802. color: #919293;
  803. }
  804. }
  805. }
  806. .steps__text-column {
  807. display: flex;
  808. margin-bottom: 40rpx;
  809. .steps__text-column-item {
  810. flex: 1;
  811. display: inline-flex;
  812. display: flex;
  813. align-items: center;
  814. justify-content: center;
  815. font-size: $font-size-base;
  816. color: $text-color-assist;
  817. &.active {
  818. color: $text-color-base;
  819. font-weight: bold;
  820. .steps__column-item-line {
  821. background-color: $text-color-base;
  822. }
  823. }
  824. .steps__column-item-line{
  825. flex: 1;
  826. height: 2rpx;
  827. background-color: #919293;
  828. transform: scaleY(0.5);
  829. }
  830. .steps__text-column-item-text {
  831. margin: 0 8px;
  832. }
  833. }
  834. }
  835. .icon-lamp, .icon-daojishi, .icon-takeout, .icon-doorbell{
  836. font-size: 60rpx;
  837. }
  838. .iconfont-yshop {
  839. color: #059825;
  840. }
  841. </style>