index.vue 28 KB

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