index.vue 28 KB

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