orderList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <template>
  2. <view class="digitShelf-pagesCons">
  3. <view class="tab-body">
  4. <view>
  5. <u-tabs-swiper ref="uTabs" :list="tabList" :offset="[5,40]" bar-width='100' active-color="#1283d4" name="dispName" :current="current" @change="tabsChange" :is-scroll="false"
  6. swiperWidth="750"></u-tabs-swiper>
  7. </view>
  8. <swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
  9. <swiper-item class="swiper-item" style="height: 100%;width: 100%;overflow: hidden;" v-for="(tabs, indexs) in tabList" :key="indexs">
  10. <scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom" v-if="swiperCurrent == indexs">
  11. <view
  12. class="check-order-list"
  13. v-for="(item,index) in list"
  14. :key="item.id"
  15. @click="viewRow(item)"
  16. >
  17. <view class="check-row align_center justify_between">
  18. <view class="orderNo">{{item.purchaseNo}}</view>
  19. <view class="times">
  20. <span v-if="item.billStatus == 'WAIT_AUDIT'">待审核</span>
  21. <view v-if="item.billStatus == 'WAIT_AUDIT'" class="waitPay">
  22. <text>待付款</text>
  23. <text>22小时11分钟</text>
  24. </view>
  25. <span v-if="item.billStatus == 'AUDIT_REJECT'">审核不通过</span>
  26. <span v-if="item.billStatus == 'WAIT_OUT_WAREHOUSE' || item.billStatus == 'WAIT_RECEIVE'">待收货</span>
  27. <span v-if="item.billStatus == 'FINISH'">已完结</span>
  28. <span v-if="item.billStatus == 'CANCEL'">已取消</span>
  29. </view>
  30. </view>
  31. <view class="check-row">
  32. <view v-if="item.totalCategory>1" class="check-row-left">
  33. <scroll-view style="width: 100%;white-space: nowrap;" scroll-x="true">
  34. <view class="img-item" v-for="item in item.totalCategory" :key="item">
  35. <image src="/static/def_imgs.png" style="width: 100%;height: 100%;"></image>
  36. </view>
  37. </scroll-view>
  38. </view>
  39. <view v-else class="check-row-left">
  40. <view class="img-item">
  41. <image src="/static/def_imgs.png" style="width: 100%;height: 100%;"></image>
  42. </view>
  43. <view class="product-info">
  44. <text class="ellipsis-two">布瑞斯免维护蓄电池 五菱之光,五菱荣光</text>
  45. <text class="ellipsis-one">58-500MF</text>
  46. </view>
  47. </view>
  48. <view :class="item.totalCategory>1?'check-row-right check-row-right-fixed':'check-row-right'">
  49. <view>¥<text class="price">{{priceStr(item.totalAmount)[0]}}</text>.{{priceStr(item.totalAmount)[1]}}</view>
  50. <view><text class="nums">共{{item.totalQty}}件</text></view>
  51. </view>
  52. </view>
  53. <view class="check-row">
  54. <view class="times">
  55. {{item.createDate}}
  56. </view>
  57. <view style="text-align: right;color: #999;">
  58. <u-button style="margin-left: 10px;" v-if="item.billStatus == 'WAIT_AUDIT'" size="mini" shape="round" type="default" plain @click="cancelOrder(item)">取消订单</u-button>
  59. <u-button style="margin-left: 10px;" v-if="item.billStatus == 'WAIT_AUDIT'" size="mini" shape="round" type="error" plain @click="payOrder(item)">立即支付</u-button>
  60. <!-- <u-button style="margin-left: 10px;" v-if="item.billStatus == 'CANCEL'" size="mini" shape="round" type="error" plain @click="buyAgain(item)">再次购买</u-button> -->
  61. <u-button style="margin-left: 10px;" v-if="item.billStatus == 'WAIT_RECEIVE'" size="mini" shape="round" type="error" plain @click="receiveOrder(item)">确认收货</u-button>
  62. </view>
  63. </view>
  64. </view>
  65. <view style="padding: 20upx;">
  66. <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
  67. <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
  68. </view>
  69. </scroll-view>
  70. </swiper-item>
  71. </swiper>
  72. </view>
  73. <!-- 付款弹框 -->
  74. <payModal :showPopu="showPopu" :payInfo="payInfo" @close="showPopu=false" @payComplete="payComplete"></payModal>
  75. </view>
  76. </template>
  77. <script>
  78. import { purchaseQueryPage,purchaseCancel,purchaseReceive } from '@/api/purchase.js'
  79. import payModal from '../components/payModal.vue'
  80. export default {
  81. components:{
  82. payModal
  83. },
  84. data() {
  85. return {
  86. status: 'loading',
  87. noDataText: '暂无数据',
  88. showPopu: false,
  89. tabList: [
  90. {
  91. dispName: '全部',
  92. typeId: 1,
  93. count: 0
  94. },
  95. {
  96. dispName: '待付款',
  97. typeId: 2,
  98. count: 0
  99. },
  100. {
  101. dispName: '待收货',
  102. typeId: 3,
  103. count: 0
  104. },
  105. {
  106. dispName: '已完结',
  107. typeId: 4,
  108. count: 0
  109. },
  110. {
  111. dispName: '已取消',
  112. typeId: 5,
  113. count: 0
  114. },
  115. {
  116. dispName: '审核不通过',
  117. typeId: 6,
  118. count: 0
  119. },
  120. ],
  121. current: 1,
  122. swiperCurrent: 1,
  123. // 查询条件
  124. pageNo: 1,
  125. pageSize: 10,
  126. list: [],
  127. total: 0,
  128. }
  129. },
  130. computed: {
  131. // 付款信息
  132. payInfo(){
  133. return this.$store.state.vuex_tempOrderData
  134. }
  135. },
  136. onLoad() {
  137. let _this = this
  138. _this.pageInit()
  139. uni.$on('refreshPurcaOrder',function(data){
  140. _this.resetList()
  141. })
  142. },
  143. methods:{
  144. message(title){
  145. uni.showToast({
  146. icon:'none',
  147. title: title
  148. })
  149. },
  150. priceStr: function(value) {
  151. const str = Number(value).toFixed(2).split('.')
  152. return str;
  153. },
  154. resetList(){
  155. this.list = []
  156. this.status = "loading"
  157. this.pageInit()
  158. },
  159. pageInit(){
  160. this.total = 0
  161. this.pageNo = 1
  162. this.getRow()
  163. },
  164. // tabs通知swiper切换
  165. tabsChange(index) {
  166. if(index != this.swiperCurrent && this.status !='loading'){
  167. this.list = []
  168. this.status = "loading"
  169. this.swiperCurrent = index;
  170. }
  171. },
  172. swiperChange(event){
  173. this.list = []
  174. this.status = "loading"
  175. this.swiperCurrent = event.detail.current
  176. },
  177. // swiper-item左右移动,通知tabs的滑块跟随移动
  178. transition(e) {
  179. let dx = e.detail.dx;
  180. this.$refs.uTabs.setDx(dx);
  181. },
  182. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  183. // swiper滑动结束,分别设置tabs和swiper的状态
  184. animationfinish(e) {
  185. let current = e.detail.current;
  186. if(current != this.current){
  187. this.$refs.uTabs.setFinishCurrent(current);
  188. this.swiperCurrent = current;
  189. this.current = current;
  190. this.pageInit()
  191. }
  192. },
  193. // scroll-view到底部加载更多
  194. onreachBottom() {
  195. if(this.list.length < this.total){
  196. this.pageNo += 1
  197. this.getRow()
  198. }else{
  199. this.status = "nomore"
  200. }
  201. },
  202. // 取消订单
  203. cancelOrder(item){
  204. let _this = this
  205. uni.showModal({
  206. title: '提示',
  207. content: '确定取消订单吗?',
  208. success: function (res) {
  209. if (res.confirm) {
  210. purchaseCancel({purchaseSn:item.purchaseSn}).then(res => {
  211. if (res.status == 200) {
  212. _this.message('取消成功')
  213. _this.pageInit()
  214. } else {
  215. _this.message(res.message)
  216. }
  217. })
  218. }
  219. }
  220. });
  221. },
  222. // 立即支付
  223. payOrder(item){
  224. this.$store.state.vuex_tempOrderData = item
  225. this.showPopu = true
  226. },
  227. // 付款成功,isOk: false 取消支付或支付失败,true 支付完成
  228. payComplete(item,isOk){
  229. this.showPopu = false
  230. if(isOk){
  231. this.viewRow(item)
  232. setTimeout(()=>{
  233. this.resetList()
  234. },150)
  235. }
  236. },
  237. // 再次购买
  238. buyAgain(item){
  239. },
  240. // 确认收货
  241. receiveOrder(item){
  242. let _this = this
  243. uni.showModal({
  244. title: '提示',
  245. content: '确定收货吗?',
  246. success: function (res) {
  247. if (res.confirm) {
  248. purchaseReceive({purchaseSn:item.purchaseSn}).then(res => {
  249. if (res.status == 200) {
  250. _this.message('收货成功')
  251. _this.pageInit()
  252. } else {
  253. _this.message(res.message)
  254. }
  255. })
  256. }
  257. }
  258. });
  259. },
  260. // 查询列表
  261. getRow (pageNo) {
  262. let _this = this
  263. if (pageNo) {
  264. this.pageNo = pageNo
  265. }
  266. let params = {
  267. pageNo: this.pageNo,
  268. pageSize: this.pageSize,
  269. }
  270. // 状态条件
  271. // 待付款
  272. if(this.swiperCurrent == 1){
  273. params.billStatusList = ['WAIT_PAY']
  274. }
  275. // 待收货
  276. if(this.swiperCurrent == 2){
  277. params.billStatusList = ['WAIT_AUDIT','WAIT_OUT_WAREHOUSE','WAIT_RECEIVE']
  278. }
  279. // 已完成
  280. if(this.swiperCurrent == 3){
  281. params.billStatusList = ['FINISH']
  282. }
  283. // 已取消
  284. if(this.swiperCurrent == 4){
  285. params.billStatusList = ['CANCEL']
  286. }
  287. // 未审核通过
  288. if(this.swiperCurrent == 5){
  289. params.billStatusList = ['AUDIT_REJECT']
  290. }
  291. this.status = "loading"
  292. purchaseQueryPage(params).then(res => {
  293. if (res.code == 200 || res.status == 204 || res.status == 200) {
  294. if(_this.pageNo>1){
  295. _this.list = _this.list.concat(res.data.list || [])
  296. }else{
  297. _this.list = res.data.list || []
  298. }
  299. _this.total = res.data.count || 0
  300. // 待收货
  301. if(_this.swiperCurrent == 1){
  302. _this.tabList[1].count = _this.total
  303. }
  304. } else {
  305. _this.list = []
  306. _this.total = 0
  307. _this.noDataText = res.message
  308. }
  309. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  310. })
  311. },
  312. // 详细页
  313. viewRow(item){
  314. this.$store.state.vuex_tempOrderData = item
  315. uni.navigateTo({
  316. url: "/pagesB/procureOrder/orderDetail?purchaseSn="+item.purchaseSn+"&state="+item.billStatus
  317. })
  318. }
  319. }
  320. }
  321. </script>
  322. <style lang="scss">
  323. page{
  324. height: 100%;
  325. }
  326. .digitShelf-pagesCons{
  327. height: 100%;
  328. display: flex;
  329. flex-direction: column;
  330. .tab-body{
  331. .check-list{
  332. height: calc(100vh - 44px);
  333. }
  334. .check-order-list{
  335. background: #ffffff;
  336. padding: 10upx 20upx;
  337. margin: 20upx;
  338. border-radius: 20upx;
  339. box-shadow: 1px 1px 3px #EEEEEE;
  340. .check-row{
  341. display: flex;
  342. font-size: 28upx;
  343. position: relative;
  344. &:first-child{
  345. color: #666E75;
  346. font-size: 24upx;
  347. padding: 20upx 0;
  348. .orderNo{
  349. font-size: 28upx;
  350. color: #222222;
  351. margin-top: -6upx;
  352. flex-grow: 1;
  353. }
  354. }
  355. &:last-child{
  356. align-items: center;
  357. justify-content: space-between;
  358. padding: 20upx 0;
  359. }
  360. .times{
  361. text-align: right;
  362. font-size: 24upx;
  363. }
  364. > view{
  365. .price{
  366. color: #666;
  367. font-size: 28upx;
  368. font-weight: bold;
  369. }
  370. .nums{
  371. font-size: 24upx;
  372. color: #666;
  373. }
  374. .waitPay{
  375. background: #f9e4e4;
  376. border-radius: 30px;
  377. display: flex;
  378. align-items: center;
  379. text{
  380. color: #fff;
  381. padding: 3px 5px;
  382. &:first-child{
  383. background: #ff0000;
  384. border-radius: 30rpx 0 20rpx 30rpx;
  385. font-size: 24rpx;
  386. }
  387. &:last-child{
  388. font-size: 20rpx;
  389. color: #ff0000;
  390. }
  391. }
  392. }
  393. }
  394. .check-row-left{
  395. display: flex;
  396. align-items: center;
  397. flex-grow:1;
  398. width: 50%;
  399. }
  400. .img-item{
  401. display: inline-block;
  402. width: 200rpx;
  403. height: 200rpx;
  404. background: #f8f8f8;
  405. border-radius: 5px;
  406. margin-right: 10px;
  407. }
  408. .product-info{
  409. flex-grow: 1;
  410. width: 60%;
  411. padding-right: 10px;
  412. > text{
  413. &:last-child{
  414. margin-top: 5px;
  415. display: inline-block;
  416. color: #2196F3;
  417. width: 100%;
  418. }
  419. }
  420. }
  421. .check-row-right-fixed{
  422. position: absolute;
  423. top: 0;
  424. right:0;
  425. }
  426. .check-row-right{
  427. display: flex;
  428. flex-direction: column;
  429. justify-content: center;
  430. align-items: flex-end;
  431. padding:0 5px;
  432. height: 200rpx;
  433. min-width: 100rpx;
  434. text-align: right;
  435. font-size: 10px;
  436. background: rgba(255,255,255,0.9);
  437. }
  438. .finish{
  439. background-color: #2d8cf0;
  440. }
  441. .del{
  442. color: #666;
  443. border:2rpx solid #EDEDED;
  444. background: none;
  445. }
  446. }
  447. }
  448. }
  449. }
  450. </style>