procureOrderList.vue 7.9 KB

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