index.vue 11 KB

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