index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914
  1. <template>
  2. <view :style="viewColor">
  3. <view class='my-order'>
  4. <view class='header'>
  5. <view class='picTxt acea-row row-between-wrapper'>
  6. <view class='text'>
  7. <view class='name'>订单信息</view>
  8. <view>消费订单:{{orderData.orderCount || 0}} 总消费:¥{{orderData.orderPrice || 0}}</view>
  9. </view>
  10. <view class='pictrue'>
  11. <image :src="`${domain}/static/images/orderTime.png`"></image>
  12. </view>
  13. </view>
  14. </view>
  15. <navigator class="search acea-row row-middle" url="/pages/users/order_list/search" hover-class="none">
  16. <text class="iconfont icon-sousuo"></text>
  17. 搜索我的订单
  18. </navigator>
  19. <view class='nav acea-row row-around'>
  20. <view class='item' :class='orderStatus==-1 ? "on": ""' @click="statusClick(-1)">
  21. <view>全部</view>
  22. <view class='num'>{{orderData.all || 0}}</view>
  23. </view>
  24. <view class='item' :class='orderStatus==0 ? "on": ""' @click="statusClick(0)">
  25. <view>待付款</view>
  26. <view class='num'>{{orderData.noPay || 0}}</view>
  27. </view>
  28. <view class='item' :class='orderStatus==1 ? "on": ""' @click="statusClick(1)">
  29. <view>待发货</view>
  30. <view class='num'>{{orderData.noPostage || 0}}</view>
  31. </view>
  32. <view class='item' :class='orderStatus==2 ? "on": ""' @click="statusClick(2)">
  33. <view>待收货</view>
  34. <view class='num '>{{orderData.noDeliver || 0}}</view>
  35. </view>
  36. <view class='item' :class='orderStatus==3 ? "on": ""' @click="statusClick(3)">
  37. <view>待评价</view>
  38. <view class='num'>{{orderData.noComment || 0}}</view>
  39. </view>
  40. </view>
  41. <!--定金预售订单-->
  42. <view v-if="presellProList.length > 0" class="event_container" :style="{ 'background-image': `url(${domain}/static/images/presell_orderBg.png)`}">
  43. <navigator class="acea-row row-between" url="/pages/users/presell_order_list/index" hover-class='none' >
  44. <view class="info">
  45. <view class="title">预售尾款订单转到这里了!</view>
  46. <view class="desc"><text class="t-color">{{ presellOrderCount }}</text> 笔预售尾款订单待付款,请点击查看</view>
  47. </view>
  48. <view class="photo acea-row row-between">
  49. <view class='picture'>
  50. <image :src='(presellProList[0].orderProduct[0].cart_info.productAttr && presellProList[0].orderProduct[0].cart_info.productAttr.image) || presellProList[0].orderProduct[0].cart_info.product.image'></image>
  51. </view>
  52. <view class="more_btn"><text class="iconfont icon-gengduo3"></text></view>
  53. </view>
  54. </navigator>
  55. </view>
  56. <view class='list'>
  57. <!-- 代付款 -->
  58. <view v-if="orderList.length > 0">
  59. <block v-if="orderStatus == 0">
  60. <view class='item' v-for="(item,index) in orderList" :key="index">
  61. <view @click='goOrderDetails(item.group_order_id)'>
  62. <view class='title acea-row row-between-wrapper'>
  63. <view class="acea-row row-middle left-wrapper">
  64. {{item.group_order_sn}}
  65. </view>
  66. <view class='t-color'>{{ item.orderList[0].activity_type === 2 && item.orderList[0].orderProduct[0].cart_info.productPresell.presell_type ==2 ? "待付定金" : "待付款" }}</view>
  67. </view>
  68. <view v-for="(order,j) in item.orderList" :key="order.order_id+j">
  69. <!--预售-->
  70. <view v-if="order.activity_type === 2">
  71. <block v-for="(goods,g) in order.orderProduct">
  72. <view class='item-info acea-row row-between row-top'>
  73. <view class='pictrue'>
  74. <image :src='(goods.cart_info.productAttr && goods.cart_info.productAttr.image) || goods.cart_info.product.image'></image>
  75. </view>
  76. <view class='text acea-row row-between'>
  77. <view class='name line1'>
  78. <text class="event_name event_bg">预售</text><text>{{goods.cart_info.product.store_name}}</text>
  79. <view class="event_ship event_color">发货时间:
  80. <!--全款预售-->
  81. <text v-if="goods.cart_info.productPresell.presell_type === 1">
  82. {{ goods.cart_info.productPresell.delivery_type === 1 ? '支付成功后' : '预售结束后' }}{{ goods.cart_info.productPresell.delivery_day }}天内
  83. </text>
  84. <!--定金预售-->
  85. <text v-if="goods.cart_info.productPresell.presell_type === 2">{{ goods.cart_info.productPresell.delivery_type === 1 ? '支付尾款后' : '预售结束后' }}{{ goods.cart_info.productPresell.delivery_day }}天内</text>
  86. </view>
  87. </view>
  88. <view class='money'>
  89. <view>{{goods.cart_info.productPresellAttr.presell_price}}</view>
  90. <view>x{{goods.product_num}}</view>
  91. </view>
  92. </view>
  93. <view v-if="goods.cart_info.productPresell.presell_type === 2" class="event_price">
  94. 定金待支付 <text class="t-color">{{ order.pay_price }}</text>
  95. 尾款待支付 <text class="t-color">{{ order.presellOrder.pay_price }}</text>
  96. </view>
  97. </view>
  98. </block>
  99. </view>
  100. <view v-else>
  101. <block v-for="(goods,g) in order.orderProduct">
  102. <view class='item-info acea-row row-between row-top'>
  103. <view class='pictrue'>
  104. <image :src='(goods.cart_info.productAttr && goods.cart_info.productAttr.image) || goods.cart_info.product.image'></image>
  105. </view>
  106. <view class='text acea-row row-between'>
  107. <view class='name line2'>
  108. <text v-if="goods.product_type != 0 && goods.product_type != 10" :class="'font_bg-red type'+goods.product_type">{{goods.product_type == 1 ? "秒杀" : goods.product_type == 2 ? "预售" : goods.product_type == 3 ? "助力" : goods.product_type == 4 ? "拼团" : ""}}</text>
  109. {{goods.cart_info.product.store_name}}
  110. </view>
  111. <view class='money' v-if="item.orderList[0].activity_type == 4">
  112. <view v-if="goods.cart_info.activeSku">{{goods.cart_info.activeSku.active_price}}</view>
  113. <view>x{{goods.product_num}}</view>
  114. </view>
  115. <view v-else class='money'>
  116. <view>{{goods.cart_info.productAttr.price}}</view>
  117. <view>x{{goods.product_num}}</view>
  118. </view>
  119. </view>
  120. </view>
  121. </block>
  122. </view>
  123. </view>
  124. <view class='totalPrice' v-if="item.orderList[0].activity_type !== 2">{{item.total_num || 0}}件商品,总金额
  125. <text class='money p-color'>{{item.pay_price}}</text>
  126. </view>
  127. <view class='bottom acea-row row-right row-middle'>
  128. <view class='bnt b-color' @click.stop='goPay(item.pay_price,item.group_order_id)'>立即付款</view>
  129. </view>
  130. </view>
  131. </view>
  132. </block>
  133. <!-- 待发货 待收货 待评价 已完成 -->
  134. <block v-else>
  135. <view class='item' v-for="(item,index) in orderList" :key="index">
  136. <view @click='goOrderDetails(item.order_id)'>
  137. <view class='title acea-row row-between-wrapper'>
  138. <view class="acea-row row-middle left-wrapper" @click.stop="goMall(item)">
  139. <text class="iconfont icon-shangjiadingdan"></text>
  140. <view class="store-name">{{item.merchant.mer_name}}</view>
  141. <text class="iconfont icon-xiangyou"></text>
  142. </view>
  143. <view v-if="item.status == 0" class='t-color'>
  144. <text v-if="item.order_type==1">{{item.takeOrderCount > 0 ? '部分核销' : '待核销'}}</text>
  145. <text v-else>待发货</text>
  146. </view>
  147. <view v-if="item.status == 1" class='t-color'>待收货</view>
  148. <view v-if="item.status == 2" class='t-color'>待评价</view>
  149. <view v-if="item.status == 3" class='t-color'>已完成</view>
  150. <view v-if="item.status == -1" class='t-color'>已退款</view>
  151. </view>
  152. <view v-if="item.activity_type === 2">
  153. <view class='item-info acea-row row-between row-top' v-for="(goods,index) in item.orderProduct" :key="index">
  154. <view class='pictrue'>
  155. <image :src='(goods.cart_info.productAttr && goods.cart_info.productAttr.image) || goods.cart_info.product.image'></image>
  156. </view>
  157. <view class='text acea-row row-between'>
  158. <view class='name '>
  159. <view class='name' :class="item.status === 0 ? 'line1' : 'line2'">
  160. <text class="event_name event_bg">预售</text><text>{{goods.cart_info.product.store_name}}</text>
  161. <view v-if="item.status == 0" class="event_ship event_color">发货时间:
  162. <!--全款预售-->
  163. <text v-if="goods.cart_info.productPresell.presell_type === 1">{{ goods.cart_info.productPresell.delivery_type === 1 ? '支付成功后' : '预售结束后' }}{{ goods.cart_info.productPresell.delivery_day }}天内</text>
  164. <!--定金预售-->
  165. <text v-if="goods.cart_info.productPresell.presell_type === 2">{{ goods.cart_info.productPresell.delivery_type === 1 ? '支付尾款后' : '预售结束后' }}{{ goods.cart_info.productPresell.delivery_day }}天内</text>
  166. </view>
  167. </view>
  168. <view style="margin-top: 10rpx;" class="t-color">{{goods.is_refund==1?'退款中':goods.is_refund==2?'部分退款':goods.is_refund==3?'全部退款':''}}</view>
  169. </view>
  170. <view class='money'>
  171. <view>{{goods.cart_info.productPresellAttr.presell_price}}</view>
  172. <view>x{{goods.product_num}}</view>
  173. </view>
  174. </view>
  175. </view>
  176. </view>
  177. <view v-else>
  178. <view class='item-info acea-row row-between row-top' v-for="(goods,index) in item.orderProduct" :key="index">
  179. <view class='pictrue'>
  180. <image :src='(goods.cart_info.productAttr && goods.cart_info.productAttr.image) || goods.cart_info.product.image'></image>
  181. </view>
  182. <view class='text acea-row row-between'>
  183. <view class='name '>
  184. <view class='name line2'>
  185. <text v-if="goods.product_type != 0 && goods.product_type != 10" :class="'font_bg-red type'+goods.product_type">{{goods.product_type == 1 ? "秒杀" : goods.product_type == 2 ? "预售" : goods.product_type == 3 ? "助力" : goods.product_type == 4 ? "拼团" : ""}}</text>
  186. <text>{{goods.cart_info.product.store_name}}</text>
  187. </view>
  188. <view style="margin-top: 10rpx;" class="t-color">{{goods.is_refund==1?'退款中':goods.is_refund==2?'部分退款':goods.is_refund==3?'全部退款':''}}</view>
  189. </view>
  190. <view class='money' v-if="item.activity_type == 3">
  191. <view v-if="goods.cart_info.productAssistAttr">{{goods.cart_info.productAssistAttr.assist_price}}</view>
  192. <view>x{{goods.product_num}}</view>
  193. </view>
  194. <view class='money' v-else-if="item.activity_type == 4">
  195. <view v-if="goods.cart_info.activeSku">{{goods.cart_info.activeSku.active_price}}</view>
  196. <view>x{{goods.product_num}}</view>
  197. </view>
  198. <view class='money' v-else>
  199. <view>{{goods.cart_info.productAttr.price}}</view>
  200. <view>x{{goods.product_num}}</view>
  201. </view>
  202. </view>
  203. </view>
  204. </view>
  205. <view class='totalPrice' v-if="item.activity_type == 2">{{item.orderNum || 0}}件商品,总金额
  206. <text class='money p-color'>{{item.presell_price}}</text>
  207. </view>
  208. <view class='totalPrice' v-else>共{{item.orderNum || 0}}件商品,总金额
  209. <text class='money p-color'>{{item.pay_price}}</text>
  210. </view>
  211. </view>
  212. <view class='bottom acea-row row-right row-middle'>
  213. <view v-if="!item.receipt && item.status != -1 && item.open_receipt == 1 && item.order_type!==1" class='bnt cancelBnt' @click.stop='applyInvoice(item.order_id)'>申请开票</view>
  214. <block v-if="item.status == 0 || item.status == 9 || item.status == -1">
  215. <view class='bnt b-color' @click='goOrderDetails(item.order_id)'>查看详情</view>
  216. </block>
  217. <block v-if="item.status == 1">
  218. <view class='bnt cancelBnt' v-if="item.delivery_type == 1 || item.delivery_type == 2" @click='goOrderDetails(item.order_id)'>查看物流</view>
  219. <view class='bnt b-color' @tap='confirmOrder(item,index)'>确认收货</view>
  220. </block>
  221. <block v-if="item.status == 2">
  222. <navigator v-if="community_status == 1 && !item.community_id" :url="'/pages/plantGrass/plant_release/index?order_id='+item.order_id" class='bnt colorBnt' hover-class="none">
  223. <text class="iconfont icon-fabu"></text>
  224. 发布种草
  225. </navigator>
  226. <view class='bnt b-color' @click='goOrderDetails_Evaluation(item.order_id)'>去评价</view>
  227. </block>
  228. <block v-if="item.status == 3">
  229. <view class='bnt b-color' @click='goOrderDetails(item.order_id)' v-if="item.activity_type == 2 || item.activity_type == 3 || item.activity_type == 10">查看详情</view>
  230. <navigator v-if="community_status == 1 && !item.community_id" :url="'/pages/plantGrass/plant_release/index?order_id='+item.order_id" class='bnt colorBnt' hover-class="none">
  231. <text class="iconfont icon-fabu"></text>
  232. 发布种草
  233. </navigator>
  234. <view class='bnt b-color' @click='goOrderDetails(item.order_id)' v-else>再次购买</view>
  235. </block>
  236. </view>
  237. </view>
  238. </block>
  239. </view>
  240. </view>
  241. <view class='loadingicon acea-row row-center-wrapper' v-if="orderList.length>5">
  242. <text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
  243. </view>
  244. <view v-if="orderList.length == 0 && page > 1">
  245. <emptyPage title="暂无订单~"></emptyPage>
  246. </view>
  247. </view>
  248. <home></home>
  249. <payment :payMode='payMode' :pay_close="pay_close" @onChangeFun='onChangeFun' :order_id="pay_order_id" :totalPrice='totalPrice'></payment>
  250. <addInvoicing ref="addInvoicing" @changeInvoiceClose="changeInvoiceClose" :invoice='invoice'></addInvoicing>
  251. </view>
  252. </template>
  253. <script>
  254. // +----------------------------------------------------------------------
  255. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  256. // +----------------------------------------------------------------------
  257. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  258. // +----------------------------------------------------------------------
  259. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  260. // +----------------------------------------------------------------------
  261. // | Author: CRMEB Team <admin@crmeb.com>
  262. // +----------------------------------------------------------------------
  263. let app = getApp();
  264. import {
  265. getOrderList,
  266. orderData,
  267. groupOrderList,
  268. orderTake,
  269. applyInvoiceApi
  270. } from '@/api/order.js';
  271. import { getUserInfo } from '@/api/user.js';
  272. import { openOrderSubscribe } from '@/utils/SubscribeMessage.js';
  273. import payment from '@/components/payment';
  274. import home from '@/components/home/index.vue';
  275. import addInvoicing from '@/components/addInvoicing';
  276. import { mapGetters } from "vuex";
  277. import emptyPage from '@/components/emptyPage.vue';
  278. import { configMap } from '@/utils'
  279. import { HTTP_REQUEST_URL } from '@/config/app';
  280. import { toLogin } from '@/libs/login.js';
  281. export default {
  282. components: {
  283. payment,
  284. emptyPage,
  285. home,
  286. addInvoicing
  287. },
  288. data() {
  289. return {
  290. loading: false, //是否加载中
  291. loadend: false, //是否加载完毕
  292. loadTitle: '加载更多', //提示语
  293. orderList: [], //订单数组
  294. presellProList: [], //定金预售订单
  295. presellOrderCount: 0,
  296. orderData: {}, //订单详细统计
  297. orderStatus: 0, //订单状态
  298. page: 1,
  299. limit: 20,
  300. domain: HTTP_REQUEST_URL,
  301. payMode: [{
  302. name: "微信支付",
  303. icon: "icon-weixinzhifu",
  304. value: 'wechat',
  305. title: '微信快捷支付',
  306. payStatus: 1
  307. },
  308. {
  309. name: "支付宝支付",
  310. icon: "icon-zhifubao",
  311. value: 'alipay',
  312. title: '支付宝支付',
  313. payStatus: this.$store.getters.globalData.alipay_open
  314. },
  315. {
  316. name: "余额支付",
  317. icon: "icon-yuezhifu",
  318. value: 'balance',
  319. title: '可用余额:',
  320. number: 0,
  321. payStatus: this.$store.getters.globalData.yue_pay_status
  322. }
  323. ],
  324. pay_close: false,
  325. pay_order_id: '',
  326. invoice_order_id: '',
  327. totalPrice: '0',
  328. isReady: true,
  329. invoice: {
  330. invoice: false,
  331. add: false,
  332. }
  333. };
  334. },
  335. computed: {
  336. ...mapGetters(['isLogin','viewColor']),
  337. ...configMap(['hide_mer_status', 'community_status']),
  338. },
  339. watch: {
  340. },
  341. onShow() {
  342. if (this.isLogin) {
  343. this.page = 1;
  344. this.loadend = false;
  345. this.loading = false;
  346. this.getOrderData();
  347. this.getOrderList();
  348. this.getUserInfo();
  349. this.getpreSellOrderList();
  350. } else {
  351. toLogin()
  352. }
  353. },
  354. onReady(){
  355. },
  356. mounted: function() {
  357. },
  358. methods: {
  359. // 去商铺
  360. goMall(item){
  361. if(this.hide_mer_status == 0){
  362. uni.navigateTo({
  363. url:'/pages/store/home/index?id='+item.mer_id
  364. })
  365. }
  366. },
  367. /**
  368. * 事件回调
  369. *
  370. */
  371. onChangeFun: function(e) {
  372. let opt = e;
  373. let action = opt.action || null;
  374. let value = opt.value != undefined ? opt.value : null;
  375. (action && this[action]) && this[action](value);
  376. },
  377. /**
  378. * 获取用户信息
  379. *
  380. */
  381. getUserInfo: function() {
  382. let that = this;
  383. getUserInfo().then(res => {
  384. that.payMode[2].number = res.data.now_money;
  385. });
  386. },
  387. /**
  388. * 关闭支付组件
  389. *
  390. */
  391. payClose: function() {
  392. this.pay_close = false;
  393. },
  394. /**
  395. * 生命周期函数--监听页面加载
  396. */
  397. onLoad: function(options) {
  398. if (options.status) this.orderStatus = options.status;
  399. },
  400. /**
  401. * 获取订单统计数据
  402. *
  403. */
  404. getOrderData: function() {
  405. let that = this;
  406. orderData().then(res => {
  407. that.$set(that, 'orderData', res.data);
  408. })
  409. },
  410. /**
  411. * 打开支付组件
  412. *
  413. */
  414. goPay: function(pay_price, order_id) {
  415. this.$set(this, 'pay_close', true);
  416. this.order_id = order_id;
  417. this.pay_order_id = order_id.toString()
  418. this.$set(this, 'totalPrice', pay_price);
  419. },
  420. /**
  421. * 支付成功回调
  422. *
  423. */
  424. pay_complete: function() {
  425. this.loadend = false;
  426. this.page = 1;
  427. this.$set(this, 'orderList', []);
  428. this.pay_close = false;
  429. this.pay_order_id = '';
  430. this.getOrderData();
  431. this.getOrderList();
  432. },
  433. /**
  434. * 支付失败回调
  435. *
  436. */
  437. pay_fail: function() {
  438. this.pay_close = false;
  439. this.pay_order_id = '';
  440. },
  441. /**
  442. * 去订单详情
  443. */
  444. goOrderDetails: function(order_id) {
  445. let self = this
  446. if (!order_id) return that.$util.Tips({
  447. title: '缺少订单号无法查看订单详情'
  448. });
  449. // #ifdef MP
  450. uni.showLoading({
  451. title: '正在加载',
  452. })
  453. openOrderSubscribe().then(() => {
  454. uni.hideLoading();
  455. if (self.orderStatus == 0) {
  456. uni.navigateTo({
  457. url: '/pages/order_details/stay?order_id=' + order_id
  458. })
  459. } else {
  460. uni.navigateTo({
  461. url: '/pages/order_details/index?order_id=' + order_id
  462. })
  463. }
  464. }).catch(() => {
  465. uni.hideLoading();
  466. })
  467. // #endif
  468. // #ifndef MP
  469. if (self.orderStatus == 0) {
  470. uni.navigateTo({
  471. url: '/pages/order_details/stay?order_id=' + order_id
  472. })
  473. } else {
  474. uni.navigateTo({
  475. url: '/pages/order_details/index?order_id=' + order_id
  476. })
  477. }
  478. // #endif
  479. },
  480. /**
  481. * 点击去评价
  482. */
  483. goOrderDetails_Evaluation: function(order_id) {
  484. let self = this
  485. if (!order_id) return that.$util.Tips({
  486. title: '缺少订单号无法查看订单详情和评价'
  487. });
  488. // #ifdef MP
  489. if (self.orderStatus == 0) {
  490. uni.navigateTo({
  491. url: '/pages/order_details/stay?order_id=' + order_id
  492. })
  493. } else {
  494. uni.navigateTo({
  495. url: '/pages/order_details/index?order_id=' + order_id
  496. })
  497. }
  498. // #endif
  499. // #ifndef MP
  500. if (self.orderStatus == 0) {
  501. uni.navigateTo({
  502. url: '/pages/order_details/stay?order_id=' + order_id
  503. })
  504. } else {
  505. uni.navigateTo({
  506. url: '/pages/order_details/index?order_id=' + order_id
  507. })
  508. }
  509. // #endif
  510. },
  511. /**
  512. * 切换类型
  513. */
  514. statusClick: function(status) {
  515. if (status == this.orderStatus) return;
  516. this.orderStatus = status;
  517. this.loadend = false;
  518. this.loading = false;
  519. this.page = 1;
  520. this.$set(this, 'orderList', []);
  521. this.getOrderList();
  522. },
  523. /**
  524. * 获取订单列表
  525. */
  526. getOrderList: function() {
  527. let that = this;
  528. if (that.loadend) return;
  529. if (that.loading) return;
  530. that.loading = true;
  531. that.loadTitle = "加载更多";
  532. if(that.isReady){
  533. that.isReady = false
  534. if (that.orderStatus == 0) {
  535. groupOrderList({
  536. page: that.page,
  537. limit: that.limit,
  538. }).then(res => {
  539. that.isReady = true;
  540. let list = res.data.list || [];
  541. let loadend = list.length < that.limit;
  542. that.orderList = that.page == 1 ? list : that.$util.SplitArray(list, that.orderList);
  543. that.$set(that, 'orderList', that.orderList);
  544. that.getProductCount();
  545. that.loadend = loadend;
  546. that.loading = false;
  547. that.loadTitle = loadend ? "我也是有底线的" : '加载更多';
  548. that.page = that.page + 1
  549. })
  550. } else {
  551. getOrderList({
  552. status: that.orderStatus - 1,
  553. page: that.page,
  554. limit: that.limit,
  555. }).then(res => {
  556. let list = res.data.list || [];
  557. let loadend = list.length < that.limit;
  558. that.orderList = that.page == 1 ? list : that.$util.SplitArray(list, that.orderList);
  559. that.$set(that, 'orderList', that.orderList);
  560. that.getProductCount();
  561. that.loadend = loadend;
  562. that.loading = false;
  563. that.loadTitle = loadend ? "我也是有底线的" : '加载更多';
  564. that.page = that.page + 1;
  565. that.isReady = true;
  566. }).catch(err => {
  567. that.loading = false;
  568. that.loadTitle = "加载更多";
  569. })
  570. }
  571. }
  572. },
  573. /**
  574. * 获取定金预售订单列表
  575. */
  576. getpreSellOrderList: function() {
  577. let that = this;
  578. getOrderList({
  579. status: 10,
  580. page: 1,
  581. limit: 1,
  582. }).then(res => {
  583. let list = res.data.list || [];
  584. that.presellOrderCount = res.data.count;
  585. that.$set(that, 'presellProList', list);
  586. })
  587. },
  588. /**
  589. * 获取单个订单商品数量
  590. */
  591. getProductCount: function(){
  592. if(this.orderStatus !== 0){
  593. this.orderList.forEach((item,i) => {
  594. let orderNum = 0
  595. if(item.orderProduct){
  596. item.orderProduct.forEach((val) => {
  597. orderNum += val.product_num
  598. })
  599. this.orderList[i]['orderNum']=orderNum;
  600. }
  601. })
  602. }
  603. },
  604. // 确认收货
  605. confirmOrder: function(item, index) {
  606. let that = this;
  607. uni.showModal({
  608. title: '确认收货',
  609. content: '为保障权益,请收到货确认无误后,再确认收货',
  610. success: function(res) {
  611. if (res.confirm) {
  612. orderTake(item.order_id).then(res => {
  613. return that.$util.Tips({
  614. title: '操作成功',
  615. icon: 'success'
  616. }, function() {
  617. that.orderList.splice(index, 1);
  618. that.getOrderData();
  619. });
  620. }).catch(err => {
  621. return that.$util.Tips({
  622. title: err
  623. });
  624. })
  625. }
  626. }
  627. })
  628. },
  629. /*申请开票*/
  630. applyInvoice(order_id) {
  631. let that = this;
  632. that.invoice_order_id = order_id
  633. that.invoice.invoice = true;
  634. that.$refs.addInvoicing.popupTitle = false;
  635. that.$refs.addInvoicing.getInvoiceDefault();
  636. that.$refs.addInvoicing.getInvoiceList();
  637. },
  638. // 关闭发票弹窗
  639. changeInvoiceClose: function(data) {
  640. if(data)this.getInvoiceData(data);
  641. this.$set(this.invoice, 'invoice', false);
  642. },
  643. // 开票回调
  644. getInvoiceData(data) {
  645. let that = this
  646. applyInvoiceApi(that.invoice_order_id,data).then(res => {
  647. return that.$util.Tips({
  648. title: res.message,
  649. });
  650. }).catch(err => {
  651. return that.$util.Tips({
  652. title: err
  653. });
  654. })
  655. }
  656. },
  657. onReachBottom: function() {
  658. this.getOrderList();
  659. }
  660. }
  661. </script>
  662. <style scoped lang="scss">
  663. .my-order .header {
  664. height: 260rpx;
  665. padding: 0 30rpx;
  666. background-color: var(--view-theme);
  667. }
  668. .t-color{color: var(--view-theme);}
  669. .p-color{color: var(--view-priceColor);}
  670. .b-color{background-color:var(--view-theme);}
  671. .my-order .header .picTxt {
  672. height: 190rpx;
  673. }
  674. .my-order .header .picTxt .text {
  675. color: rgba(255, 255, 255, 0.8);
  676. font-size: 26rpx;
  677. }
  678. .my-order .header .picTxt .text .name {
  679. font-size: 34rpx;
  680. font-weight: bold;
  681. color: #fff;
  682. margin-bottom: 20rpx;
  683. }
  684. .my-order .header .picTxt .pictrue {
  685. width: 122rpx;
  686. height: 109rpx;
  687. }
  688. .my-order .header .picTxt .pictrue image {
  689. width: 100%;
  690. height: 100%;
  691. }
  692. .my-order .nav {
  693. background-color: #fff;
  694. width: 690rpx;
  695. height: 140rpx;
  696. border-radius: 16rpx;
  697. margin: 20rpx auto 0 auto;
  698. }
  699. .my-order .nav .item {
  700. text-align: center;
  701. font-size: 26rpx;
  702. color: #282828;
  703. padding: 29rpx 0;
  704. }
  705. .my-order .nav .item.on {
  706. font-weight: bold;
  707. border-bottom: 5rpx solid var(--view-theme);
  708. }
  709. .my-order .nav .item .num {
  710. margin-top: 18rpx;
  711. }
  712. .my-order .list {
  713. width: 690rpx;
  714. margin: 14rpx auto 0 auto;
  715. }
  716. .my-order .list .item {
  717. background-color: #fff;
  718. border-radius: 16rpx;
  719. margin-bottom: 14rpx;
  720. }
  721. .my-order .list .item .title {
  722. height: 84rpx;
  723. padding: 0 30rpx;
  724. border-bottom: 1px solid #eee;
  725. font-size: 28rpx;
  726. color: #282828;
  727. .left-wrapper {
  728. .iconfont {
  729. margin-top: 5rpx;
  730. }
  731. .store-name {
  732. margin: 0 10rpx;
  733. }
  734. .icon-xiangyou {
  735. font-size: 20rpx;
  736. }
  737. }
  738. }
  739. .my-order .list .item .title .sign {
  740. font-size: 24rpx;
  741. padding: 0 7rpx;
  742. height: 36rpx;
  743. margin-right: 15rpx;
  744. }
  745. .my-order .list .item .item-info {
  746. padding: 0 30rpx;
  747. margin-top: 22rpx;
  748. }
  749. .my-order .list .item .item-info .pictrue {
  750. width: 120rpx;
  751. height: 120rpx;
  752. }
  753. .my-order .list .item .item-info .pictrue image {
  754. width: 100%;
  755. height: 100%;
  756. border-radius: 6rpx;
  757. }
  758. .my-order .list .item .item-info .text {
  759. width: 486rpx;
  760. font-size: 28rpx;
  761. color: #999;
  762. margin-top: 6rpx;
  763. }
  764. .my-order .list .item .item-info .text .name {
  765. width: 320rpx;
  766. color: #282828;
  767. }
  768. .my-order .list .item .item-info .text .name .font_bg-red{
  769. position: relative;
  770. top: -2px;
  771. }
  772. .event_bg{
  773. background: #FF7F00;
  774. }
  775. .event_color{
  776. color: #FF7F00;
  777. }
  778. .my-order .list .item .event_name{
  779. display: inline-block;
  780. margin-right: 9rpx;
  781. color: #fff;
  782. font-size: 20rpx;
  783. padding: 0 8rpx;
  784. line-height: 30rpx;
  785. text-align: center;
  786. border-radius: 6rpx;
  787. }
  788. .my-order .list .item .event_ship{
  789. font-size: 20rpx;
  790. margin-top: 10rpx;
  791. }
  792. .my-order .list .event_price{
  793. margin: 0 0 50rpx 120rpx;
  794. }
  795. .my-order .list .item .item-info .text .money {
  796. text-align: right;
  797. }
  798. .my-order .list .item .totalPrice {
  799. font-size: 26rpx;
  800. color: #282828;
  801. text-align: right;
  802. margin: 27rpx 0 0 30rpx;
  803. padding: 0 30rpx 30rpx 0;
  804. }
  805. .my-order .list .item .totalPrice .money {
  806. font-size: 28rpx;
  807. font-weight: bold;
  808. }
  809. .my-order .list .item .bottom {
  810. height: 107rpx;
  811. padding: 0 30rpx;
  812. border-top: 1px solid #f0f0f0;
  813. }
  814. .my-order .list .item .bottom .bnt {
  815. width: 176rpx;
  816. height: 60rpx;
  817. display: flex;
  818. align-items: center;
  819. justify-content: center;
  820. color: #fff;
  821. border-radius: 50rpx;
  822. font-size: 27rpx;
  823. }
  824. .my-order .list .item .bottom .bnt.cancelBnt {
  825. border: 1px solid #ddd;
  826. color: #aaa;
  827. }
  828. .my-order .list .item .bottom .bnt.colorBnt {
  829. border: 1px solid var(--view-theme);
  830. color: var(--view-theme);
  831. }
  832. .my-order .list .item .bottom .bnt .icon-fabu{
  833. font-size: 26rpx;
  834. margin-right: 10rpx;
  835. }
  836. .my-order .list .item .bottom .bnt~.bnt {
  837. margin-left: 17rpx;
  838. }
  839. .noCart {
  840. margin-top: 171rpx;
  841. padding-top: 0.1rpx;
  842. }
  843. .noCart .pictrue {
  844. width: 414rpx;
  845. height: 336rpx;
  846. margin: 78rpx auto 56rpx auto;
  847. }
  848. .noCart .pictrue image {
  849. width: 100%;
  850. height: 100%;
  851. }
  852. .event_container{
  853. width: 690rpx;
  854. background-size: cover;
  855. background-repeat: no-repeat;
  856. margin: 20rpx auto;
  857. padding: 26rpx 30rpx;
  858. border-radius: 16rpx;
  859. .info{
  860. width: 420rpx;
  861. .title{
  862. color: #282828;
  863. font-size: 26rpx;
  864. }
  865. .desc{
  866. color: #999;
  867. font-size: 24rpx;
  868. margin-top: 30rpx;
  869. }
  870. }
  871. .photo{
  872. width: 180rpx;
  873. .picture{
  874. width: 120rpx;
  875. height: 120rpx;
  876. image{
  877. width: 100%;
  878. height: 100%;
  879. border-radius: 8rpx;
  880. }
  881. }
  882. .more_btn{
  883. color: #fff;
  884. background: #F97E3B;
  885. width: 40rpx;
  886. height: 40rpx;
  887. border-radius: 40rpx;
  888. text-align: center;
  889. line-height: 40rpx;
  890. position: relative;
  891. top: 40rpx;
  892. text{
  893. font-size: 20rpx;
  894. }
  895. }
  896. }
  897. }
  898. .search {
  899. height: 70rpx;
  900. padding: 0 30rpx;
  901. border-radius: 35rpx;
  902. margin: -35rpx 30rpx 0;
  903. background-color: #FFFFFF;
  904. font-size: 26rpx;
  905. color: #999999;
  906. .iconfont {
  907. margin-right: 10rpx;
  908. font-size: 23rpx;
  909. }
  910. }
  911. </style>