index.vue 22 KB

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