orderdetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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="false">
  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. if(res.data.data.refund_list.length< 10) {
  243. this.ispull = false;
  244. }
  245. res.data.data.refund_list.forEach((item,index) => {
  246. // item.goods.forEach(items => {
  247. let arr = item.goods_name.split(' ');
  248. item.desarray = arr[0];
  249. item.descire = item.goods_name.replace(arr[0], '');
  250. // })
  251. })
  252. this.order_list = this.order_list.concat(res.data.data.refund_list);
  253. }
  254. })
  255. },
  256. // 订单列表
  257. getlist() {
  258. this.request({
  259. url: '/v2/order/orders',
  260. method: 'POST',
  261. data: {
  262. state: this.state,
  263. page: this.page,
  264. page_size: 10
  265. },
  266. success: (res) => {
  267. if(res.data.data.order_list.length< 10) {
  268. this.ispull = false;
  269. }
  270. res.data.data.order_list.forEach((item,index) => {
  271. item.goods.forEach(items => {
  272. let arr = items.goods_name.split(' ');
  273. items.desarray = arr[0];
  274. items.descire = items.goods_name.replace(arr[0], '');
  275. })
  276. })
  277. // let arr = item.goods_name.split(' ');
  278. // item.desarray = arr[0];
  279. // item.descire = arr.replace(arr[0], '');
  280. this.order_list = this.order_list.concat(res.data.data.order_list);
  281. }
  282. })
  283. },
  284. gopay(e) {
  285. let prices = e.order_amount;
  286. this.order_id = e.order_id;
  287. let order_id = e.order_id;
  288. if(e.operate == '去付款') {
  289. uni.navigateTo({
  290. url:`/pages/myOrder/paymoment?order_id=${order_id}&prices=${prices}`
  291. })
  292. }else if(e.operate == '删除') {
  293. this.titles = '确认删除订单?'
  294. this.deleteorder = 1;
  295. this.orderCancel = true;
  296. }else if(e.operate == '催单') {
  297. let a = 1;
  298. uni.navigateTo({
  299. url:`/pages/myOrder/reminder?order_id=${order_id}&a=${a}`
  300. })
  301. }else if(e.operate == '确认收货') {
  302. this.deleteorder = 2;
  303. this.titles = '确认收货?'
  304. this.orderCancel = true;
  305. }else if(e.operate == '去评价') {
  306. uni.navigateTo({
  307. url:`/pages/myOrder/estimate?order_id=${order_id}`
  308. })
  309. }else if(e.operate == '联系酒店') {
  310. let a = 2;
  311. uni.navigateTo({
  312. url:`/pages/myOrder/reminder?order_id=${order_id}&a=${a}`
  313. })
  314. }
  315. },
  316. cancelDialog() {
  317. this.orderCancel = false;
  318. },
  319. confirmOrder() {
  320. // 删除订单 确认收货
  321. this.orderCancel = false;
  322. let url = this.deleteorder == 1?'/v2/order/drop':'/v2/order/confirm';
  323. this.request({
  324. url: url,
  325. method:'POST',
  326. data: {
  327. order_id: this.order_id
  328. },
  329. success: (res) => {
  330. this.order_list = [];
  331. this.page = 1;
  332. this.ispull = true;
  333. this.getlist();
  334. }
  335. })
  336. },
  337. goDetail(e) {
  338. let order_id = e;
  339. uni.navigateTo({
  340. url: `/pages/myOrder/order?id=${order_id}`
  341. });
  342. },
  343. upper(e) {
  344. console.log(e)
  345. console.log("顶部")
  346. },
  347. // 滚到底部
  348. lower(e) {
  349. if(this.ispull) {
  350. this.page += 1;
  351. this.getlist();
  352. }
  353. },
  354. // 滚动时触发
  355. scroll(e) {
  356. if(e.detail.scrollTop > 400) {
  357. this.isTop = true;
  358. }else{ //当距离小于500时显示回到顶部按钮
  359. this.isTop = false;
  360. }
  361. this.old.scrollTop = e.detail.scrollTop
  362. }
  363. }
  364. }
  365. </script>
  366. <style>
  367. page {
  368. background-color: #F5F5F5;
  369. }
  370. .cart-list {
  371. background-color: #fff;
  372. border-top: 12upx solid #F5F5F5;
  373. }
  374. .topTip {
  375. display: flex;
  376. align-items: center;
  377. justify-content: space-between;
  378. padding: 20upx 36upx;
  379. border-bottom: 1px solid #F5F5F5;
  380. }
  381. .changewidth {
  382. color: #303133;
  383. font-size: 32upx;
  384. font-weight: 100!important;
  385. }
  386. .van-card__desc {
  387. font-size: 25rpx;
  388. color: #999!important;
  389. padding-top: 10rpx;
  390. }
  391. .priceClass {
  392. color:#303133!important;
  393. font-size: 36upx;
  394. font-weight: normal!important;
  395. }
  396. .van-card {
  397. background-color: #fff!important;
  398. }
  399. .shoplist {
  400. display: flex;
  401. justify-content: space-between;
  402. align-items: center;
  403. }
  404. .deleChange {
  405. border: 1px solid #C0C4CC;
  406. padding: 8upx;
  407. }
  408. </style>