index.vue 29 KB

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