procureOrderList.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  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">{{item.createDate}}</view>
  20. </view>
  21. <view class="check-row flex align-center justify_between">
  22. <view>总款数:{{item.totalCategory}}</view>
  23. <view>总金额:<text class="price">¥{{item.totalAmount}}</text></view>
  24. </view>
  25. <view class="check-row">
  26. <view class="nums">
  27. 共{{item.totalQty}}件商品
  28. </view>
  29. <view style="text-align: right;color: #999;">
  30. <span v-if="item.billStatus == 'WAIT_AUDIT'">待审核</span>
  31. <span v-if="item.billStatus == 'AUDIT_REJECT'">审核不通过</span>
  32. <span v-if="item.billStatus == 'WAIT_OUT_WAREHOUSE' || item.billStatus == 'WAIT_RECEIVE'">待收货</span>
  33. <span v-if="item.billStatus == 'FINISH'">已完结</span>
  34. <span v-if="item.billStatus == 'CANCEL'">已取消</span>
  35. <u-button style="margin-left: 10px;" v-if="item.billStatus == 'WAIT_AUDIT'" size="mini" shape="circle" type="error" plain @click="cancelOrder(item)">取消订单</u-button>
  36. <u-button style="margin-left: 10px;" v-if="item.billStatus == 'WAIT_RECEIVE'" size="mini" shape="circle" type="primary" @click="receiveOrder(item)">确认收货</u-button>
  37. </view>
  38. </view>
  39. </view>
  40. <view style="padding: 20upx;">
  41. <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>
  42. <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
  43. </view>
  44. </scroll-view>
  45. </swiper-item>
  46. </swiper>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import { purchaseQueryPage,purchaseCancel,purchaseReceive } from '@/api/purchase.js'
  52. export default {
  53. data() {
  54. return {
  55. status: 'loading',
  56. noDataText: '暂无数据',
  57. tabList: [
  58. {
  59. dispName: '全部',
  60. typeId: 1,
  61. count: 0
  62. },
  63. {
  64. dispName: '待收货',
  65. typeId: 2,
  66. count: 0
  67. },
  68. {
  69. dispName: '已完结',
  70. typeId: 3,
  71. count: 0
  72. },
  73. {
  74. dispName: '已取消',
  75. typeId: 4,
  76. count: 0
  77. },
  78. ],
  79. current: 1,
  80. swiperCurrent: 1,
  81. // 查询条件
  82. pageNo: 1,
  83. pageSize: 10,
  84. list: [],
  85. total: 0,
  86. }
  87. },
  88. onLoad() {
  89. this.$store.state.vuex_tempData = null
  90. let _this = this
  91. _this.pageInit()
  92. uni.$on('refreshOrder',function(data){
  93. _this.list = []
  94. _this.status = "loading"
  95. _this.pageInit()
  96. })
  97. },
  98. methods:{
  99. message(title){
  100. uni.showToast({
  101. icon:'none',
  102. title: title
  103. })
  104. },
  105. pageInit(){
  106. this.total = 0
  107. this.pageNo = 1
  108. this.getRow()
  109. },
  110. // tabs通知swiper切换
  111. tabsChange(index) {
  112. if(index != this.swiperCurrent && this.status !='loading'){
  113. this.list = []
  114. this.status = "loading"
  115. this.swiperCurrent = index;
  116. }
  117. },
  118. swiperChange(event){
  119. this.list = []
  120. this.status = "loading"
  121. this.swiperCurrent = event.detail.current
  122. },
  123. // swiper-item左右移动,通知tabs的滑块跟随移动
  124. transition(e) {
  125. let dx = e.detail.dx;
  126. this.$refs.uTabs.setDx(dx);
  127. },
  128. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  129. // swiper滑动结束,分别设置tabs和swiper的状态
  130. animationfinish(e) {
  131. let current = e.detail.current;
  132. if(current != this.current){
  133. this.$refs.uTabs.setFinishCurrent(current);
  134. this.swiperCurrent = current;
  135. this.current = current;
  136. this.pageInit()
  137. }
  138. },
  139. // scroll-view到底部加载更多
  140. onreachBottom() {
  141. if(this.list.length < this.total){
  142. this.pageNo += 1
  143. this.getRow()
  144. }else{
  145. this.status = "nomore"
  146. }
  147. },
  148. // 取消订单
  149. cancelOrder(item){
  150. let _this = this
  151. uni.showModal({
  152. title: '提示',
  153. content: '确定取消订单吗?',
  154. success: function (res) {
  155. if (res.confirm) {
  156. purchaseCancel({purchaseSn:item.purchaseSn}).then(res => {
  157. if (res.status == 200) {
  158. _this.message('取消成功')
  159. _this.pageInit()
  160. } else {
  161. _this.message(res.message)
  162. }
  163. })
  164. }
  165. }
  166. });
  167. },
  168. // 确认收货
  169. receiveOrder(item){
  170. let _this = this
  171. uni.showModal({
  172. title: '提示',
  173. content: '确定收货吗?',
  174. success: function (res) {
  175. if (res.confirm) {
  176. purchaseReceive({purchaseSn:item.purchaseSn}).then(res => {
  177. if (res.status == 200) {
  178. _this.message('收货成功')
  179. _this.pageInit()
  180. } else {
  181. _this.message(res.message)
  182. }
  183. })
  184. }
  185. }
  186. });
  187. },
  188. // 查询列表
  189. getRow (pageNo) {
  190. let _this = this
  191. if (pageNo) {
  192. this.pageNo = pageNo
  193. }
  194. let params = {
  195. pageNo: this.pageNo,
  196. pageSize: this.pageSize,
  197. }
  198. // 状态条件
  199. if(this.swiperCurrent == 1){
  200. params.billStatusList = ['WAIT_AUDIT','AUDIT_REJECT','WAIT_OUT_WAREHOUSE','WAIT_RECEIVE']
  201. }
  202. if(this.swiperCurrent == 2){
  203. params.billStatusList = ['FINISH']
  204. }
  205. if(this.swiperCurrent == 3){
  206. params.billStatusList = ['CANCEL']
  207. }
  208. this.status = "loading"
  209. purchaseQueryPage(params).then(res => {
  210. if (res.code == 200 || res.status == 204 || res.status == 200) {
  211. if(_this.pageNo>1){
  212. _this.list = _this.list.concat(res.data.list || [])
  213. }else{
  214. _this.list = res.data.list || []
  215. }
  216. _this.total = res.data.count || 0
  217. // 待收货
  218. if(_this.swiperCurrent == 1){
  219. _this.tabList[1].count = _this.total
  220. }
  221. } else {
  222. _this.list = []
  223. _this.total = 0
  224. _this.noDataText = res.message
  225. }
  226. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  227. })
  228. },
  229. // 详细页
  230. viewRow(item){
  231. this.$store.state.vuex_tempData = item
  232. uni.navigateTo({
  233. url: "/pagesB/procureOrder?purchaseSn="+item.purchaseSn+"&state="+item.billStatus
  234. })
  235. }
  236. }
  237. }
  238. </script>
  239. <style lang="scss">
  240. page{
  241. height: 100%;
  242. }
  243. .digitShelf-pagesCons{
  244. height: 100%;
  245. display: flex;
  246. flex-direction: column;
  247. .tab-body{
  248. .check-list{
  249. height: calc(100vh - 44px);
  250. }
  251. .check-order-list{
  252. background: #ffffff;
  253. padding: 10upx 20upx;
  254. margin: 25upx;
  255. border-radius: 30upx;
  256. box-shadow: 1px 1px 3px #EEEEEE;
  257. .check-row{
  258. display: flex;
  259. padding: 20upx 10upx;
  260. font-size: 28upx;
  261. &:first-child{
  262. color: #666E75;
  263. font-size: 24upx;
  264. padding-bottom: 10upx;
  265. .orderNo{
  266. font-size: 30upx;
  267. color: #222222;
  268. margin-top: -6upx;
  269. flex-grow: 1;
  270. }
  271. .times{
  272. text-align: right;
  273. }
  274. border-bottom: 2upx solid #f5f5f5;
  275. }
  276. &:last-child{
  277. align-items: center;
  278. justify-content: space-between;
  279. .nums{
  280. font-size: 28upx;
  281. color: #033692;
  282. }
  283. }
  284. > view{
  285. .price{
  286. color: red;
  287. font-size: 28upx;
  288. }
  289. }
  290. .finish{
  291. background-color: #2d8cf0;
  292. }
  293. .del{
  294. color: #666;
  295. border:2rpx solid #EDEDED;
  296. background: none;
  297. }
  298. }
  299. }
  300. }
  301. }
  302. </style>