serve.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023
  1. <template>
  2. <view :style="colorStyle">
  3. <view class="my-order">
  4. <view class="nav acea-row row-around" style="position: fixed;top: 0;">
  5. <view class="item" :class="orderStatus === 0 ? 'on' : ''" @click="statusClick(0)">
  6. <view>待服务</view>
  7. <!-- <view class="num">{{ orderData.order_count || 0 }}</view> -->
  8. </view>
  9. <!-- <view class="item" :class="orderStatus === 1 ? 'on' : ''" @click="statusClick(1)">
  10. <view>进行中</view>
  11. <view class="num">{{ orderData.unpaid_count || 0 }}</view>
  12. </view> -->
  13. <view class="item" :class="orderStatus == 2 ? 'on' : ''" @click="statusClick(2)">
  14. <view>已完成</view>
  15. <!-- <view class="num">{{ orderData.unshipped_count || 0 }}</view> -->
  16. </view>
  17. <view class="item" :class="orderStatus == -1 ? 'on' : ''" @click="statusClick(-1)">
  18. <view>退款</view>
  19. <!-- <view class="num ">{{ orderData.received_count || 0 }}</view> -->
  20. </view>
  21. </view>
  22. <view class="nav">
  23. </view>
  24. <Loading :loaded="loaded" :loading="loading"></Loading>
  25. <view class="list">
  26. <view class="item" v-for="(item, index) in orderList" :key="index" v-if="showOrder(item)">
  27. <view >
  28. <!-- <view @click="goOrderDetails(item.order_id)"> -->
  29. <view class="title acea-row row-between-wrapper">
  30. <view class="acea-row row-middle">
  31. 订单ID:{{item.order_id}}
  32. </view>
  33. <!-- <view v-if="item._status._type == 9" class="font-color">线下付款,未支付</view>
  34. <view v-else-if="item._status._type == 0" class="font-color">待付款</view>
  35. <view v-else-if="item._status._type == 1 && (item.shipping_type == 1 || item.shipping_type == 3)" class="font-color">待发货
  36. <text v-if="item.refund.length">{{item.is_all_refund?',退款中':',部分退款中'}}</text>
  37. </view>
  38. <view v-else-if="item._status._type == 1 && (item.shipping_type == 2 || item.shipping_type == 4)" class="font-color">
  39. {{item.shipping_type == 2?'待核销':'待收货'}}
  40. <text v-if="item.refund.length">{{item.is_all_refund?',退款中':',部分退款中'}}</text>
  41. </view>
  42. <view v-else-if="item._status._type == 2" class="font-color">待收货
  43. <text v-if="item.refund.length">{{item.is_all_refund?',退款中':',部分退款中'}}</text>
  44. </view>
  45. <view v-else-if="item._status._type == 3" class="font-color">待评价
  46. <text v-if="item.refund.length">{{item.is_all_refund?',退款中':',部分退款中'}}</text>
  47. </view>
  48. <view v-else-if="item._status._type == 4" class="font-color">已完成
  49. <text v-if="item.refund.length">{{item.is_all_refund?',退款中':',部分退款中'}}</text>
  50. </view>
  51. <view v-else-if="item._status._type == -2" class="font-color">已退款
  52. </view>
  53. <view v-else-if="item._status._type == 5 && item.status == 0" class="font-color">待核销
  54. <text v-if="item.refund.length">{{item.is_all_refund?',退款中':',部分退款中'}}</text>
  55. </view>
  56. <view v-else-if="item._status._type == 5 && item.status == 5" class="font-color">部分核销
  57. <text v-if="item.refund.length">{{item.is_all_refund?',退款中':',部分退款中'}}</text>
  58. </view>
  59. <view v-else-if="item._status._type == -1" class="font-color">申请退款
  60. </view> -->
  61. </view>
  62. <view class="item-info acea-row row-between row-top" v-for="(items, index) in item.info"
  63. :key="index">
  64. <view class="pictrue">
  65. <image :src="items.slider_image"></image>
  66. </view>
  67. <view class="text acea-row row-between">
  68. <view class="name line2">{{ items.store_name }}</view>
  69. <view class="money">
  70. <view>¥{{ items.pay_price }}</view>
  71. <view>x1</view>
  72. <!-- <view v-if="items.refund_num && item._status._type != -2" class="return">{{ items.refund_num }}件退款中</view> -->
  73. </view>
  74. </view>
  75. </view>
  76. <view class="totalPrice showstore">
  77. <view class="">
  78. 下单时间: {{ showTime(item.add_time) }}
  79. </view>
  80. <view class="">
  81. 预约时间: {{ showTime(item.reservation_time) }}
  82. </view>
  83. </view>
  84. <view class="address acea-row row-between-wrapper" style="padding: 10rpx 30rpx; flex-wrap: nowrap;">
  85. <view class="addressCon">
  86. <view class='name acea-row row-middle'>
  87. <view class="nameCon line1 on">{{item.store.name || ''}}</view>
  88. </view>
  89. <view>
  90. {{item.store.detailed_address || ''}}
  91. </view>
  92. </view>
  93. <view style="flex-shrink: 0;" class="icon acea-row row-middle">
  94. <view class="iconfont icon-dianhua" @click.stop="call(item.store.phone)"></view>
  95. <view class="iconfont icon-dingwei2" @click.stop="showMaoLocation(item.store)"></view>
  96. </view>
  97. </view>
  98. <view class="totalPrice">
  99. 共{{ item.info.length || 0 }}件商品,总金额
  100. <text class="money">¥{{ showTolPrice(item.info) }}</text>
  101. </view>
  102. </view>
  103. <view class="bottom acea-row row-right row-middle" v-if="item.status != 2">
  104. <view class="bnt cancelBnt" v-if="item.status == 0 || item.status==1"
  105. @click="cancelOrder(index, item.id)">取消订单</view>
  106. <view class="bnt cancelBnt" v-if="item.status == -1 && (item.refund_status == 1 || item.refund_status == 2 || item.refund_status == 3)">退款审核中</view>
  107. <view class="bnt cancelBnt" v-if="item.status == -1 && (item.refund_status == 4 || item.refund_status == 5)">退款完成</view>
  108. <view class="bnt cancelBnt" v-if="item.status == -1 && item.refund_status == -1 ">退款已拒绝</view>
  109. </view>
  110. <view class="bottom acea-row row-right row-middle" v-if="item.status == 2">
  111. <view class="bnt cancelBnt" v-if="item.reward && item.reward.id">已打赏</view>
  112. <view class="bnt cancelBnt showbtn" v-else @click="das(item)">打赏</view>
  113. <view class="bnt cancelBnt " v-if="item.complaint && item.complaint.id" >已投诉</view>
  114. <view class="bnt cancelBnt " v-else @click="ts(item)">投诉</view>
  115. </view>
  116. </view>
  117. </view>
  118. <view class="loadingicon acea-row row-center-wrapper" v-if="orderList.length > 0">
  119. <text class="loading iconfont icon-jiazai" :hidden="loading == false"></text>
  120. {{ loadTitle }}
  121. </view>
  122. <view v-if="orderList.length == 0 && !loading">
  123. <emptyPage title="暂无订单信息~"></emptyPage>
  124. </view>
  125. </view>
  126. <home v-if="navigation"></home>
  127. <payment :payMode="payMode" :pay_close="pay_close" @onChangeFun="onChangeFun" :order_id="pay_order_id"
  128. :totalPrice="totalPrice" :payTT="true" @onChooseType="onChooseType"></payment>
  129. <!-- #ifdef MP -->
  130. <!-- <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize> -->
  131. <!-- #endif -->
  132. <uni-popup type="center" ref="dspop">
  133. <view class="ds-wrap">
  134. <view class="tit">
  135. 多少都是您的心意
  136. </view>
  137. <input type="number" v-model="dsPrice" placeholder="请输入任意打赏金额"/>
  138. <view class="btn-wrap">
  139. <view class="btn" @click="closeDs">
  140. 取消
  141. </view>
  142. <view class="btn s-btn" @click="confirmDs">
  143. 确定
  144. </view>
  145. </view>
  146. </view>
  147. </uni-popup>
  148. <uni-popup type="center" ref="tspop">
  149. <view class="ds-wrap">
  150. <view class="tit">
  151. 投诉
  152. </view>
  153. <input type="text" v-model="tsyy" placeholder="请输入投诉原因"/>
  154. <view class="btn-wrap">
  155. <view class="btn" @click="closeTs">
  156. 取消
  157. </view>
  158. <view class="btn s-btn" @click="confirmTs">
  159. 确定
  160. </view>
  161. </view>
  162. </view>
  163. </uni-popup>
  164. </view>
  165. </template>
  166. <script>
  167. import {
  168. getOrderList,
  169. orderData,
  170. orderCancel,
  171. orderDel,
  172. orderPay,
  173. SqRefund,
  174. ds,
  175. ts
  176. } from '@/api/order.js';
  177. import {
  178. getUserInfo,
  179. getServeOrder
  180. } from '@/api/user.js';
  181. import {
  182. openOrderSubscribe
  183. } from '@/utils/SubscribeMessage.js';
  184. import home from '@/components/home';
  185. import payment from '@/components/payment';
  186. import {
  187. toLogin
  188. } from '@/libs/login.js';
  189. import {
  190. mapGetters
  191. } from 'vuex';
  192. import emptyPage from '@/components/emptyPage.vue';
  193. import colors from '@/mixins/color.js';
  194. import Loading from '@/components/Loading/index.vue'
  195. export default {
  196. components: {
  197. Loading,
  198. payment,
  199. home,
  200. emptyPage
  201. },
  202. mixins: [colors],
  203. data() {
  204. return {
  205. userInfo: {},
  206. itemList: ['不想买了', '信息填错了', '买错商品了', '卖家缺货'],
  207. loaded: false,
  208. loading: false, //是否加载中
  209. loadend: false, //是否加载完毕
  210. loadTitle: '加载更多', //提示语
  211. orderList: [], //订单数组
  212. orderData: {}, //订单详细统计
  213. orderStatus: 0, //订单状态
  214. page: 1,
  215. limit: 20,
  216. payMode: [{
  217. name: '微信支付',
  218. icon: 'icon-weixinzhifu',
  219. value: 'weixin',
  220. title: '使用微信快捷支付',
  221. payStatus: true
  222. },
  223. {
  224. name: '支付宝支付',
  225. icon: 'icon-zhifubao',
  226. value: 'alipay',
  227. title: '使用线上支付宝支付',
  228. payStatus: false
  229. },
  230. {
  231. name: '余额支付',
  232. icon: 'icon-yuezhifu',
  233. value: 'yue',
  234. title: '当前可用余额:',
  235. number: 0,
  236. payStatus: true
  237. }
  238. ],
  239. pay_close: false,
  240. pay_order_id: '',
  241. totalPrice: '0',
  242. isAuto: false, //没有授权的不会自动授权
  243. isShowAuth: false ,//是否隐藏授权
  244. dsItem: {},
  245. dsPrice: '',
  246. tsItem: {},
  247. tsyy: ''
  248. };
  249. },
  250. computed: mapGetters(['isLogin']),
  251. onShow() {
  252. uni.removeStorageSync('form_type_cart');
  253. this.page = 1;
  254. this.loadend = false;
  255. this.orderList = [];
  256. if (this.isLogin) {
  257. this.getFun();
  258. } else {
  259. toLogin()
  260. }
  261. },
  262. /**
  263. * 生命周期函数--监听页面加载
  264. */
  265. onLoad(options) {
  266. if (options.status) this.orderStatus = (options.status == undefined && options.status != 0) ? '' : parseInt(
  267. options.status);
  268. },
  269. methods: {
  270. ts(item) {
  271. },
  272. onChooseType(payType) {
  273. console.log(payType,'payType')
  274. let that = this;
  275. let dsData = {
  276. member_id: that.dsItem.work_member_id,
  277. pay_type: payType,
  278. pay_price: that.dsPrice,
  279. // #ifdef MP
  280. 'from': 'routine',
  281. // #endif
  282. // #ifdef H5
  283. 'from': this.$wechat.isWeixin() ? 'weixin' : 'weixinh5',
  284. // #endif
  285. subscribe_id: that.dsItem.order_id
  286. }
  287. uni.showLoading({
  288. title: '支付中'
  289. });
  290. try{
  291. ds(dsData).then(res => {
  292. let jsConfig = res.data.result.jsConfig;
  293. switch (payType) {
  294. case 'weixin':
  295. if (res.data.result === undefined) return that.$util.Tips({
  296. title: '缺少支付参数'
  297. });
  298. let mp_pay_name=''
  299. if(uni.requestOrderPayment){
  300. mp_pay_name='requestOrderPayment'
  301. }else{
  302. mp_pay_name='requestPayment'
  303. }
  304. uni[mp_pay_name]({
  305. timeStamp: jsConfig.timestamp,
  306. nonceStr: jsConfig.nonceStr,
  307. package: jsConfig.package,
  308. signType: jsConfig.signType,
  309. paySign: jsConfig.paySign,
  310. success: function(res) {
  311. uni.hideLoading();
  312. return that.$util.Tips({
  313. title: res.msg,
  314. icon: 'success'
  315. }, () => {
  316. that.onChangeFun({
  317. action: 'pay_complete'
  318. })
  319. });
  320. },
  321. fail: function(e) {
  322. uni.hideLoading();
  323. return that.$util.Tips({
  324. title: '取消支付'
  325. }, () => {
  326. that.onChangeFun({
  327. action: 'pay_fail'
  328. })
  329. });
  330. },
  331. complete: function(e) {
  332. uni.hideLoading();
  333. if (e.errMsg == 'requestPayment:cancel') return that.$util
  334. .Tips({
  335. title: '取消支付'
  336. }, () => {
  337. that.onChangeFun({
  338. action: 'pay_fail'
  339. })
  340. });
  341. },
  342. });
  343. break;
  344. case 'yue':
  345. uni.hideLoading();
  346. return that.$util.Tips({
  347. title: res.msg,
  348. icon: 'success'
  349. }, () => {
  350. that.onChangeFun({
  351. action: 'pay_complete'
  352. })
  353. });
  354. break;
  355. }
  356. })
  357. }catch(e){
  358. console.log('eer',e)
  359. //TODO handle the exception
  360. }
  361. // console.log(that.dsItem,dsData,'dsData')
  362. },
  363. confirmDs() {
  364. let that = this;
  365. if(!that.dsPrice) {
  366. return that.$util.Tips({
  367. title: '请输入打赏金额'
  368. });
  369. }
  370. that.totalPrice = that.dsPrice + ''
  371. console.log(that.totalPrice ,'that.totalPrice ')
  372. that.$refs.dspop.close();
  373. that.goPay()
  374. },
  375. confirmTs() {
  376. let that = this;
  377. if(!that.tsyy) {
  378. return that.$util.Tips({
  379. title: '请输入投诉原因'
  380. });
  381. }
  382. ts({
  383. reason:that.tsyy,
  384. order_id: that.tsItem.order_id,
  385. member_id: that.tsItem.work_member_id,
  386. }).then(res => {
  387. that.$refs.tspop.close();
  388. that.$util.Tips({
  389. title: '投诉已提交'
  390. })
  391. }).catch(err=> {
  392. that.$util.Tips({
  393. title: err.msg
  394. })
  395. })
  396. // that.goTs()
  397. },
  398. closeDs() {
  399. this.$refs.dspop.close();
  400. this.dsItem = {};
  401. this.dsPrice = 0;
  402. },
  403. closeTs() {
  404. this.$refs.tspop.close();
  405. this.tsItem = {};
  406. this.tsyy = '';
  407. },
  408. das(row) {
  409. this.dsItem = row;
  410. this.$refs.dspop.open();
  411. },
  412. ts(row) {
  413. this.tsItem = row;
  414. this.$refs.tspop.open();
  415. },
  416. showOrder(item) {
  417. return item.info[0].paid != 0
  418. },
  419. showTime(time) {
  420. var date = new Date(time * 1000);
  421. var year = date.getFullYear(); // 获取年份
  422. var month = ("0" + (date.getMonth() + 1)).slice(-2); // 获取月份(注意月份从 0 开始,需要加 1)
  423. var day = ("0" + date.getDate()).slice(-2); // 获取日期
  424. var hours = ("0" + date.getHours()).slice(-2); // 获取小时
  425. var minutes = ("0" + date.getMinutes()).slice(-2); // 获取分钟
  426. var seconds = ("0" + date.getSeconds()).slice(-2); // 获取秒钟
  427. var dateString = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds; // 自定义时间格式
  428. return dateString
  429. },
  430. call(phone) {
  431. uni.makePhoneCall({
  432. phoneNumber: phone,
  433. });
  434. },
  435. showMaoLocation(e) {
  436. let self = this;
  437. // #ifdef H5
  438. if (self.$wechat.isWeixin()) {
  439. self.$wechat.seeLocation({
  440. latitude: Number(e.latitude),
  441. longitude: Number(e.longitude),
  442. name: e.name,
  443. scale: 13,
  444. address: `${e.address}-${e.detailed_address}`,
  445. }).then(res => {})
  446. } else {
  447. // #endif
  448. uni.openLocation({
  449. latitude: Number(e.latitude),
  450. longitude: Number(e.longitude),
  451. name: e.name,
  452. address: `${e.address}-${e.detailed_address}`,
  453. success: function() {
  454. Number
  455. }
  456. });
  457. // #ifdef H5
  458. }
  459. // #endif
  460. },
  461. showTolPrice(list) {
  462. let price = 0;
  463. list.forEach(item => {
  464. price += item.pay_price * 1
  465. })
  466. return price.toFixed(2)
  467. },
  468. getFun() {
  469. // this.getOrderData();
  470. this.getUserInfo();
  471. },
  472. onLoadFun() {
  473. this.getFun();
  474. this.isShowAuth = false;
  475. },
  476. // 授权关闭
  477. authColse: function(e) {
  478. this.isShowAuth = e;
  479. },
  480. /**
  481. * 事件回调
  482. *
  483. */
  484. onChangeFun: function(e) {
  485. let opt = e;
  486. let action = opt.action || null;
  487. let value = opt.value != undefined ? opt.value : null;
  488. action && this[action] && this[action](value);
  489. },
  490. /**
  491. * 获取用户信息
  492. *
  493. */
  494. getUserInfo: function() {
  495. let that = this;
  496. getUserInfo().then(res => {
  497. that.userInfo = res.data
  498. that.getOrderList();
  499. that.payMode[2].number = res.data.now_money;
  500. that.$set(that, 'payMode', that.payMode);
  501. });
  502. },
  503. /**
  504. * 关闭支付组件
  505. *
  506. */
  507. payClose: function() {
  508. this.pay_close = false;
  509. },
  510. /**
  511. * 获取订单统计数据
  512. *
  513. */
  514. getOrderData: function() {
  515. let that = this;
  516. orderData().then(res => {
  517. that.$set(that, 'orderData', res.data);
  518. that.payMode.map(item => {
  519. if (item.value == 'weixin') {
  520. item.payStatus = res.data.pay_weixin_open ? true : false;
  521. }
  522. if (item.value == 'alipay') {
  523. item.payStatus = res.data.ali_pay_status ? true : false;
  524. }
  525. if (item.value == 'yue') {
  526. item.payStatus = res.data.yue_pay_status == 1 ? true : false;
  527. }
  528. });
  529. //#ifdef MP
  530. this.payMode[1].payStatus = false;
  531. //#endif
  532. });
  533. },
  534. /**
  535. * 取消订单
  536. *
  537. */
  538. cancelOrder: function(index, order_id) {
  539. let that = this;
  540. if (!order_id)
  541. return that.$util.Tips({
  542. title: '缺少订单号无法取消订单'
  543. });
  544. // uni.showModal({
  545. // title: '取消订单',
  546. // content: '您是否确认取消此订单',
  547. // confirmText: '确认',
  548. // cancelText: '再想想',
  549. // success: (res) => {
  550. // if (res.confirm) {
  551. // orderCancel(order_id)
  552. // .then(res => {
  553. // return that.$util.Tips({
  554. // title: res.msg,
  555. // icon: 'success'
  556. // },
  557. // function() {
  558. // that.orderList.splice(index, 1);
  559. // that.$set(that, 'orderList', that.orderList);
  560. // that.$set(that.orderData, 'unpaid_count', that.orderData.unpaid_count - 1);
  561. // that.getOrderData();
  562. // }
  563. // );
  564. // })
  565. // .catch(err => {
  566. // return that.$util.Tips({
  567. // title: err
  568. // });
  569. // });
  570. // }
  571. // }
  572. // })
  573. uni.showActionSheet({
  574. itemList: that.itemList,
  575. success(e) {
  576. console.log(e)
  577. console.log(that.itemList[e.tapIndex])
  578. SqRefund({
  579. id: order_id,
  580. refund_reason: that.itemList[e.tapIndex]
  581. }).then(res => {
  582. return that.$util.Tips({
  583. title: res.msg,
  584. icon: 'success'
  585. },
  586. function() {
  587. that.orderList.splice(index, 1);
  588. that.$set(that, 'orderList', that.orderList);
  589. that.$set(that.orderData, 'unpaid_count', that.orderData
  590. .unpaid_count - 1);
  591. that.getOrderData();
  592. }
  593. );
  594. }).catch(err => {
  595. return that.$util.Tips({
  596. title: err
  597. });
  598. });
  599. }
  600. })
  601. },
  602. /**
  603. * 打开支付组件
  604. *
  605. */
  606. goPay: function(pay_price, order_id) {
  607. this.$set(this, 'pay_close', true);
  608. // this.$set(this, 'pay_order_id', order_id);
  609. // this.$set(this, 'totalPrice', pay_price);
  610. },
  611. /**
  612. * 支付成功回调
  613. *
  614. */
  615. pay_complete: function() {
  616. this.$set(this, 'pay_close', false);
  617. // this.page = 1;
  618. this.getOrderList()
  619. // this.loadend = false;
  620. // // this.page = 1;
  621. // this.$set(this, 'orderList', []);
  622. // this.pay_close = false;
  623. // uni.navigateTo({
  624. // url: '/pages/goods/order_pay_status/index?order_id=' + this.pay_order_id +
  625. // '&msg=支付成功&type=3&totalPrice=' + this.totalPrice
  626. // })
  627. // this.pay_order_id = '';
  628. // this.getOrderData();
  629. // this.getOrderList();
  630. },
  631. /**
  632. * 支付失败回调
  633. *
  634. */
  635. pay_fail: function() {
  636. this.pay_close = false;
  637. this.pay_order_id = '';
  638. },
  639. /**
  640. * 去订单详情
  641. */
  642. goOrderDetails: function(order_id) {
  643. if (!order_id)
  644. return that.$util.Tips({
  645. title: '缺少订单号无法查看订单详情'
  646. });
  647. // #ifdef MP
  648. uni.showLoading({
  649. title: '正在加载'
  650. });
  651. openOrderSubscribe()
  652. .then(() => {
  653. uni.hideLoading();
  654. uni.navigateTo({
  655. url: '/pages/goods/order_details/index?order_id=' + order_id
  656. })
  657. })
  658. .catch(err => {
  659. uni.hideLoading();
  660. });
  661. // #endif
  662. // #ifndef MP
  663. uni.navigateTo({
  664. url: '/pages/goods/order_details/index?order_id=' + order_id
  665. });
  666. // #endif
  667. },
  668. /**
  669. * 切换类型
  670. */
  671. statusClick: function(status) {
  672. if (this.loading) return
  673. if (status === this.orderStatus) return;
  674. this.orderStatus = status;
  675. this.loadend = false;
  676. this.page = 1;
  677. this.$set(this, 'orderList', []);
  678. this.getOrderList();
  679. },
  680. /**
  681. * 获取订单列表
  682. */
  683. getOrderList: function() {
  684. let that = this;
  685. if (that.loadend) return;
  686. if (that.loading) return;
  687. that.loading = true;
  688. that.loadTitle = '加载更多';
  689. getServeOrder({
  690. uid: that.userInfo.uid,
  691. status: that.orderStatus,
  692. page: that.page,
  693. limit: that.limit
  694. })
  695. .then(res => {
  696. let list = res.data.list || [];
  697. console.log(list, 'list')
  698. if (that.orderStatus == 0) {
  699. that.orderData.order_count = res.data.count;
  700. } else if (that.orderStatus == 1) {
  701. that.orderData.unpaid_count = res.data.count;
  702. } else if (that.orderStatus == 2) {
  703. that.orderData.unshipped_count = res.data.count;
  704. } else if (that.orderStatus == 3) {
  705. that.orderData.received_count = res.data.count;
  706. }
  707. let loadend = list.length < that.limit;
  708. that.orderList = that.$util.SplitArray(list, that.orderList);
  709. that.$set(that, 'orderList', that.orderList);
  710. that.loadend = loadend;
  711. that.loading = false;
  712. that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  713. that.page = that.page + 1;
  714. })
  715. .catch(err => {
  716. that.loading = false;
  717. that.loadTitle = '加载更多';
  718. });
  719. },
  720. /**
  721. * 删除订单
  722. */
  723. delOrder: function(order_id, index) {
  724. let that = this;
  725. uni.showModal({
  726. title: '删除订单',
  727. content: '确定删除该订单',
  728. success: function(res) {
  729. if (res.confirm) {
  730. orderDel(order_id)
  731. .then(res => {
  732. that.orderList.splice(index, 1);
  733. that.$set(that, 'orderList', that.orderList);
  734. that.$set(that.orderData, 'unpaid_count', that
  735. .orderData.unpaid_count - 1);
  736. that.getOrderData();
  737. return that.$util.Tips({
  738. title: '删除成功',
  739. icon: 'success'
  740. });
  741. })
  742. .catch(err => {
  743. return that.$util.Tips({
  744. title: err
  745. });
  746. });
  747. } else if (res.cancel) {
  748. return that.$util.Tips({
  749. title: '已取消'
  750. });
  751. }
  752. }
  753. });
  754. }
  755. },
  756. onReachBottom: function() {
  757. this.getOrderList();
  758. }
  759. };
  760. </script>
  761. <style scoped lang="scss">
  762. .my-order .header {
  763. height: 260rpx;
  764. padding: 0 30rpx;
  765. }
  766. .my-order .header .picTxt {
  767. height: 190rpx;
  768. }
  769. .my-order .header .picTxt .text {
  770. color: rgba(255, 255, 255, 0.8);
  771. font-size: 26rpx;
  772. font-family: 'Guildford Pro';
  773. }
  774. .my-order .header .picTxt .text .name {
  775. font-size: 34rpx;
  776. font-weight: bold;
  777. color: #fff;
  778. margin-bottom: 20rpx;
  779. }
  780. .my-order .header .picTxt .pictrue {
  781. width: 122rpx;
  782. height: 109rpx;
  783. }
  784. .my-order .header .picTxt .pictrue image {
  785. width: 100%;
  786. height: 100%;
  787. }
  788. .my-order .nav {
  789. background-color: #fff;
  790. width: 750rpx;
  791. height: 90rpx;
  792. border-radius: 6rpx;
  793. margin: 0 auto;
  794. }
  795. .my-order .nav .item {
  796. text-align: center;
  797. font-size: 26rpx;
  798. color: #282828;
  799. padding: 27rpx 0;
  800. border-bottom: 5rpx solid transparent;
  801. }
  802. .my-order .nav .item.on {
  803. /* #ifdef H5 || MP */
  804. font-weight: bold;
  805. /* #endif */
  806. /* #ifdef APP-PLUS */
  807. color: #000;
  808. /* #endif */
  809. border-color: var(--view-theme);
  810. }
  811. .my-order .nav .item .num {
  812. margin-top: 18rpx;
  813. }
  814. .my-order .list {
  815. width: 690rpx;
  816. margin: 14rpx auto 0 auto;
  817. }
  818. .my-order .list .item {
  819. background-color: #fff;
  820. border-radius: 6rpx;
  821. margin-bottom: 14rpx;
  822. }
  823. .my-order .list .item .title {
  824. height: 84rpx;
  825. padding: 0 30rpx;
  826. border-bottom: 1rpx solid #eee;
  827. font-size: 28rpx;
  828. color: #282828;
  829. }
  830. .my-order .list .item .title .sign {
  831. font-size: 24rpx;
  832. padding: 0 7rpx;
  833. height: 36rpx;
  834. margin-right: 15rpx;
  835. }
  836. .my-order .list .item .item-info {
  837. padding: 0 30rpx;
  838. margin-top: 22rpx;
  839. }
  840. .my-order .list .item .item-info .pictrue {
  841. width: 120rpx;
  842. height: 120rpx;
  843. }
  844. .my-order .list .item .item-info .pictrue image {
  845. width: 100%;
  846. height: 100%;
  847. border-radius: 6rpx;
  848. }
  849. .my-order .list .item .item-info .text {
  850. width: 486rpx;
  851. font-size: 28rpx;
  852. color: #999;
  853. }
  854. .my-order .list .item .item-info .text .name {
  855. width: 306rpx;
  856. color: #282828;
  857. height: 74rpx;
  858. }
  859. .my-order .list .item .item-info .text .money {
  860. text-align: right;
  861. }
  862. .my-order .list .item .item-info .text .money .return {
  863. // color: var(--view-priceColor);
  864. margin-top: 10rpx;
  865. font-size: 24rpx;
  866. }
  867. .my-order .list .item .totalPrice {
  868. font-size: 26rpx;
  869. color: #282828;
  870. text-align: right;
  871. margin: 27rpx 0 0 30rpx;
  872. padding: 0 30rpx 30rpx 0;
  873. border-bottom: 1rpx solid #eee;
  874. }
  875. .my-order .list .item .totalPrice .money {
  876. font-size: 28rpx;
  877. font-weight: bold;
  878. color: var(--view-priceColor);
  879. }
  880. .my-order .list .item .bottom {
  881. height: 107rpx;
  882. padding: 0 30rpx;
  883. }
  884. .my-order .list .item .bottom .bnt {
  885. width: 176rpx;
  886. height: 60rpx;
  887. text-align: center;
  888. line-height: 60rpx;
  889. color: #fff;
  890. border-radius: 50rpx;
  891. font-size: 27rpx;
  892. }
  893. .my-order .list .item .bottom .bnt.cancelBnt {
  894. border: 1rpx solid #ddd;
  895. color: #aaa;
  896. }
  897. .my-order .list .item .bottom .bnt~.bnt {
  898. margin-left: 17rpx;
  899. }
  900. .noCart {
  901. margin-top: 171rpx;
  902. padding-top: 0.1rpx;
  903. }
  904. .noCart .pictrue {
  905. width: 414rpx;
  906. height: 336rpx;
  907. margin: 78rpx auto 56rpx auto;
  908. }
  909. .noCart .pictrue image {
  910. width: 100%;
  911. height: 100%;
  912. }
  913. .line2 {
  914. word-break: break-all;
  915. }
  916. .showstore {
  917. border-bottom: none !important;
  918. text-align: left !important;
  919. padding-bottom: 10rpx !important;
  920. }
  921. .icon {
  922. .iconfont {
  923. width: 44rpx;
  924. height: 44rpx;
  925. background: var(--view-minorColorT);
  926. font-size: 20rpx;
  927. border-radius: 50%;
  928. text-align: center;
  929. line-height: 44rpx;
  930. color: var(--view-theme);
  931. margin-left: 26rpx;
  932. }
  933. }
  934. .showbtn {
  935. color: #e93323 !important;
  936. border-color: #e93323 !important;
  937. }
  938. .ds-wrap {
  939. width: 623rpx;
  940. height: 334rpx;
  941. border-radius: 20rpx;
  942. background-color: #fff;
  943. display: flex;
  944. justify-content: space-around;
  945. align-items: center;
  946. flex-direction: column;
  947. input {
  948. width: 575rpx;
  949. height: 73rpx;
  950. background-color: #f5f5f5;
  951. color: #000;
  952. padding-left: 20rpx;
  953. }
  954. .btn-wrap {
  955. width: 575rpx;
  956. display: flex;
  957. justify-content: space-between;
  958. align-items: center;
  959. .btn {
  960. width: 277rpx;
  961. height: 82rpx;
  962. // background-color: ;
  963. color: #000;
  964. display: flex;
  965. justify-content: center;
  966. align-items: center;
  967. background-color: #f5f5f5;
  968. border-radius: 15rpx;
  969. }
  970. .s-btn {
  971. color: #fff;
  972. background-color:#e93323;
  973. }
  974. }
  975. }
  976. </style>