buyorder.vue 11 KB

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