index.vue 30 KB

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