procureOrderList.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  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" @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. this.list = []
  113. this.status = "loading"
  114. this.swiperCurrent = index;
  115. },
  116. swiperChange(event){
  117. this.list = []
  118. this.status = "loading"
  119. this.swiperCurrent = event.detail.current
  120. },
  121. // swiper-item左右移动,通知tabs的滑块跟随移动
  122. transition(e) {
  123. let dx = e.detail.dx;
  124. this.$refs.uTabs.setDx(dx);
  125. },
  126. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  127. // swiper滑动结束,分别设置tabs和swiper的状态
  128. animationfinish(e) {
  129. let current = e.detail.current;
  130. if(current != this.current){
  131. this.$refs.uTabs.setFinishCurrent(current);
  132. this.swiperCurrent = current;
  133. this.current = current;
  134. this.pageInit()
  135. }
  136. },
  137. // scroll-view到底部加载更多
  138. onreachBottom() {
  139. if(this.list.length < this.total){
  140. this.pageNo += 1
  141. this.getRow()
  142. }else{
  143. this.status = "nomore"
  144. }
  145. },
  146. // 取消订单
  147. cancelOrder(item){
  148. let _this = this
  149. uni.showModal({
  150. title: '提示',
  151. content: '确定取消订单吗?',
  152. success: function (res) {
  153. if (res.confirm) {
  154. purchaseCancel({purchaseSn:item.purchaseSn}).then(res => {
  155. if (res.status == 200) {
  156. _this.message('取消成功')
  157. _this.pageInit()
  158. } else {
  159. _this.message(res.message)
  160. }
  161. })
  162. }
  163. }
  164. });
  165. },
  166. // 确认收货
  167. receiveOrder(item){
  168. let _this = this
  169. uni.showModal({
  170. title: '提示',
  171. content: '确定收货吗?',
  172. success: function (res) {
  173. if (res.confirm) {
  174. purchaseReceive({purchaseSn:item.purchaseSn}).then(res => {
  175. if (res.status == 200) {
  176. _this.message('收货成功')
  177. _this.pageInit()
  178. } else {
  179. _this.message(res.message)
  180. }
  181. })
  182. }
  183. }
  184. });
  185. },
  186. // 查询列表
  187. getRow (pageNo) {
  188. let _this = this
  189. if (pageNo) {
  190. this.pageNo = pageNo
  191. }
  192. let params = {
  193. pageNo: this.pageNo,
  194. pageSize: this.pageSize,
  195. }
  196. // 状态条件
  197. if(this.swiperCurrent == 1){
  198. params.billStatusList = ['WAIT_AUDIT','AUDIT_REJECT','WAIT_OUT_WAREHOUSE','WAIT_RECEIVE']
  199. }
  200. if(this.swiperCurrent == 2){
  201. params.billStatusList = ['FINISH']
  202. }
  203. if(this.swiperCurrent == 3){
  204. params.billStatusList = ['CANCEL']
  205. }
  206. this.status = "loading"
  207. purchaseQueryPage(params).then(res => {
  208. if (res.code == 200 || res.status == 204 || res.status == 200) {
  209. if(_this.pageNo>1){
  210. _this.list = _this.list.concat(res.data.list || [])
  211. }else{
  212. _this.list = res.data.list || []
  213. }
  214. _this.total = res.data.count || 0
  215. // 待收货
  216. if(_this.swiperCurrent == 1){
  217. _this.tabList[1].count = _this.total
  218. }
  219. } else {
  220. _this.list = []
  221. _this.total = 0
  222. _this.noDataText = res.message
  223. }
  224. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  225. })
  226. },
  227. // 详细页
  228. viewRow(item){
  229. this.$store.state.vuex_tempData = item
  230. uni.navigateTo({
  231. url: "/pagesB/procureOrder?purchaseSn="+item.purchaseSn+"&state="+item.billStatus
  232. })
  233. }
  234. }
  235. }
  236. </script>
  237. <style lang="scss">
  238. page{
  239. height: 100%;
  240. }
  241. .digitShelf-pagesCons{
  242. height: 100%;
  243. display: flex;
  244. flex-direction: column;
  245. .tab-body{
  246. .check-list{
  247. height: calc(100vh - 44px);
  248. }
  249. .check-order-list{
  250. background: #ffffff;
  251. padding: 10upx 20upx;
  252. margin: 25upx;
  253. border-radius: 30upx;
  254. box-shadow: 1px 1px 3px #EEEEEE;
  255. .check-row{
  256. display: flex;
  257. padding: 20upx 10upx;
  258. font-size: 28upx;
  259. &:first-child{
  260. color: #666E75;
  261. font-size: 24upx;
  262. padding-bottom: 10upx;
  263. .orderNo{
  264. font-size: 30upx;
  265. color: #222222;
  266. margin-top: -6upx;
  267. flex-grow: 1;
  268. }
  269. .times{
  270. text-align: right;
  271. }
  272. border-bottom: 2upx solid #f5f5f5;
  273. }
  274. &:last-child{
  275. align-items: center;
  276. justify-content: space-between;
  277. .nums{
  278. font-size: 28upx;
  279. color: #033692;
  280. }
  281. }
  282. > view{
  283. .price{
  284. color: red;
  285. font-size: 28upx;
  286. }
  287. }
  288. .finish{
  289. background-color: #2d8cf0;
  290. }
  291. .del{
  292. color: #666;
  293. border:2rpx solid #EDEDED;
  294. background: none;
  295. }
  296. }
  297. }
  298. }
  299. }
  300. </style>