index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952
  1. <template>
  2. <view class="flex-common-css box-border-box">
  3. <Nav class="nav-b" :leftShow='false' :customNav='true' bgckgroundBox='#fff'>
  4. <template>
  5. <view slot="custom" class="text-align-center fw-600 fs-36">
  6. 我的订单
  7. </view>
  8. </template>
  9. </Nav>
  10. <view class="nav-box box-border-box bgc-f display-flex">
  11. <view class="nav-item" :class="type == item.id?'fs-36 fw-600':'fs-34 fw-400'" v-for="(item,i) in navList"
  12. :key="i" @click="selectType(item.id)">
  13. {{item.name}}
  14. <view v-if="type == item.id" class="nav-item-x"></view>
  15. </view>
  16. </view>
  17. <scroll-view class="nav-type-box bgc-f p-12-24 box-border-box" :scroll-x="true">
  18. <view class="nav-type-item text-align-center fs-28" v-for="(item,index) in navTypeData"
  19. @click="navTypeClick(item.key)"
  20. :class="navTypeKey== item.key?'bgc-E4F3FD fw-600 fc-41ABF5':'bgc-F4F5F7 fw-400 fc-3'">
  21. {{item.name}}
  22. </view>
  23. </scroll-view>
  24. <view v-if="list.length == 0" class="scroll-view-css">
  25. <EnBlank :customSrc='true'>
  26. <template v-slot:blankImg>
  27. <image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
  28. </template>
  29. </EnBlank>
  30. </view>
  31. <scroll-view v-else :scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
  32. <view class="list-box">
  33. <view class="list-item bgc-f b-rad-20 mb-32 p-24 box-border-box" v-for="(item,index) in list"
  34. @click="goToInfo(item)">
  35. <view class="align-items-center flex-justify-space mb-24">
  36. <view class="align-items-center">
  37. <image v-if="item.site_logo" class="shops-img" :src="item.site_logo" mode="aspectFit">
  38. </image>
  39. <image v-else-if="item.shop_logo" class="shops-img" :src="item.shop_logo" mode="aspectFit">
  40. </image>
  41. <image v-else class="shops-img" src="@/static/img/logo/logo.png" mode=""></image>
  42. <view v-if="item.site_name" class="fs-32 fc-3 fw-600 shops-name text-overflow-ellipsis-one">
  43. {{item.site_name}}
  44. </view>
  45. <view @click="goToShop(item)" v-else-if="item.shop_name"
  46. class="fs-32 fc-3 fw-600 shops-name text-overflow-ellipsis-one">
  47. {{item.shop_name}}
  48. </view>
  49. <view v-else class="fs-32 fc-3 fw-600 shops-name text-overflow-ellipsis-one">
  50. 君子校园
  51. </view>
  52. <!-- <image class="icons" src="@/static/img/toRight.png" mode=""></image> -->
  53. </view>
  54. <view class="fc-41ABF5 fs-28">
  55. {{item.order_status_str}}
  56. </view>
  57. </view>
  58. <view class="align-items-center flex-justify-space mb-24">
  59. <view class="goods-box" v-if="type == 1 || type == 2 || type == 5">
  60. <view class="" v-if="item.item.length == 1">
  61. <view class="align-items-center" v-for="(itemGoods,indexGoods) in item.item">
  62. <image class="goods-img flex-shrink0" :src="itemGoods.goods_img" mode="aspectFit">
  63. </image>
  64. <view class="fs-28 fc-6 text-overflow-ellipsis">
  65. {{itemGoods.goods_name}}
  66. </view>
  67. </view>
  68. </view>
  69. <view class="align-items-center goods-two" v-else>
  70. <view class="flex-direction" v-for="(itemGoods,indexGoods) in item.item">
  71. <image class="goods-img flex-shrink0" :src="itemGoods.goods_img" mode="aspectFit">
  72. </image>
  73. <view
  74. class="fs-28 fc-6 text-overflow-ellipsis-one goods-two-name text-align-center">
  75. {{itemGoods.goods_name}}
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="goods-box" v-else>
  81. <view class="align-items-center">
  82. <image class="goods-img flex-shrink0" :src="item.goods_img" mode="aspectFit">
  83. </image>
  84. <view class="fs-28 fc-6 text-overflow-ellipsis">
  85. {{item.goods_name}}
  86. </view>
  87. </view>
  88. </view>
  89. <view class="goods-num text-align-center">
  90. 共 {{item.goods_number}} 件
  91. </view>
  92. </view>
  93. <view class="align-items-center flex-justify-space mb-24">
  94. <view class="fs-24 fc-9">
  95. 下单时间:{{item.created_at}}
  96. </view>
  97. <view class="fs-28 fc-9">
  98. {{item.order_status == 1?'需付':'实付'}} <text
  99. class="fs-32 fc-3 fw-600">¥{{item.pay_money}}</text>
  100. </view>
  101. </view>
  102. <view class="align-items-center flex-justify-end">
  103. <view class="item-but but-class-two fs-28 mr-18" @click="assess(item)"
  104. v-if="type == 1 && item.order_status == 7 && item.is_comment == 0">
  105. 评价
  106. </view>
  107. <view class="item-but but-class-two fs-28 mr-18" @click.stop="tackOut(item)"
  108. v-if="type == 1 && item.order_status == 2 || type == 1 && item.order_status == 4">
  109. <!-- 外卖 -->
  110. 取消订单
  111. </view>
  112. <view class="item-but but-class-two fs-28 mr-18" @click.stop="cancel(item)"
  113. v-if="type == 5 && item.order_status == 2">
  114. <!-- 干洗 -->
  115. 取消订单
  116. </view>
  117. <view class="item-but but-class-two fs-28 mr-18" @click.stop="expressCancel(item)"
  118. v-if="type == 2 && item.order_status == 2">
  119. <!-- 代取 -->
  120. 取消订单
  121. </view>
  122. <view class="item-but but-class-one fs-28 mr-18" @click.stop="orderPay(item)"
  123. v-if="item.order_status == 1">
  124. 立即支付
  125. </view>
  126. <view class="item-but but-class-one fs-28" @click.stop="openCode(item)"
  127. v-if="type == 5 && item.order_status == 2 || type == 5 && item.order_status == 4">
  128. 二维码
  129. </view>
  130. <view class="item-but but-class-two fs-28 mr-18" @click.stop="goCode(item)"
  131. v-if="type == 3 && item.order_status == 2">
  132. <!-- 代取 -->
  133. 查看券码
  134. </view>
  135. <view @click.stop="goToUrl('takeOut', item)" class="item-but but-class-one fs-28 mr-18"
  136. v-if="type == 1 && item.order_status == 3 || type == 1 && item.order_status == 7 || type == 1 && item.order_status == 8 || type == 1 && item.order_status == 9 || type == 1 && item.order_status == 10">
  137. <!-- 外卖 -->
  138. 再来一单
  139. </view>
  140. <view @click.stop="goToUrl('express', item)" class="item-but but-class-one fs-28 mr-18"
  141. v-if="type == 2 && item.order_status == 4 || type == 2 && item.order_status == 5 || type == 2 && item.order_status == 6">
  142. <!-- 代取 -->
  143. 再来一单
  144. </view>
  145. <view @click.stop="goToUrl('group', item)" class="item-but but-class-one fs-28 mr-18"
  146. v-if="type == 3 && item.order_status == 2 || type == 3 && item.order_status == 4">
  147. <!-- 团购 -->
  148. 再来一单
  149. </view>
  150. <view @click.stop="goToUrl('ticket', item)" class="item-but but-class-one fs-28 mr-18"
  151. v-if="type == 4 && item.order_status == 2 || type == 4 && item.order_status == 4">
  152. <!-- 票务 -->
  153. 再来一单
  154. </view>
  155. <view @click.stop="goToUrl('laundry', item)" class="item-but but-class-one fs-28 mr-18"
  156. v-if="type == 5 && item.order_status == 5 || type == 5 && item.order_status == 6 || type == 5 && item.order_status == 7">
  157. <!-- 干洗 -->
  158. 再来一单
  159. </view>
  160. </view>
  161. </view>
  162. </view>
  163. </scroll-view>
  164. <uni-popup ref="popup" border-radius="10px 10px 10px 10px" @maskClick='maskClick'>
  165. <view class="bgc-f p-16 box-border-box b-rad-20" v-if="qrcodeData">
  166. <!-- <UniQrcode :text="qrcodeData"></UniQrcode> -->
  167. <uv-qrcode class="b-rad-20" ref="qrcode" :value="qrcodeData" :options="options2"></uv-qrcode>
  168. <view class="text-align-center fs-38">
  169. {{onlyCode}}
  170. </view>
  171. </view>
  172. </uni-popup>
  173. </view>
  174. </template>
  175. <script>
  176. // import UniQrcode from 'uniapp-qrcode'
  177. import tools from '@/service/tools';
  178. import EnBlank from "@/components/en-utils/en-blank/en-blank";
  179. import {
  180. orderStatus,
  181. orderList,
  182. orderCancel,
  183. orderPay
  184. } from "@/api/order.js"
  185. import {
  186. getExpressPay
  187. } from "@/api/express.js"
  188. import {
  189. expressOrderStatus,
  190. expressOrderList,
  191. expressOrderCancel
  192. } from "@/api/expressOrder.js"
  193. import {
  194. groupPay
  195. } from '@/api/groupOrder.js';
  196. import {
  197. groupOrderStatus,
  198. groupOrderList
  199. } from "@/api/groupOrder.js"
  200. import {
  201. ticketPay
  202. } from '@/api/ticket.js';
  203. import {
  204. ticketOrderStatus,
  205. ticketOrderList
  206. } from "@/api/ticketOrder.js"
  207. import {
  208. laundryOrderStatus,
  209. laundryOrderList,
  210. laundryOrderCancel,
  211. laundryPay
  212. } from "@/api/laundryOrder.js"
  213. export default {
  214. components: {
  215. EnBlank
  216. },
  217. data() {
  218. return {
  219. type: 1,
  220. navList: [{
  221. name: '外卖',
  222. id: 1
  223. },
  224. {
  225. name: '代取',
  226. id: 2
  227. },
  228. {
  229. name: '团购',
  230. id: 3
  231. },
  232. {
  233. name: '票务',
  234. id: 4
  235. },
  236. {
  237. name: '干洗',
  238. id: 5
  239. },
  240. ],
  241. page: 1,
  242. list: [],
  243. total: 0,
  244. navTypeData: [],
  245. navTypeKey: 0,
  246. isAjax: false,
  247. qrcodeData: '',
  248. options2: {},
  249. onlyCode: ''
  250. };
  251. },
  252. onShow() {
  253. setTimeout(() => {
  254. uni.showTabBar()
  255. }, 400)
  256. let orderPayType = uni.getStorageSync('orderPayType')
  257. let orderInfoType = uni.getStorageSync('orderInfoType')
  258. console.log(orderPayType, 'orderPayType');
  259. console.log(orderInfoType, 'orderInfoType');
  260. if (orderPayType) {
  261. this.selectType(orderPayType)
  262. console.log('固定type');
  263. } else if (orderInfoType) {
  264. } else {
  265. this.resetList();
  266. }
  267. uni.$on('takeOutData', (data) => {
  268. console.log(data, '^^^^^^^^^^^^^^^^^^^^^^^^^');
  269. this.list.forEach((v, k) => {
  270. if (v.id == data.id) {
  271. v.order_status = data.order_status
  272. v.order_status_str = data.order_status_str
  273. }
  274. })
  275. this.$forceUpdate()
  276. uni.removeStorageSync('orderInfoType')
  277. console.log(this.list, 'this.list');
  278. })
  279. },
  280. onLoad() {},
  281. onHide() {
  282. console.log("onHide");
  283. uni.removeStorageSync('orderPayType')
  284. },
  285. onUnload() {
  286. console.log("onUnload");
  287. },
  288. mounted() {},
  289. methods: {
  290. goCode(item) {
  291. uni.navigateTo({
  292. url: '/pages-buy/group-code?order_id=' + item.id
  293. })
  294. },
  295. openCode(item) {
  296. this.onlyCode = item.only_code
  297. let m_id = uni.getStorageSync('m_id');
  298. this.qrcodeData = m_id + "_" + item.order_sn
  299. this.options2 = {
  300. size: 300,
  301. margin: 10
  302. }
  303. uni.hideTabBar()
  304. this.$refs.popup.open('center')
  305. },
  306. maskClick() {
  307. this.$refs.popup.close()
  308. this.qrcodeData = ''
  309. uni.showTabBar()
  310. },
  311. goToShop(item) {
  312. // 进入店铺
  313. uni.navigateTo({
  314. url: '/pages-takeout/shop?shop_id=' + item.shop_id
  315. })
  316. },
  317. goToUrl(type, item) {
  318. // 再来一单
  319. if (type == 'takeOut') {
  320. // uni.navigateTo({
  321. // url: '/pages-takeout/takeout'
  322. // })
  323. uni.navigateTo({
  324. url: '/pages-takeout/shop?shop_id=' + item.shop_id
  325. })
  326. } else if (type == 'express') {
  327. uni.navigateTo({
  328. url: '/pages-takeout/replace-take'
  329. })
  330. } else if (type == 'group') {
  331. uni.navigateTo({
  332. url: '/pages-buy/group-shop?shop_id=' + item.shop_id
  333. })
  334. } else if (type == 'ticket') {
  335. uni.navigateTo({
  336. url: '/pages-buy/ticket'
  337. })
  338. } else if (type == 'laundry') {
  339. uni.navigateTo({
  340. url: '/pages-buy/dry-clean'
  341. })
  342. }
  343. },
  344. goToInfo(item) {
  345. if (this.type === 1) {
  346. uni.navigateTo({
  347. url: `/pages-order/takeout-info?orderId=` + item.id
  348. })
  349. } else if (this.type === 2) {
  350. uni.navigateTo({
  351. url: `/pages-order/express-info?orderId=` + item.id
  352. })
  353. } else if (this.type === 3) {
  354. uni.navigateTo({
  355. url: `/pages-order/group-info?orderId=` + item.id
  356. })
  357. } else if (this.type === 4) {
  358. uni.navigateTo({
  359. url: `/pages-order/ticket-info?orderId=` + item.id
  360. })
  361. } else if (this.type === 5) {
  362. uni.navigateTo({
  363. url: `/pages-order/laundry-info?orderId=` + item.id
  364. })
  365. }
  366. uni.setStorageSync('orderInfoType', this.type)
  367. },
  368. orderPay(item) {
  369. // 立即支付
  370. if (this.type === 1) {
  371. this.takeawayPay(item.id)
  372. } else if (this.type === 2) {
  373. this.getExpressPay(item.id)
  374. } else if (this.type === 3) {
  375. this.groupPay(item.id)
  376. } else if (this.type === 4) {
  377. this.ticketPay(item.id)
  378. } else if (this.type === 5) {
  379. this.laundryPay(item.id)
  380. }
  381. },
  382. navTypeClick(key) {
  383. if (this.navTypeKey != key) {
  384. this.navTypeKey = key
  385. this.page = 1
  386. this.list = []
  387. if (this.type === 1) {
  388. this.orderList()
  389. } else if (this.type === 2) {
  390. this.expressOrderList()
  391. } else if (this.type === 3) {
  392. this.groupOrderList()
  393. } else if (this.type === 4) {
  394. this.ticketOrderList()
  395. } else if (this.type === 5) {
  396. this.laundryOrderList()
  397. }
  398. }
  399. },
  400. resetList() {
  401. this.page = 1;
  402. this.list = [];
  403. this.getList();
  404. uni.removeStorageSync('orderPayType')
  405. },
  406. selectType(type) {
  407. let orderPayType = uni.getStorageSync('orderPayType')
  408. if (type != this.type || orderPayType) {
  409. this.type = type;
  410. this.navTypeKey = 0
  411. this.resetList();
  412. }
  413. },
  414. assess(item) {
  415. // 外卖评价
  416. uni.navigateTo({
  417. url: `/pages-my/appraise?orderId=` + item.id + '&shopName=' + item.shop_name + '&shopLogo=' +
  418. item.shop_logo
  419. })
  420. },
  421. tackOut(item) {
  422. // 外卖取消订单
  423. uni.showModal({
  424. title: '提示',
  425. content: '是否取消订单?',
  426. confirmText: '确定',
  427. confirmColor: '#FB3D03',
  428. success: (res) => {
  429. if (res.confirm === true) {
  430. if (this.isAJAX) {
  431. return
  432. }
  433. this.isAJAX = true;
  434. orderCancel({
  435. order_id: item.id
  436. }).then((res) => {
  437. if (res.code == 1) {
  438. tools.success(res.msg)
  439. setTimeout(() => {
  440. this.page = 1;
  441. this.list = [];
  442. this.orderList()
  443. }, 1500)
  444. this.isAJAX = false;
  445. } else {
  446. tools.error(res.msg)
  447. this.isAJAX = false;
  448. }
  449. })
  450. }
  451. }
  452. });
  453. },
  454. expressCancel(item) {
  455. // 代取取消订单
  456. uni.showModal({
  457. title: '提示',
  458. content: '是否取消订单?',
  459. confirmText: '确定',
  460. confirmColor: '#FB3D03',
  461. success: (res) => {
  462. if (res.confirm === true) {
  463. if (this.isAJAX) {
  464. return
  465. }
  466. this.isAJAX = true;
  467. expressOrderCancel({
  468. order_id: item.id
  469. }).then((res) => {
  470. if (res.code == 1) {
  471. tools.success(res.msg)
  472. setTimeout(() => {
  473. this.page = 1;
  474. this.list = [];
  475. this.expressOrderList()
  476. }, 1500)
  477. this.isAJAX = false;
  478. } else {
  479. tools.error(res.msg)
  480. this.isAJAX = false;
  481. }
  482. })
  483. }
  484. }
  485. });
  486. },
  487. cancel(item) {
  488. // 干洗取消订单
  489. uni.showModal({
  490. title: '提示',
  491. content: '是否取消订单?',
  492. confirmText: '确定',
  493. confirmColor: '#FB3D03',
  494. success: (res) => {
  495. if (res.confirm === true) {
  496. if (this.isAJAX) {
  497. return
  498. }
  499. this.isAJAX = true;
  500. laundryOrderCancel({
  501. order_id: item.id
  502. }).then((res) => {
  503. if (res.code == 1) {
  504. tools.success(res.msg)
  505. setTimeout(() => {
  506. this.page = 1;
  507. this.list = [];
  508. this.laundryOrderList()
  509. }, 1500)
  510. this.isAJAX = false;
  511. } else {
  512. tools.error(res.msg)
  513. this.isAJAX = false;
  514. }
  515. })
  516. }
  517. }
  518. });
  519. },
  520. scrolltolower() {
  521. ++this.page
  522. if (this.type === 1) {
  523. this.orderList()
  524. } else if (this.type === 2) {
  525. this.expressOrderList()
  526. } else if (this.type === 3) {
  527. this.groupOrderList()
  528. } else if (this.type === 4) {
  529. this.ticketOrderList()
  530. } else if (this.type === 5) {
  531. this.laundryOrderList()
  532. }
  533. // console.log('触底');
  534. },
  535. getList() {
  536. if (this.type === 1) {
  537. this.orderStatus()
  538. this.orderList()
  539. } else if (this.type === 2) {
  540. this.expressOrderStatus()
  541. this.expressOrderList()
  542. } else if (this.type === 3) {
  543. this.groupOrderStatus()
  544. this.groupOrderList()
  545. } else if (this.type === 4) {
  546. this.ticketOrderStatus()
  547. this.ticketOrderList()
  548. } else if (this.type === 5) {
  549. this.laundryOrderStatus()
  550. this.laundryOrderList()
  551. }
  552. },
  553. expressOrderStatus() {
  554. // 代取订单状态
  555. expressOrderStatus().then((res) => {
  556. if (res.code == 1) {
  557. this.navTypeData = res.data
  558. }
  559. })
  560. },
  561. orderStatus() {
  562. // 外卖订单状态
  563. orderStatus().then((res) => {
  564. if (res.code == 1) {
  565. this.navTypeData = res.data
  566. }
  567. })
  568. },
  569. groupOrderStatus() {
  570. // 团购订单状态
  571. groupOrderStatus().then((res) => {
  572. if (res.code == 1) {
  573. this.navTypeData = res.data
  574. }
  575. })
  576. },
  577. ticketOrderStatus() {
  578. // 票务订单状态
  579. ticketOrderStatus().then((res) => {
  580. if (res.code == 1) {
  581. this.navTypeData = res.data
  582. }
  583. })
  584. },
  585. laundryOrderStatus() {
  586. // 干洗订单状态
  587. laundryOrderStatus().then((res) => {
  588. if (res.code == 1) {
  589. this.navTypeData = res.data
  590. }
  591. })
  592. },
  593. orderList() {
  594. // 外卖订单列表
  595. orderList({
  596. status: this.navTypeKey,
  597. page: this.page
  598. }).then((res) => {
  599. if (res.code == 1) {
  600. if (res.data.items.length > 0) {
  601. this.list.push(...res.data.items)
  602. }
  603. }
  604. })
  605. },
  606. expressOrderList() {
  607. // 代取订单列表
  608. expressOrderList({
  609. status: this.navTypeKey,
  610. page: this.page
  611. }).then((res) => {
  612. if (res.code == 1) {
  613. if (res.data.items.length > 0) {
  614. this.list.push(...res.data.items)
  615. }
  616. }
  617. })
  618. },
  619. groupOrderList() {
  620. // 团购订单列表
  621. groupOrderList({
  622. status: this.navTypeKey,
  623. page: this.page
  624. }).then((res) => {
  625. if (res.code == 1) {
  626. if (res.data.items.length > 0) {
  627. this.list.push(...res.data.items)
  628. }
  629. }
  630. })
  631. },
  632. ticketOrderList() {
  633. // 票务订单列表
  634. ticketOrderList({
  635. status: this.navTypeKey,
  636. page: this.page
  637. }).then((res) => {
  638. if (res.code == 1) {
  639. if (res.data.items.length > 0) {
  640. this.list.push(...res.data.items)
  641. }
  642. }
  643. })
  644. },
  645. laundryOrderList() {
  646. // 干洗订单列表
  647. laundryOrderList({
  648. status: this.navTypeKey,
  649. page: this.page
  650. }).then((res) => {
  651. if (res.code == 1) {
  652. if (res.data.items.length > 0) {
  653. this.list.push(...res.data.items)
  654. }
  655. }
  656. })
  657. },
  658. takeawayPay(id) {
  659. // 外卖支付
  660. if (this.isAJAX) {
  661. return
  662. }
  663. this.isAJAX = true;
  664. orderPay({
  665. order_id: id
  666. }).then((ret) => {
  667. if (ret.code === 1) {
  668. uni.requestPayment({
  669. provider: "wxpay", //支付类型-固定值
  670. timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  671. nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  672. package: ret.data.wx_pay.package, // 固定值
  673. signType: ret.data.wx_pay.signType, //固定值
  674. paySign: ret.data.wx_pay.paySign, //签名
  675. success: (ren) => {
  676. tools.success("支付成功");
  677. this.isAJAX = false;
  678. this.page = 1;
  679. this.list = [];
  680. this.orderList()
  681. },
  682. fail: (err) => {
  683. this.isAJAX = false;
  684. tools.error("支付失败");
  685. },
  686. });
  687. } else {
  688. this.isAJAX = false;
  689. tools.error("支付失败");
  690. }
  691. })
  692. },
  693. getExpressPay(id) {
  694. // 代取支付
  695. if (this.isAJAX) {
  696. return
  697. }
  698. this.isAJAX = true;
  699. getExpressPay({
  700. order_id: id
  701. }).then((ret) => {
  702. if (ret.code === 1) {
  703. uni.requestPayment({
  704. provider: "wxpay", //支付类型-固定值
  705. timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  706. nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  707. package: ret.data.wx_pay.package, // 固定值
  708. signType: ret.data.wx_pay.signType, //固定值
  709. paySign: ret.data.wx_pay.paySign, //签名
  710. success: (ren) => {
  711. tools.success("支付成功");
  712. this.isAJAX = false;
  713. this.page = 1;
  714. this.list = [];
  715. this.expressOrderList()
  716. },
  717. fail: (err) => {
  718. this.isAJAX = false;
  719. tools.error("支付失败");
  720. },
  721. });
  722. } else {
  723. this.isAJAX = false;
  724. tools.error("支付失败");
  725. }
  726. })
  727. },
  728. groupPay(id) {
  729. // 团购支付
  730. if (this.isAJAX) {
  731. return
  732. }
  733. this.isAJAX = true;
  734. groupPay({
  735. order_id: id
  736. }).then((ret) => {
  737. if (ret.code === 1) {
  738. uni.requestPayment({
  739. provider: "wxpay", //支付类型-固定值
  740. timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  741. nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  742. package: ret.data.wx_pay.package, // 固定值
  743. signType: ret.data.wx_pay.signType, //固定值
  744. paySign: ret.data.wx_pay.paySign, //签名
  745. success: (ren) => {
  746. tools.success("支付成功");
  747. this.isAJAX = false;
  748. this.page = 1;
  749. this.list = [];
  750. this.groupOrderList()
  751. },
  752. fail: (err) => {
  753. this.isAJAX = false;
  754. tools.error("支付失败");
  755. },
  756. });
  757. } else {
  758. this.isAJAX = false;
  759. tools.error("支付失败");
  760. }
  761. })
  762. },
  763. ticketPay(id) {
  764. // 票务支付
  765. if (this.isAJAX) {
  766. return
  767. }
  768. this.isAJAX = true;
  769. ticketPay({
  770. order_id: id
  771. }).then((ret) => {
  772. if (ret.code === 1) {
  773. uni.requestPayment({
  774. provider: "wxpay", //支付类型-固定值
  775. timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  776. nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  777. package: ret.data.wx_pay.package, // 固定值
  778. signType: ret.data.wx_pay.signType, //固定值
  779. paySign: ret.data.wx_pay.paySign, //签名
  780. success: (ren) => {
  781. tools.success("支付成功");
  782. this.isAJAX = false;
  783. this.page = 1;
  784. this.list = [];
  785. this.ticketOrderList()
  786. },
  787. fail: (err) => {
  788. this.isAJAX = false;
  789. tools.error("支付失败");
  790. },
  791. });
  792. } else {
  793. this.isAJAX = false;
  794. tools.error("支付失败");
  795. }
  796. })
  797. },
  798. laundryPay(id) {
  799. // 干洗支付
  800. if (this.isAJAX) {
  801. return
  802. }
  803. this.isAJAX = true;
  804. laundryPay({
  805. order_id: id
  806. }).then((ret) => {
  807. if (ret.code === 1) {
  808. uni.requestPayment({
  809. provider: "wxpay", //支付类型-固定值
  810. timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  811. nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  812. package: ret.data.wx_pay.package, // 固定值
  813. signType: ret.data.wx_pay.signType, //固定值
  814. paySign: ret.data.wx_pay.paySign, //签名
  815. success: (ren) => {
  816. tools.success("支付成功");
  817. this.isAJAX = false;
  818. this.page = 1;
  819. this.list = [];
  820. this.laundryOrderList()
  821. },
  822. fail: (err) => {
  823. this.isAJAX = false;
  824. tools.error("支付失败");
  825. },
  826. });
  827. } else {
  828. this.isAJAX = false;
  829. tools.error("支付失败");
  830. }
  831. })
  832. }
  833. },
  834. }
  835. </script>
  836. <style lang="scss" scoped>
  837. .nav-b {
  838. position: relative;
  839. z-index: -1 !important;
  840. }
  841. .nav-box {
  842. padding: 26rpx 44rpx;
  843. overflow-x: scroll;
  844. .nav-item {
  845. margin-right: 76rpx;
  846. white-space: nowrap;
  847. position: relative;
  848. .nav-item-x {
  849. position: absolute;
  850. width: 48rpx;
  851. height: 6rpx;
  852. border-radius: 20rpx;
  853. background-color: #41ABF5;
  854. left: 12rpx;
  855. bottom: -10rpx;
  856. }
  857. }
  858. }
  859. .nav-type-box {
  860. width: 100%;
  861. white-space: nowrap;
  862. }
  863. .nav-type-item {
  864. width: 144rpx;
  865. height: 64rpx;
  866. line-height: 64rpx;
  867. margin: 0 24rpx 0 0;
  868. border-radius: 200rpx;
  869. display: inline-block;
  870. }
  871. .nav-type-item:last-child {
  872. margin: 0;
  873. }
  874. .list-box {
  875. padding: 20rpx;
  876. box-sizing: border-box;
  877. }
  878. .shops-img {
  879. width: 48rpx;
  880. height: 48rpx;
  881. margin: 0 8rpx 0 0;
  882. border-radius: 50%;
  883. }
  884. .shops-name {
  885. max-width: 452rpx;
  886. margin: 0 8rpx 0 0;
  887. }
  888. .icons {
  889. width: 32rpx;
  890. height: 32rpx;
  891. }
  892. .goods-box {
  893. max-width: 506rpx;
  894. height: auto;
  895. }
  896. .goods-num {
  897. width: 24rpx;
  898. height: auto;
  899. }
  900. .goods-img {
  901. width: 144rpx;
  902. height: 144rpx;
  903. border-radius: 12rpx;
  904. margin: 0 16rpx 0 0;
  905. }
  906. .goods-two {
  907. overflow-x: scroll;
  908. overflow: auto;
  909. }
  910. .goods-two-name {
  911. width: 144rpx;
  912. }
  913. .item-but {
  914. width: 160rpx;
  915. height: 64rpx;
  916. line-height: 64rpx;
  917. text-align: center;
  918. border-radius: 200rpx;
  919. }
  920. .but-class-one {
  921. background: linear-gradient(225deg, #41ABF5 0%, #5BD8FB 100%);
  922. color: #fff;
  923. }
  924. .but-class-two {
  925. background: #fff;
  926. border: 2rpx solid #CCCCCC;
  927. color: #333;
  928. }
  929. </style>