index.vue 29 KB

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