procureOrderList.vue 8.0 KB

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