index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. <template>
  2. <view class="pages" :style="{'min-height':h+'px','padding-top':(mt)+'px'}">
  3. <c-nav-bar title="我的订单"></c-nav-bar>
  4. <view class="tb">
  5. <view class="tabs">
  6. <view v-for="(item,index) in tabList" :key="index" @tap="changeStatus(index)">
  7. <text :class="index===current?'active':''">{{item.name}}</text>
  8. </view>
  9. </view>
  10. </view>
  11. <view class="mainContain">
  12. <view v-if="dataList.length>0" class="card" v-for="item,index in dataList" :key="index">
  13. <template v-if="merchantType==10">
  14. <view class="header">
  15. <text style="font-weight: bold;">{{item.playDate}} {{item.playTime}}出发/{{item.orderType==3?'拼船':'包船'}}</text>
  16. <text :class="oscConfig[item.status]||'textDcx'">{{FishJialeOcfg[item.status]}}</text>
  17. </view>
  18. <view class="mainContent" @tap="navTo(item)">
  19. <image class="image" :src="item.coverImg||'../../../static/orderEg.png'" mode="aspectFill">
  20. </image>
  21. <view class="middle">
  22. <view class="title" style="display: flex; justify-content: space-between;">
  23. <span> {{item.goodsNameAndType}}</span>
  24. <span> ¥{{item.totalPrice}}</span>
  25. </view>
  26. <span class='info' style="display: flex; justify-content: space-between;">
  27. <span>
  28. <span style="margin-right: 15rpx;">{{item.linkName}}</span>
  29. <span>{{item.linkPhone}}</span>
  30. </span>
  31. <span>x{{item.num}}</span>
  32. </span>
  33. </view>
  34. </view>
  35. </template>
  36. <template v-if="merchantType==4">
  37. <view class="header">
  38. <text style="font-weight: bold;">{{item.merchantName}}</text>
  39. <text :class="oscConfig2[item.orderStatus]||'textDcx'">{{FishJialeOcfg2[item.orderStatus]}}</text>
  40. </view>
  41. <view class="mainContent" @tap="navTo(item)">
  42. <image class="image" :src="item.productImg&&item.productImg.split(',')[0]||'../../../static/orderEg.png'" mode="aspectFill">
  43. </image>
  44. <view class="middle">
  45. <view class="title" style="display: flex; justify-content: space-between;">
  46. <span> {{item.productName}}</span>
  47. <span> ¥{{item.realityPay}}</span>
  48. </view>
  49. <span class='info' style="display: flex; justify-content: space-between;">
  50. <span>
  51. <span style="margin-right: 15rpx;">{{item.activityStartTime||''}}至{{item.activityEndTime}}</span>
  52. </span>
  53. <span>x{{item.num}}</span>
  54. </span>
  55. </view>
  56. </view>
  57. <!-- 待使用 -->
  58. <view class="bottom" @click="hexiao2(item)" v-if="item.state==1">
  59. <view class="detail s1">
  60. 核销订单
  61. </view>
  62. </view>
  63. </template>
  64. </view>
  65. <view class="nodata" v-if='dataList.length==0'>
  66. <NoData></NoData>
  67. </view>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. import TopTabs from '@/components/TopTabs/topTabs.vue';
  73. // import NoData from '../../components/NoData/index.vue';
  74. export default {
  75. components: {
  76. TopTabs,
  77. // NoData
  78. },
  79. data() {
  80. return {
  81. //渔家乐
  82. FishJialeOcfg: {
  83. 0: '待支付',
  84. 1: '待使用',
  85. 2: '拼船中',
  86. 3: '已使用',
  87. 4: '退款中',
  88. 5: '已退款',
  89. 6: '已取消',
  90. 7: '已完成',
  91. 8: '拼团失败'
  92. },
  93. //餐饮
  94. FishJialeOcfg2: {
  95. 0: '待支付',
  96. 4: '待使用',
  97. 3: '已完成',
  98. '-1': '已取消',
  99. '-2': '退款中',
  100. '-3': '已退款',
  101. },
  102. oscConfig2: {
  103. 0: 'textDzf',
  104. 4: 'textDcx',
  105. 3: 'textQx',
  106. '-1': 'textQx',
  107. '-2': 'textQx',
  108. '-3': 'textQx',
  109. },
  110. oscConfig: {
  111. 0: 'textDzf',
  112. 1: 'textDcx',
  113. 2: 'textDcx',
  114. 3: 'textQx',
  115. 4: 'textQx',
  116. 5: 'textQx',
  117. 6: 'textQx',
  118. 7: 'textQx',
  119. 8: 'textQx',
  120. },
  121. disScroll: false,
  122. pageIndex: 1,
  123. pageCount: 50,
  124. current: 0,
  125. dataList: [],
  126. status: '',
  127. state:'',
  128. merchantId: uni.getStorageSync('merchantId'),
  129. merchantType: uni.getStorageSync('merchantType'),
  130. tabList: [{
  131. name: '全部订单'
  132. },
  133. {
  134. name: '待支付'
  135. },
  136. {
  137. name: '待使用'
  138. },
  139. {
  140. name: '已完成'
  141. },
  142. {
  143. name: '退款/售后'
  144. },
  145. ],
  146. }
  147. },
  148. onLoad(option) {
  149. if (option.index>=0) {
  150. const index = option.index;
  151. //其他页面入参
  152. if (index == 0) {
  153. this.changeStatus(1)
  154. } else if (index == 1) {
  155. this.changeStatus(2)
  156. } else if (index == 2) {
  157. this.changeStatus(3)
  158. } else if (index == 3) {
  159. this.changeStatus(4)
  160. }else {
  161. this.changeStatus(0)
  162. }
  163. }else if (option.typeTxt) {
  164. const typeTxt = option.typeTxt;
  165. //其他页面入参
  166. if (typeTxt =='待付款') {
  167. this.changeStatus(1)
  168. } else if (typeTxt =='待使用') {
  169. this.changeStatus(2)
  170. } else if (typeTxt =='已完成') {
  171. this.changeStatus(3)
  172. } else if (typeTxt == '退款售后') {
  173. this.changeStatus(4)
  174. }else if (typeTxt == '已取消') {
  175. this.changeStatus(0)
  176. }
  177. } else {
  178. if(this.merchantType==10){
  179. this.getOrderList()
  180. }else{
  181. this.getOrderList2()
  182. }
  183. }
  184. },
  185. methods: {
  186. // 去详情
  187. navTo(item) {
  188. uni.navigateTo({
  189. url: '/pagesHouse/Mine/ordersList/details/details?orderCode=' + item.orderCode
  190. })
  191. },
  192. hexiao(item) {
  193. let that = this;
  194. uni.showModal({
  195. title: '提示',
  196. content: '确定核销订单?',
  197. success: function(res) {
  198. if (res.confirm) {
  199. that.$api.get('/scenic/order/orderWriteOff/'+item.orderCode).then(res => {
  200. if (res.data.code === 0) {
  201. that.$showToast('订单已核销');
  202. that.init();
  203. } else that.$showToast(res.data.msg)
  204. })
  205. }
  206. }
  207. });
  208. },
  209. // 核销餐饮
  210. hexiao2(item) {
  211. let that = this;
  212. uni.showModal({
  213. title: '提示',
  214. content: '确定核销订单?',
  215. success: function(res) {
  216. if (res.confirm) {
  217. that.$api.post('/api/merchant/food/scenic/merchant/order/verifyOrderQrCode', {
  218. merchantId: that.merchantId,
  219. orderCode: item.orderCode,
  220. type: 4
  221. }).then(res => {
  222. if (res.data.code === 0) {
  223. that.$showToast('订单已核销');
  224. that.init();
  225. } else that.$showToast(res.data.msg)
  226. })
  227. }
  228. }
  229. });
  230. },
  231. init() {
  232. this.pageIndex = 1;
  233. this.dataList = [];
  234. if(this.merchantType==10){
  235. this.getOrderList()
  236. }else{
  237. this.getOrderList2()
  238. }
  239. },
  240. changeStatus(index) {
  241. this.current=index;
  242. if(this.merchantType==10){
  243. if (index === 0) this.status = '';
  244. else if (index === 1) this.status = '0'
  245. else if (index === 2) this.status = '1';
  246. else if (index === 3) this.status = '3,7';
  247. else if (index === 4) this.status = '4,5';
  248. }else{
  249. if (index === 0) this.state = '';
  250. else if (index === 1) this.state = '0'
  251. else if (index === 2) this.state = '4';
  252. else if (index === 3) this.state = '3';
  253. else if (index === 4) this.state = '-3';
  254. }
  255. this.init();
  256. },
  257. //渔家乐订单
  258. getOrderList() {
  259. let that = this;
  260. this.$api.get('/api/fishering/personCenterPage', {
  261. merchantId: this.merchantId,
  262. status: this.status,
  263. page: this.pageIndex,
  264. limit: this.pageCount,
  265. }).then(res => {
  266. if (res.data.code === 0) {
  267. let {
  268. list,
  269. total
  270. } = res.data.data;
  271. that.dataList = [...that.dataList, ...list];
  272. if (res.data.data.list.length < 10) {
  273. this.disScroll = true;
  274. } else {
  275. that.pageIndex++;
  276. }
  277. } else that.$showToast(res.data.msg);
  278. })
  279. },
  280. getOrderList2() {
  281. let that = this;
  282. this.$api.get('/api/merchant/food/queryPageMerchantOrder', {
  283. merchantId: this.merchantId,
  284. state: this.state,
  285. page: this.pageIndex,
  286. limit: this.pageCount,
  287. }).then(res => {
  288. if (res.data.code === 0) {
  289. let {
  290. list,
  291. total
  292. } = res.data.data;
  293. that.dataList = [...that.dataList, ...list];
  294. if (res.data.data.list.length < 10) {
  295. this.disScroll = true;
  296. } else {
  297. that.pageIndex++;
  298. }
  299. } else that.$showToast(res.data.msg);
  300. })
  301. },
  302. }
  303. }
  304. </script>
  305. <style lang="scss" scoped>
  306. .textQx {
  307. color: #999;
  308. }
  309. .textDcx {
  310. color: #333333;
  311. }
  312. .textDzf {
  313. color: #FF7D01;
  314. }
  315. .pages {
  316. // background: #F9FAFC;
  317. box-sizing: border-box;
  318. padding-bottom: 50rpx;
  319. .tb {
  320. width: 100%;
  321. top: 0;
  322. left: 0;
  323. z-index: 999;
  324. .searchBoxParent {
  325. width: 100%;
  326. background: #fff;
  327. padding: 20rpx 24rpx 6rpx;
  328. box-sizing: border-box;
  329. .searchBox {
  330. width: 100%;
  331. background-color: #fff;
  332. }
  333. }
  334. .tabs {
  335. background: #fff;
  336. padding: 26rpx 0;
  337. display: flex;
  338. align-items: center;
  339. width: 100%;
  340. &>view {
  341. width: 25%;
  342. font-size: 28rpx;
  343. font-family: PingFangSC-Regular, PingFang SC;
  344. font-weight: 400;
  345. color: black;
  346. line-height: 40rpx;
  347. position: relative;
  348. text-align: center;
  349. }
  350. .active {
  351. font-size: 32rpx;
  352. font-family: PingFang-SC-Bold, PingFang-SC;
  353. font-weight: bold;
  354. color: black;
  355. line-height: 45rpx;
  356. }
  357. .active::after {
  358. position: absolute;
  359. content: '';
  360. width: 50rpx;
  361. height: 8rpx;
  362. background: #007A69;
  363. bottom: -26rpx;
  364. left: 60%;
  365. margin-left: -42rpx;
  366. }
  367. }
  368. }
  369. .green {}
  370. .mainContain {
  371. display: flex;
  372. flex-direction: column;
  373. padding: 0 20rpx;
  374. .nodata {
  375. background: white;
  376. }
  377. .card {
  378. background: #fff;
  379. border-radius: 16rpx;
  380. margin: 20rpx 0;
  381. padding: 0 24rpx 30rpx;
  382. .header {
  383. display: flex;
  384. justify-content: space-between;
  385. padding: 34rpx 0;
  386. font-size: 28rpx;
  387. }
  388. .mainContent {
  389. display: flex;
  390. .image {
  391. background-repeat: no-repeat;
  392. background-size: cover;
  393. width: 136rpx;
  394. min-width: 136rpx;
  395. height: 136rpx;
  396. border-radius: 12rpx;
  397. }
  398. .middle {
  399. color: #777777;
  400. margin-left: 20rpx;
  401. width: 100%;
  402. .title {
  403. font-weight: bold;
  404. font-size: 30rpx;
  405. margin: 16rpx 0 30rpx;
  406. }
  407. .info {
  408. font-size: 26rpx;
  409. color: #777777;
  410. }
  411. }
  412. .price {
  413. color: red;
  414. text-align: center;
  415. height: 100%;
  416. align-items: center;
  417. align-self: center;
  418. font-size: 29rpx;
  419. font-weight: 700;
  420. }
  421. }
  422. .bottom {
  423. display: flex;
  424. justify-content: flex-end;
  425. margin-top: 16rpx;
  426. .detail {
  427. border-radius: 16rpx;
  428. color: darkgrey;
  429. padding: 13rpx 34rpx;
  430. background-color: #F6F6F6;
  431. font-size: 26rpx;
  432. color: #333333;
  433. font-weight: Regular;
  434. }
  435. .s1 {
  436. border-radius: 16rpx;
  437. color: darkgrey;
  438. padding: 13rpx 34rpx;
  439. background-color: #007A69;
  440. font-size: 26rpx;
  441. color: #fff;
  442. font-weight: Regular;
  443. }
  444. }
  445. }
  446. }
  447. }
  448. </style>