index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  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.payTime}}出发/{{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||'../../../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.typeTxt) {
  161. const typeTxt = option.typeTxt;
  162. //其他页面入参
  163. if (typeTxt =='待付款') {
  164. this.changeStatus(1)
  165. } else if (typeTxt =='待使用') {
  166. this.changeStatus(2)
  167. } else if (typeTxt =='已完成') {
  168. this.changeStatus(3)
  169. } else if (typeTxt == '退款售后') {
  170. this.changeStatus(4)
  171. }else if (typeTxt == '已取消') {
  172. this.changeStatus(0)
  173. }
  174. } else {
  175. if(this.merchantType==10){
  176. this.getOrderList()
  177. }else{
  178. this.getOrderList2()
  179. }
  180. }
  181. },
  182. methods: {
  183. // 去详情
  184. navTo(item) {
  185. uni.navigateTo({
  186. url: '/pagesHouse/Mine/ordersList/details/details?orderCode=' + item.orderCode
  187. })
  188. },
  189. hexiao(item) {
  190. let that = this;
  191. uni.showModal({
  192. title: '提示',
  193. content: '确定核销订单?',
  194. success: function(res) {
  195. if (res.confirm) {
  196. that.$api.get('/scenic/order/orderWriteOff/'+item.orderCode).then(res => {
  197. if (res.data.code === 0) {
  198. that.$showToast('订单已核销');
  199. that.init();
  200. } else that.$showToast(res.data.msg)
  201. })
  202. }
  203. }
  204. });
  205. },
  206. // 核销餐饮
  207. hexiao2(item) {
  208. let that = this;
  209. uni.showModal({
  210. title: '提示',
  211. content: '确定核销订单?',
  212. success: function(res) {
  213. if (res.confirm) {
  214. that.$api.post('/api/merchant/food/scenic/merchant/order/verifyOrderQrCode', {
  215. merchantId: that.merchantId,
  216. orderCode: item.orderCode,
  217. type: 4
  218. }).then(res => {
  219. if (res.data.code === 0) {
  220. that.$showToast('订单已核销');
  221. that.init();
  222. } else that.$showToast(res.data.msg)
  223. })
  224. }
  225. }
  226. });
  227. },
  228. init() {
  229. this.pageIndex = 1;
  230. this.dataList = [];
  231. if(this.merchantType==10){
  232. this.getOrderList()
  233. }else{
  234. this.getOrderList2()
  235. }
  236. },
  237. changeStatus(index) {
  238. this.current=index;
  239. if(this.merchantType==10){
  240. if (index === 0) this.status = '';
  241. else if (index === 1) this.status = '0'
  242. else if (index === 2) this.status = '1';
  243. else if (index === 3) this.status = '3,7';
  244. else if (index === 4) this.status = '4,5';
  245. }else{
  246. if (index === 0) this.state = '';
  247. else if (index === 1) this.state = '0'
  248. else if (index === 2) this.state = '4';
  249. else if (index === 3) this.state = '3';
  250. else if (index === 4) this.state = '-3';
  251. }
  252. this.init();
  253. },
  254. //渔家乐订单
  255. getOrderList() {
  256. let that = this;
  257. this.$api.get('/api/fishering/personCenterPage', {
  258. merchantId: this.merchantId,
  259. status: this.status,
  260. page: this.pageIndex,
  261. limit: this.pageCount,
  262. }).then(res => {
  263. if (res.data.code === 0) {
  264. let {
  265. list,
  266. total
  267. } = res.data.data;
  268. that.dataList = [...that.dataList, ...list];
  269. if (res.data.data.list.length < 10) {
  270. this.disScroll = true;
  271. } else {
  272. that.pageIndex++;
  273. }
  274. } else that.$showToast(res.data.msg);
  275. })
  276. },
  277. getOrderList2() {
  278. let that = this;
  279. this.$api.get('/api/merchant/food/queryPageMerchantOrder', {
  280. merchantId: this.merchantId,
  281. state: this.state,
  282. page: this.pageIndex,
  283. limit: this.pageCount,
  284. }).then(res => {
  285. if (res.data.code === 0) {
  286. let {
  287. list,
  288. total
  289. } = res.data.data;
  290. that.dataList = [...that.dataList, ...list];
  291. if (res.data.data.list.length < 10) {
  292. this.disScroll = true;
  293. } else {
  294. that.pageIndex++;
  295. }
  296. } else that.$showToast(res.data.msg);
  297. })
  298. },
  299. }
  300. }
  301. </script>
  302. <style lang="scss" scoped>
  303. .textQx {
  304. color: #999;
  305. }
  306. .textDcx {
  307. color: #333333;
  308. }
  309. .textDzf {
  310. color: #FF7D01;
  311. }
  312. .pages {
  313. // background: #F9FAFC;
  314. box-sizing: border-box;
  315. padding-bottom: 50rpx;
  316. .tb {
  317. width: 100%;
  318. top: 0;
  319. left: 0;
  320. z-index: 999;
  321. .searchBoxParent {
  322. width: 100%;
  323. background: #fff;
  324. padding: 20rpx 24rpx 6rpx;
  325. box-sizing: border-box;
  326. .searchBox {
  327. width: 100%;
  328. background-color: #fff;
  329. }
  330. }
  331. .tabs {
  332. background: #fff;
  333. padding: 26rpx 0;
  334. display: flex;
  335. align-items: center;
  336. width: 100%;
  337. &>view {
  338. width: 25%;
  339. font-size: 28rpx;
  340. font-family: PingFangSC-Regular, PingFang SC;
  341. font-weight: 400;
  342. color: black;
  343. line-height: 40rpx;
  344. position: relative;
  345. text-align: center;
  346. }
  347. .active {
  348. font-size: 32rpx;
  349. font-family: PingFang-SC-Bold, PingFang-SC;
  350. font-weight: bold;
  351. color: black;
  352. line-height: 45rpx;
  353. }
  354. .active::after {
  355. position: absolute;
  356. content: '';
  357. width: 50rpx;
  358. height: 8rpx;
  359. background: #007A69;
  360. bottom: -26rpx;
  361. left: 60%;
  362. margin-left: -42rpx;
  363. }
  364. }
  365. }
  366. .green {}
  367. .mainContain {
  368. display: flex;
  369. flex-direction: column;
  370. padding: 0 20rpx;
  371. .nodata {
  372. background: white;
  373. }
  374. .card {
  375. background: #fff;
  376. border-radius: 16rpx;
  377. margin: 20rpx 0;
  378. padding: 0 24rpx 30rpx;
  379. .header {
  380. display: flex;
  381. justify-content: space-between;
  382. padding: 34rpx 0;
  383. font-size: 28rpx;
  384. }
  385. .mainContent {
  386. display: flex;
  387. .image {
  388. background-repeat: no-repeat;
  389. background-size: cover;
  390. width: 136rpx;
  391. min-width: 136rpx;
  392. height: 136rpx;
  393. border-radius: 12rpx;
  394. }
  395. .middle {
  396. color: #777777;
  397. margin-left: 20rpx;
  398. width: 100%;
  399. .title {
  400. font-weight: bold;
  401. font-size: 30rpx;
  402. margin: 16rpx 0 30rpx;
  403. }
  404. .info {
  405. font-size: 26rpx;
  406. color: #777777;
  407. }
  408. }
  409. .price {
  410. color: red;
  411. text-align: center;
  412. height: 100%;
  413. align-items: center;
  414. align-self: center;
  415. font-size: 29rpx;
  416. font-weight: 700;
  417. }
  418. }
  419. .bottom {
  420. display: flex;
  421. justify-content: flex-end;
  422. margin-top: 16rpx;
  423. .detail {
  424. border-radius: 16rpx;
  425. color: darkgrey;
  426. padding: 13rpx 34rpx;
  427. background-color: #F6F6F6;
  428. font-size: 26rpx;
  429. color: #333333;
  430. font-weight: Regular;
  431. }
  432. .s1 {
  433. border-radius: 16rpx;
  434. color: darkgrey;
  435. padding: 13rpx 34rpx;
  436. background-color: #007A69;
  437. font-size: 26rpx;
  438. color: #fff;
  439. font-weight: Regular;
  440. }
  441. }
  442. }
  443. }
  444. }
  445. </style>