orderdetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. <template>
  2. <view>
  3. <!-- <van-tabs :active="active" @change="changeselect" >
  4. <van-tab v-for="(item, index) in menu" :name="index" :title="item.name">
  5. </van-tab>
  6. </van-tabs> -->
  7. <scroll-view v-if="order_list.length > 0" style="height: 95vh;" class="floor-list"
  8. :scroll-top="scrollTop" scroll-y="true" @scroll="scroll" @scrolltoupper="upper" @scrolltolower="lower"
  9. refresher-enabled="true">
  10. <view v-for="(item,index) in order_list" :key="index" class="cart-list">
  11. <view class="topTip" @click="goDetail(item.order_id)">
  12. <view>
  13. <image :src="pictureUrl+'/uploads/home/store/'+item.store_id+'/'+item.store_avatar" style="border-radius: 50%;
  14. width: 50upx;height: 50upx;vertical-align: middle;"></image>
  15. <span style="padding-left: 16upx;">{{item.store_name}}</span>
  16. </view>
  17. <view style="color: #D9332E;font-size: 24upx;">{{item.status}}</view>
  18. </view>
  19. <view @click="goDetail(item.order_id)" v-for="(items,indexs) in item.goods" :key="indexs" class="shoplist" style="background-color: #fff;">
  20. <view>
  21. <van-card
  22. title-class="changewidth"
  23. price-class ="priceClass"
  24. :price="items.goods_pay_price"
  25. :desc="items.descire+'X'+items.goods_num"
  26. :title="items.desarray"
  27. :thumb="pictureUrl + '/uploads/home/store/goods/'+items.goods_image.substr(0, items.goods_image.indexOf('\_')) + '/' + items.goods_image"
  28. >
  29. </van-card>
  30. </view>
  31. </view>
  32. <view class="topTip">
  33. <view style="font-size: 28upx;">合计:{{item.order_amount}}</view>
  34. <!-- <view class="deleChange" v-if="item.order_state == 10">未付款</view>
  35. <view class="deleChange" v-if="item.order_state == 20">催单</view>
  36. <view class="deleChange" v-if="item.order_state == 20">确认收货</view> uni.navigateTo({
  37. url:`/pages/myOrder/paymoment?order_id=${order_id}&prices=${prices}`
  38. })
  39. <view class="deleChange" v-if="item.order_state == 40 && item.evaluation_state == 0">去评价</view> -->
  40. <view class="deleChange" @click="gopay(item)">{{item.operate}}</view>
  41. </view>
  42. </view>
  43. </scroll-view>
  44. <view v-if="order_list.length == 0 && successlogion && hasLogin" >
  45. <view style="margin: 120upx auto;text-align: center;">
  46. <van-icon size="160rpx" color="#909399" name="description" />
  47. <view style="text-align: center;color: #909399;"> 去买点什么</view>
  48. </view>
  49. </view>
  50. <view v-if="order_list.length == 0 && !successlogion || order_list.length == 0 && !hasLogin" >
  51. <view style="margin: 120upx auto;text-align: center;">
  52. <van-icon size="160rpx" color="#909399" name="description" />
  53. <view style="text-align: center;color: #909399;">啥都没有
  54. <span style="color: #F76260;" @click="gotologion">去登录吧</span></view>
  55. </view>
  56. </view>
  57. <!-- 催单 -->
  58. <Dialog :orderCancel="orderCancel"
  59. :titles="titles"
  60. @colseDialog="cancelDialog"
  61. @confirmPay="confirmOrder"
  62. />
  63. <Gobacktop @getop="getop" v-if="isTop" />
  64. <!-- <logionDialog @confirmDiaolog="confirmDiaolog" :ishow="false" @cancelDiaolog="cancelDiaolog" :showdialog="showdialog"/> -->
  65. </view>
  66. </template>
  67. <script>
  68. import {
  69. mapMutations,mapState
  70. } from 'vuex'
  71. import Dialog from '@/component/Dialog.vue'
  72. import Gobacktop from '@/component/Gobacktop.vue'
  73. export default{
  74. components: {
  75. Dialog,
  76. Gobacktop
  77. },
  78. data() {
  79. return {
  80. isTop: false,
  81. ispull: true,
  82. showdialog: false,
  83. orderCancel: false,
  84. titles:'',
  85. pictureUrl: this.pictureUrl,
  86. menu:[
  87. {name:'全部'},
  88. {name:'待支付'},
  89. {name:'处理中'},
  90. {name:'已收货'},
  91. {name:'已取消'},
  92. {name:'退款售后'}
  93. ],
  94. deleteorder: 0, // 判断删除订单还是确认收货
  95. // 要查找的订单状态 all-全部 waiting-待支付 payed-处理中 complete-已收货 cancel-已取消 refund-退款售后
  96. active: 0,
  97. scrollTop: 0,
  98. old: {
  99. scrollTop: 0
  100. },
  101. order_id:'',
  102. page: 1,
  103. page_size: 10,
  104. state: 'all',
  105. order_list:[]
  106. }
  107. },
  108. computed:{
  109. ...mapState([
  110. 'hasLogin',
  111. 'userInfo',
  112. 'successlogion'
  113. ]),
  114. },
  115. onLoad(a) {
  116. uni.$on("refehlist",()=>{
  117. this.order_list = [];
  118. this.getlist();
  119. })
  120. // 完成支付
  121. uni.$on(" finshlist",()=>{
  122. this.page = 1;
  123. this.order_list = [];
  124. this.getlist();
  125. })
  126. // 完成评价
  127. uni.$on("finshesitmate",()=>{
  128. this.page = 1;
  129. this.order_list = [];
  130. this.getlist();
  131. })
  132. if(this.successlogion && this.hasLogin){
  133. let title = '';
  134. if(a.state == 'waiting') {
  135. title = '待付款';
  136. }else if(a.state == 'payed') {
  137. title = '处理中';
  138. }else if(a.state == 'cancel'){
  139. title = '已取消';
  140. }else if(a.state == 'complete'){
  141. title = '待评价';
  142. }
  143. uni.setNavigationBarTitle({
  144. title: title
  145. })
  146. this.state = a.state;
  147. this.getlist(); // 获取订单
  148. }else {
  149. uni.navigateTo({
  150. url: '/pages/myCenter/logion'
  151. })
  152. }
  153. },
  154. watch:{
  155. 'successlogion':function(val) {
  156. if(val) {
  157. this.active = 0;
  158. this.getlist();
  159. }else {
  160. uni.navigateTo({
  161. url: '/pages/myCenter/logion'
  162. })
  163. }
  164. },
  165. 'hasLogin':function(val) {
  166. if(val) {
  167. this.active = 0;
  168. this.getlist();
  169. }else {
  170. uni.navigateTo({
  171. url: '/pages/myCenter/logion'
  172. })
  173. }
  174. },
  175. },
  176. methods: {
  177. getop() {
  178. this.scrollTop = this.old.scrollTop
  179. this.$nextTick(function(){
  180. this.scrollTop=0;
  181. });
  182. this.isTop = false;
  183. },
  184. gotologion() {
  185. uni.navigateTo({
  186. url: '/pages/myCenter/logion'
  187. })
  188. },
  189. // 关闭弹窗
  190. // cancelDiaolog() {
  191. // this.showdialog = false;
  192. // },
  193. // // 确定
  194. // confirmDiaolog() {
  195. // this.showdialog = false;
  196. // this.getlist(); // 获取订单
  197. // },
  198. // changeselect(e) {
  199. // if(this.successlogion && this.hasLogin) {
  200. // console.log(e);
  201. // this.active = e.target.name;
  202. // this.page = 1;
  203. // this.ispull = true;
  204. // this.order_list = [];
  205. // if(e.target.name == 0) {
  206. // this.state = 'all';
  207. // this.getlist();
  208. // }else if(e.target.name == 1) {
  209. // this.state = 'waiting';
  210. // this.getlist();
  211. // }else if(e.target.name == 2) {
  212. // this.state = 'payed';
  213. // this.getlist();
  214. // }else if(e.target.name == 3) {
  215. // this.state = 'complete';
  216. // this.getlist();
  217. // }else if(e.target.name == 4) {
  218. // this.state = 'cancel';
  219. // this.getlist();
  220. // }
  221. // if(e.target.name == 5) {
  222. // this.state = 'refund';
  223. // this.refund();
  224. // }
  225. // }else {
  226. // uni.navigateTo({
  227. // url: '/pages/myCenter/logion'
  228. // })
  229. // }
  230. // },
  231. // 订单退款售后列表
  232. refund() {
  233. this.request({
  234. url: '/v3/order/refund_list',
  235. method: 'POST',
  236. data: {
  237. state: this.state,
  238. page: this.page,
  239. page_size: 10
  240. },
  241. success: (res) => {
  242. console.log(res.data.data.refund_list);
  243. if(res.data.data.refund_list.length< 10) {
  244. this.ispull = false;
  245. }
  246. res.data.data.refund_list.forEach((item,index) => {
  247. // item.goods.forEach(items => {
  248. let arr = item.goods_name.split(' ');
  249. item.desarray = arr[0];
  250. item.descire = item.goods_name.replace(arr[0], '');
  251. // })
  252. })
  253. this.order_list = this.order_list.concat(res.data.data.refund_list);
  254. }
  255. })
  256. },
  257. // 订单列表
  258. getlist() {
  259. this.request({
  260. url: '/v2/order/orders',
  261. method: 'POST',
  262. data: {
  263. state: this.state,
  264. page: this.page,
  265. page_size: 10
  266. },
  267. success: (res) => {
  268. if(res.data.data.order_list.length< 10) {
  269. this.ispull = false;
  270. }
  271. res.data.data.order_list.forEach((item,index) => {
  272. item.goods.forEach(items => {
  273. let arr = items.goods_name.split(' ');
  274. items.desarray = arr[0];
  275. items.descire = items.goods_name.replace(arr[0], '');
  276. })
  277. })
  278. // let arr = item.goods_name.split(' ');
  279. // item.desarray = arr[0];
  280. // item.descire = arr.replace(arr[0], '');
  281. this.order_list = this.order_list.concat(res.data.data.order_list);
  282. }
  283. })
  284. },
  285. gopay(e) {
  286. console.log(e);
  287. let prices = e.order_amount;
  288. this.order_id = e.order_id;
  289. let order_id = e.order_id;
  290. if(e.operate == '去付款') {
  291. uni.navigateTo({
  292. url:`/pages/myOrder/paymoment?order_id=${order_id}&prices=${prices}`
  293. })
  294. }else if(e.operate == '删除') {
  295. this.titles = '确认删除订单?'
  296. this.deleteorder = 1;
  297. this.orderCancel = true;
  298. }else if(e.operate == '催单') {
  299. let a = 1;
  300. uni.navigateTo({
  301. url:`/pages/myOrder/reminder?order_id=${order_id}&a=${a}`
  302. })
  303. }else if(e.operate == '确认收货') {
  304. this.deleteorder = 2;
  305. this.titles = '确认收货?'
  306. this.orderCancel = true;
  307. }else if(e.operate == '去评价') {
  308. uni.navigateTo({
  309. url:`/pages/myOrder/estimate?order_id=${order_id}`
  310. })
  311. }else if(e.operate == '联系酒店') {
  312. let a = 2;
  313. uni.navigateTo({
  314. url:`/pages/myOrder/reminder?order_id=${order_id}&a=${a}`
  315. })
  316. }
  317. },
  318. cancelDialog() {
  319. this.orderCancel = false;
  320. },
  321. confirmOrder() {
  322. // 删除订单 确认收货
  323. this.orderCancel = false;
  324. let url = this.deleteorder == 1?'/v2/order/drop':'/v2/order/confirm';
  325. this.request({
  326. url: url,
  327. method:'POST',
  328. data: {
  329. order_id: this.order_id
  330. },
  331. success: (res) => {
  332. this.order_list = [];
  333. this.page = 1;
  334. this.ispull = true;
  335. this.getlist();
  336. }
  337. })
  338. },
  339. goDetail(e) {
  340. let order_id = e;
  341. uni.navigateTo({
  342. url: `/pages/myOrder/order?id=${order_id}`
  343. });
  344. },
  345. upper(e) {
  346. console.log(e)
  347. console.log("顶部")
  348. },
  349. // 滚到底部
  350. lower(e) {
  351. if(this.ispull) {
  352. console.log("l;ll")
  353. this.page += 1;
  354. this.getlist();
  355. }
  356. },
  357. // 滚动时触发
  358. scroll(e) {
  359. if(e.detail.scrollTop > 400) {
  360. this.isTop = true;
  361. }else{ //当距离小于500时显示回到顶部按钮
  362. this.isTop = false;
  363. }
  364. this.old.scrollTop = e.detail.scrollTop
  365. }
  366. }
  367. }
  368. </script>
  369. <style>
  370. page {
  371. background-color: #F5F5F5;
  372. }
  373. .cart-list {
  374. background-color: #fff;
  375. border-top: 12upx solid #F5F5F5;
  376. }
  377. .topTip {
  378. display: flex;
  379. align-items: center;
  380. justify-content: space-between;
  381. padding: 20upx 36upx;
  382. border-bottom: 1px solid #F5F5F5;
  383. }
  384. .changewidth {
  385. color: #303133;
  386. font-size: 32upx;
  387. font-weight: 100!important;
  388. }
  389. .van-card__desc {
  390. font-size: 25rpx;
  391. color: #999!important;
  392. padding-top: 10rpx;
  393. }
  394. .priceClass {
  395. color:#303133!important;
  396. font-size: 36upx;
  397. font-weight: normal!important;
  398. }
  399. .van-card {
  400. background-color: #fff!important;
  401. }
  402. .shoplist {
  403. display: flex;
  404. justify-content: space-between;
  405. align-items: center;
  406. }
  407. .deleChange {
  408. border: 1px solid #C0C4CC;
  409. padding: 8upx;
  410. }
  411. </style>