index.vue 24 KB

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