index.vue 24 KB

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