index.vue 29 KB

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