buyorder.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. <template>
  2. <view class="app">
  3. <view></view>
  4. <view></view>
  5. <view class="box-nav">
  6. <view class="bn fx-r">
  7. <view v-for="(item,index) of navList" :key="index" class="bn-item fx-h fx-bc fx-ac"
  8. @tap="tapChange(index)">
  9. <view class="bni" :class="[current == index ? 'select':'']">{{item.name}}
  10. </view>
  11. <view class="ii" v-if="item.count > 0"></view>
  12. </view>
  13. </view>
  14. </view>
  15. <scroll-view scroll-y class="scroll" :style="'height: calc(100vh - 45vw - ' + statusBarHeight + 'px - 44px);'"
  16. @scrolltolower="onBottom">
  17. <view class="fx-h fx-bc fx-ac select-time">
  18. <view class="week fx-r" hidden>
  19. <view class="item" :class="item.value == week ? 'on' : ''" @tap="tapWeek(item)"
  20. v-for="item in weekAr">{{ item.name }}</view>
  21. </view>
  22. <view class="date-time fx-r fx-bc fx-ac" hidden @tap="isDateTimeOpen()">
  23. <image src="/static/img/datetime.png" class="time"></image>
  24. <view v-if="dateTime != ''">{{ dateTime }}</view>
  25. <view v-else>选择时间</view>
  26. </view>
  27. </view>
  28. <view class="app-body">
  29. <view class="order-item" v-for="item in orderList" @tap="tapItem(item)">
  30. <view class="order-itop fx-r">
  31. <view class="order-id">{{ item.order_id }}</view>
  32. <view class="fx-g1"></view>
  33. <view class="status" v-if="item.status == 0">已过期</view>
  34. <view class="status" v-if="item.status == 1">待支付</view>
  35. <view class="status" v-if="item.status == 2">待审核</view>
  36. <template v-if="current == 3">
  37. <view class="status" v-if="item.status == 3">挂售</view>
  38. </template>
  39. <template v-else>
  40. <view class="status" v-if="item.status == 3">完成</view>
  41. </template>
  42. </view>
  43. <view class="goods-item fx-r fx-bc">
  44. <image :src="item.image" class="img" mode="aspectFill"></image>
  45. <view class="info">
  46. <view class="title">{{ item.name }}</view>
  47. <view class="price">¥{{ item.price }}</view>
  48. </view>
  49. <view class="fx-g1"></view>
  50. <view class="count">x1</view>
  51. </view>
  52. <view class="fx-r fx-be order-foot">
  53. <view class="time"> {{ item.create_time }}</view>
  54. <view class="fx-g1"></view>
  55. <view class="ii">共</view>
  56. <view class="i2">1</view>
  57. <view class="i2">实付款</view>
  58. <view class="ii">¥</view>
  59. <view class="price">{{ item.price }}</view>
  60. </view>
  61. <view class="order-btn" v-if="item.status == 1">
  62. <view v-if="item.overtime_type == 0" class="fx-r" style="font-size:12px;color: #787878;">
  63. 离超时:
  64. <countdown :startTime="utils.date('Y-m-d H:i:s')"
  65. :endTime="utils.date('Y-m-d H:i:s',item.end_time_one)" />
  66. </view>
  67. <view v-if="item.overtime_type == 1" class="fx-r" style="font-size:12px;color: #787878;">
  68. 离过期:
  69. <countdown :startTime="utils.date('Y-m-d H:i:s')"
  70. :endTime="utils.date('Y-m-d H:i:s',item.end_time_two)" />
  71. </view>
  72. <view class="fx-g1"></view>
  73. <view class="btn" @tap.stop="tapPay(item)">立即支付</view>
  74. </view>
  75. <view class="order-btn" v-if="item.status == 2">
  76. <view class="btn" @tap.stop="tapPay(item)">修改凭证</view>
  77. </view>
  78. <view class="order-btn" v-if="item.status == 3 && current == 3">
  79. <view class="btn" @tap.stop="tapPutSalt(item)">立即挂售</view>
  80. </view>
  81. </view>
  82. <uv-empty v-if="orderList.length == 0" mode="data" icon="/static/img/no-empty.png"></uv-empty>
  83. <view v-if="orderList.length > 0">
  84. <view class="loading fx-r fx-ac fx-bc" v-if="page.isFrite && !page.isFoot">
  85. <image src="/static/img/xloading.png"></image>
  86. <text>正在载入更多...</text>
  87. </view>
  88. <view class="loading complete" :hidden="!page.isFoot">已加载全部</view>
  89. </view>
  90. </view>
  91. </scroll-view>
  92. <uv-datetime-picker ref="datetimePicker" v-model="dateTimeNum" mode="date" closeOnClickOverlay @confirm="tapDateTime"></uv-datetime-picker>
  93. </view>
  94. </template>
  95. <script>
  96. import {
  97. mapState,
  98. mapMutations
  99. } from 'vuex';
  100. import dayjs from 'dayjs';
  101. import countdown from "@/components/cz-countdown/cz-countdown.vue";
  102. import {
  103. stringify
  104. } from 'uuid';
  105. export default {
  106. computed: mapState(['user']),
  107. components: {
  108. countdown
  109. },
  110. name: "buyorder",
  111. data() {
  112. return {
  113. statusBarHeight: 20,
  114. page: {
  115. isFirst: false,
  116. isLoad: false,
  117. isFoot: false,
  118. page: 1
  119. },
  120. dateTime: "",
  121. dateTimeNum: Number(new Date()),
  122. week: "",
  123. weekAr: [{
  124. name: "周一",
  125. value: 1
  126. },
  127. {
  128. name: "周二",
  129. value: 2
  130. },
  131. {
  132. name: "周三",
  133. value: 3
  134. },
  135. {
  136. name: "周四",
  137. value: 4
  138. },
  139. {
  140. name: "周五",
  141. value: 5
  142. },
  143. {
  144. name: "周六",
  145. value: 6
  146. },
  147. {
  148. name: "周日",
  149. value: 7
  150. }
  151. ],
  152. minData: "",
  153. orderList: [],
  154. current: 0,
  155. navList: [{
  156. "name": "全部",
  157. "code": "",
  158. "count": 0
  159. },
  160. {
  161. "name": "待支付",
  162. "code": 1,
  163. "count": 0
  164. },
  165. {
  166. "name": "待审核",
  167. "code": 2,
  168. "count": 0
  169. },
  170. {
  171. "name": "待挂售",
  172. "code": 4,
  173. "count": 0
  174. },
  175. ]
  176. }
  177. },
  178. methods: {
  179. /**
  180. * 加载基础配置
  181. */
  182. initView: function() {
  183. this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  184. this.getData(true);
  185. this.ckInit();
  186. this.minData = dayjs().subtract(10, 'month').format('YYYY-MM-DD');
  187. },
  188. tapChange: function(ev) {
  189. this.current = ev;
  190. this.getData(true);
  191. },
  192. onBottom() {
  193. if (this.page.isFoot || this.page.isLoad) {
  194. return;
  195. }
  196. this.page.page++;
  197. this.getData();
  198. },
  199. /**
  200. * 待支付
  201. */
  202. tapPay: function(item) {
  203. uni.navigateTo({
  204. url: "/pages/guild/order/hallpay?id=" + item.id
  205. })
  206. },
  207. /**
  208. * 查看详情
  209. * @param {Object} item
  210. */
  211. tapItem: function(item) {
  212. uni.navigateTo({
  213. url: "/pages/guild/order/orderItem?id=" + item.id
  214. })
  215. },
  216. /**
  217. * 我要挂售
  218. * @param {Object} item
  219. */
  220. tapPutSalt: function(item) {
  221. uni.navigateTo({
  222. url: "/pages/guild/order/putSalt?id=" + item.id
  223. });
  224. },
  225. /**
  226. * 判断是否红点
  227. */
  228. ckInit: function() {
  229. this
  230. .request
  231. .get("auctionOrderInit")
  232. .then(res => {
  233. if (res.code == 200) {
  234. for (let i in this.navList) {
  235. if (this.navList[i].code == 1) {
  236. this.navList[i].count = res.data.noCount;
  237. }
  238. if (this.navList[i].code == 2) {
  239. this.navList[i].count = res.data.autoCount;
  240. }
  241. if (this.navList[i].code == 4) {
  242. this.navList[i].count = res.data.gsCount;
  243. }
  244. }
  245. }
  246. });
  247. },
  248. tapDateTime: function(ev) {
  249. this.dateTime = this.utils.date('Y-m-d', ev.value / 1000);
  250. this.$refs.datetimePicker.close();
  251. this.getData(true);
  252. },
  253. isDateTimeOpen(){
  254. this.$refs.datetimePicker.open();
  255. },
  256. tapWeek: function(item) {
  257. this.week = item.value;
  258. this.getData(true);
  259. },
  260. getData: function(isPull = false) {
  261. if (this.page.isLoad) return;
  262. this.page.isLoad = true;
  263. if (isPull) {
  264. this.page.page = 1;
  265. this.page.isLoad = false;
  266. this.page.isFoot = false;
  267. }
  268. uni.showLoading({
  269. title: '获取数据中..'
  270. });
  271. var post = {};
  272. post.page = this.page.page;
  273. post.type = this.navList[this.current].code;
  274. post.time = this.dateTime;
  275. post.week = this.week;
  276. this
  277. .request
  278. .post("auctionOrder", post)
  279. .then(res => {
  280. uni.hideLoading();
  281. this.page.isFirst = true;
  282. this.page.isLoad = false;
  283. if (res.code == 200) {
  284. if (isPull) {
  285. this.orderList = res.data.list;
  286. } else {
  287. this.orderList = this.orderList.concat(res.data.list);
  288. }
  289. //是否到底
  290. if (res.data.list.length != res.data.pageSize) {
  291. this.page.isFoot = true;
  292. }
  293. } else {
  294. uni.showModal({
  295. title: '系统提示',
  296. content: res.msg,
  297. showCancel: false
  298. });
  299. }
  300. //that.CountDowm();
  301. })
  302. .catch(res => {
  303. uni.hideLoading();
  304. uni.showModal({
  305. title: '系统提示',
  306. content: '加载失败,返回在尝试',
  307. showCancel: false
  308. });
  309. });
  310. },
  311. },
  312. }
  313. </script>
  314. <style lang="scss">
  315. .navlist {
  316. width: 100%;
  317. background: #fff;
  318. height: 40px;
  319. }
  320. .app-body {
  321. position: relative;
  322. z-index: 9;
  323. .order-item {
  324. display: flex;
  325. flex-direction: column;
  326. background: #fff;
  327. margin-top: 9px;
  328. .order-itop {
  329. display: flex;
  330. align-items: center;
  331. height: 45px;
  332. font-size: 16px;
  333. color: #303133;
  334. position: relative;
  335. padding: 0 17px;
  336. .order-id {
  337. font-size: 16px;
  338. color: #787878;
  339. }
  340. .status {
  341. color: #dc262b;
  342. font-size: 16px;
  343. }
  344. }
  345. .goods-item {
  346. padding: 11px 17px;
  347. background: #f7f7f7;
  348. .img {
  349. width: 68px;
  350. height: 68px;
  351. }
  352. .info {
  353. margin-left: 20px;
  354. .title {
  355. font-size: 18px;
  356. color: #303133;
  357. margin-bottom: 20rpx;
  358. }
  359. .price {
  360. display: inline;
  361. font-size: 16px;
  362. color: #303133;
  363. }
  364. }
  365. .count {
  366. font-size: 16px;
  367. color: #787878;
  368. }
  369. }
  370. .order-foot {
  371. display: flex;
  372. justify-content: flex-end;
  373. align-items: baseline;
  374. padding: 11px 17px;
  375. font-size: 16px;
  376. color: #909399;
  377. border-bottom: 1px solid #f1f1f1;
  378. .i2 {
  379. margin: 0 4px;
  380. color: #303133;
  381. }
  382. .price {
  383. font-size: 18px;
  384. color: #303133;
  385. }
  386. }
  387. .order-btn {
  388. padding: 0 17px;
  389. display: flex;
  390. justify-content: flex-end;
  391. align-items: center;
  392. height: 57px;
  393. position: relative;
  394. .btn {
  395. width: 91px;
  396. height: 34px;
  397. margin: 0;
  398. margin-left: 13px;
  399. padding: 0;
  400. text-align: center;
  401. line-height: 34px;
  402. font-size: 14px;
  403. color: #303133;
  404. background: #fff;
  405. border-radius: 100px;
  406. border: 1px solid #fd3b39;
  407. border-radius: 28px;
  408. color: #dc262b;
  409. }
  410. }
  411. }
  412. }
  413. .popinput {
  414. padding: 20rpx;
  415. }
  416. .popinput .time {
  417. width: 20px;
  418. height: 20px;
  419. margin-right: 10px;
  420. }
  421. .box-nav {
  422. width: 100%;
  423. height: 50px;
  424. background-color: #fff;
  425. border-top: 1px #f5f5f5 solid;
  426. position: relative;
  427. z-index: 9;
  428. }
  429. .bn {
  430. align-items: center;
  431. height: 50px
  432. }
  433. .bn-item {
  434. width: 25%;
  435. text-align: center;
  436. position: relative;
  437. height: 50px;
  438. background: #fff;
  439. }
  440. .bni {
  441. color: #3F3E3E;
  442. font-size: 14px;
  443. box-sizing: border-box;
  444. position: relative;
  445. }
  446. .select {
  447. width: 100%;
  448. color: #ef4034
  449. }
  450. .select::after {
  451. content: "";
  452. position: absolute;
  453. bottom: -5px;
  454. left: 50%;
  455. transform: translate(-50%, -50%);
  456. background: #ef4034;
  457. width: 24px;
  458. height: 2px
  459. }
  460. .bn-item .ii {
  461. position: absolute;
  462. width: 10px;
  463. height: 10px;
  464. border-radius: 50%;
  465. background: red;
  466. right: 20%;
  467. top: 10px;
  468. }
  469. .select-time {
  470. padding: 0 10px;
  471. image {
  472. width: 15px;
  473. height: 15px;
  474. margin-right: 5px;
  475. }
  476. .date-time {
  477. font-size: 14px;
  478. }
  479. }
  480. .week {
  481. width: 100%;
  482. }
  483. .week .item {
  484. width: 14%;
  485. text-align: center;
  486. padding: 10px 0;
  487. }
  488. .week .item.on {
  489. color: #ef4034;
  490. }
  491. </style>