index.vue 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124
  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. if (this.isAJAX) {
  804. return
  805. }
  806. this.isAJAX = true;
  807. orderPay({
  808. order_id: id
  809. }).then((ret) => {
  810. if (ret.code === 1) {
  811. uni.requestPayment({
  812. provider: "wxpay", //支付类型-固定值
  813. timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  814. nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  815. package: ret.data.wx_pay.package, // 固定值
  816. signType: ret.data.wx_pay.signType, //固定值
  817. paySign: ret.data.wx_pay.paySign, //签名
  818. success: (ren) => {
  819. tools.success("支付成功");
  820. this.isAJAX = false;
  821. this.page = 1;
  822. this.list = [];
  823. this.orderList()
  824. },
  825. fail: (err) => {
  826. this.isAJAX = false;
  827. tools.error("支付失败");
  828. },
  829. });
  830. } else {
  831. this.isAJAX = false;
  832. tools.error("支付失败");
  833. }
  834. })
  835. },
  836. getExpressPay(id) {
  837. // 代取支付
  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. if (this.isAJAX) {
  874. return
  875. }
  876. this.isAJAX = true;
  877. groupPay({
  878. order_id: id
  879. }).then((ret) => {
  880. if (ret.code === 1) {
  881. uni.requestPayment({
  882. provider: "wxpay", //支付类型-固定值
  883. timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  884. nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  885. package: ret.data.wx_pay.package, // 固定值
  886. signType: ret.data.wx_pay.signType, //固定值
  887. paySign: ret.data.wx_pay.paySign, //签名
  888. success: (ren) => {
  889. tools.success("支付成功");
  890. this.isAJAX = false;
  891. this.page = 1;
  892. this.list = [];
  893. this.groupOrderList()
  894. },
  895. fail: (err) => {
  896. this.isAJAX = false;
  897. tools.error("支付失败");
  898. },
  899. });
  900. } else {
  901. this.isAJAX = false;
  902. tools.error("支付失败");
  903. }
  904. })
  905. },
  906. ticketPay(id) {
  907. // 票务支付
  908. if (this.isAJAX) {
  909. return
  910. }
  911. this.isAJAX = true;
  912. ticketPay({
  913. order_id: id
  914. }).then((ret) => {
  915. if (ret.code === 1) {
  916. uni.requestPayment({
  917. provider: "wxpay", //支付类型-固定值
  918. timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  919. nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  920. package: ret.data.wx_pay.package, // 固定值
  921. signType: ret.data.wx_pay.signType, //固定值
  922. paySign: ret.data.wx_pay.paySign, //签名
  923. success: (ren) => {
  924. tools.success("支付成功");
  925. this.isAJAX = false;
  926. this.page = 1;
  927. this.list = [];
  928. this.ticketOrderList()
  929. },
  930. fail: (err) => {
  931. this.isAJAX = false;
  932. tools.error("支付失败");
  933. },
  934. });
  935. } else {
  936. this.isAJAX = false;
  937. tools.error("支付失败");
  938. }
  939. })
  940. },
  941. laundryPay(id) {
  942. // 干洗支付
  943. if (this.isAJAX) {
  944. return
  945. }
  946. this.isAJAX = true;
  947. laundryPay({
  948. order_id: id
  949. }).then((ret) => {
  950. if (ret.code === 1) {
  951. uni.requestPayment({
  952. provider: "wxpay", //支付类型-固定值
  953. timeStamp: ret.data.wx_pay.timeStamp + "", // 时间戳(单位:秒)
  954. nonceStr: ret.data.wx_pay.nonceStr, // 随机字符串
  955. package: ret.data.wx_pay.package, // 固定值
  956. signType: ret.data.wx_pay.signType, //固定值
  957. paySign: ret.data.wx_pay.paySign, //签名
  958. success: (ren) => {
  959. tools.success("支付成功");
  960. this.isAJAX = false;
  961. this.page = 1;
  962. this.list = [];
  963. this.laundryOrderList()
  964. },
  965. fail: (err) => {
  966. this.isAJAX = false;
  967. tools.error("支付失败");
  968. },
  969. });
  970. } else {
  971. this.isAJAX = false;
  972. tools.error("支付失败");
  973. }
  974. })
  975. }
  976. },
  977. }
  978. </script>
  979. <style lang="scss" scoped>
  980. .pop-b {
  981. height: 80rpx;
  982. line-height: 80rpx;
  983. border-radius: 20rpx;
  984. // border: 1rpx solid #F9F9F9;
  985. }
  986. .popup-reason-box {
  987. width: 100%;
  988. height: 45vh;
  989. overflow: auto;
  990. border-radius: 20rpx 20rpx 0 0;
  991. background: #fff;
  992. padding: 24rpx 0 0;
  993. box-sizing: border-box;
  994. }
  995. .picker-view {
  996. width: 100%;
  997. // height: 70%;
  998. }
  999. .picker-view-item {
  1000. // height: 90rpx;
  1001. line-height: 68rpx;
  1002. text-align: center;
  1003. background: #F5F5F5;
  1004. }
  1005. .nav-b {
  1006. position: relative;
  1007. z-index: -1 !important;
  1008. }
  1009. .nav-box {
  1010. padding: 26rpx 44rpx;
  1011. overflow-x: scroll;
  1012. .nav-item {
  1013. margin-right: 76rpx;
  1014. white-space: nowrap;
  1015. position: relative;
  1016. .nav-item-x {
  1017. position: absolute;
  1018. width: 48rpx;
  1019. height: 6rpx;
  1020. border-radius: 20rpx;
  1021. background-color: #41ABF5;
  1022. left: 12rpx;
  1023. bottom: -10rpx;
  1024. }
  1025. }
  1026. }
  1027. .nav-type-box {
  1028. width: 100%;
  1029. white-space: nowrap;
  1030. }
  1031. .nav-type-item {
  1032. width: 144rpx;
  1033. height: 64rpx;
  1034. line-height: 64rpx;
  1035. margin: 0 24rpx 0 0;
  1036. border-radius: 200rpx;
  1037. display: inline-block;
  1038. }
  1039. .nav-type-item:last-child {
  1040. margin: 0;
  1041. }
  1042. .list-box {
  1043. padding: 20rpx;
  1044. box-sizing: border-box;
  1045. }
  1046. .shops-img {
  1047. width: 48rpx;
  1048. height: 48rpx;
  1049. margin: 0 8rpx 0 0;
  1050. border-radius: 50%;
  1051. }
  1052. .shops-name {
  1053. max-width: 452rpx;
  1054. margin: 0 8rpx 0 0;
  1055. }
  1056. .icons {
  1057. width: 32rpx;
  1058. height: 32rpx;
  1059. }
  1060. .goods-box {
  1061. max-width: 506rpx;
  1062. height: auto;
  1063. }
  1064. .goods-num {
  1065. width: 24rpx;
  1066. height: auto;
  1067. }
  1068. .goods-img {
  1069. width: 144rpx;
  1070. height: 144rpx;
  1071. border-radius: 12rpx;
  1072. margin: 0 16rpx 0 0;
  1073. }
  1074. .goods-two {
  1075. overflow-x: scroll;
  1076. overflow: auto;
  1077. }
  1078. .goods-two-name {
  1079. width: 144rpx;
  1080. }
  1081. .item-but {
  1082. width: 160rpx;
  1083. height: 64rpx;
  1084. line-height: 64rpx;
  1085. text-align: center;
  1086. border-radius: 200rpx;
  1087. }
  1088. .but-class-one {
  1089. background: linear-gradient(225deg, #41ABF5 0%, #5BD8FB 100%);
  1090. color: #fff;
  1091. }
  1092. .but-class-two {
  1093. background: #fff;
  1094. border: 2rpx solid #CCCCCC;
  1095. color: #333;
  1096. }
  1097. </style>