index.vue 30 KB

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