shelfList.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <view class="moreShelfPart flex flex_column">
  3. <view class="moreShelfPart-search">
  4. <u-search
  5. placeholder="请输入货架名称搜索"
  6. v-model="shelfName"
  7. :show-action="isGobleSearch"
  8. @input="change"
  9. @focus="isGobleSearch=true"
  10. @blur="isGobleSearch=false"
  11. @custom="getShelfList"
  12. @search="getShelfList"
  13. @clear="clearSearch"
  14. :action-style="{'color': '#fff', 'font-size': '24upx', 'background-color': '#57a3f3', 'border-radius': '6upx', 'padding': '12upx 0'}">
  15. </u-search>
  16. </view>
  17. <view class="moreShelfPart-body">
  18. <view class="nav-right">
  19. <view
  20. class="nav-right-item"
  21. v-for="(item, index) in shelfList"
  22. :key="item.id"
  23. >
  24. <view class="item-info" @click="viewDetail(item)">
  25. <view class="item-name">
  26. <text>{{item.shelfName}}</text>
  27. </view>
  28. <view class="item-detail">
  29. <view>
  30. 产品款数:
  31. <text class="item-detail-text">{{item.totalCategory}}</text>
  32. </view>
  33. <view>
  34. 可用库存:
  35. <text class="item-detail-text">{{item.totalStockQty}}</text>
  36. </view>
  37. <view>
  38. 冻结库存:
  39. <text class="item-detail-text">{{item.totalFreezeQty}}</text>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="item-info button-box justify_between align_center" v-if="item.checkState=='WAIT'">
  44. <text>{{item.checkStateDictValue}}</text>
  45. <view>
  46. <u-button @click.stop="delCheck(item)" size="mini" :hair-line="false" shape="circle" plain type="error" hover-class="none" >删除盘点</u-button>
  47. <u-button @click.stop="viewDetail(item)" size="mini" :hair-line="false" shape="circle" plain type="primary" hover-class="none" >继续盘点</u-button>
  48. </view>
  49. </view>
  50. </view>
  51. <view v-if="shelfList&&shelfList.length==0">
  52. <u-empty v-if="status!='loading'" :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="180" :text="noDataText" mode="list" :margin-top="50"></u-empty>
  53. </view>
  54. <view style="padding: 20upx;">
  55. <u-loadmore :status="status" />
  56. </view>
  57. </view>
  58. </view>
  59. <freezeQtyModal :openModal="showModal" :infoData="tempData"></freezeQtyModal>
  60. </view>
  61. </template>
  62. <script>
  63. import { selectShelfStockCheck, stockCheckDeleteBySn } from '@/api/stockCheck'
  64. import freezeQtyModal from './freezeQtyModal'
  65. import { clzConfirm } from '@/libs/tools'
  66. export default {
  67. components: {
  68. freezeQtyModal
  69. },
  70. data() {
  71. return {
  72. shelfName: '',
  73. isGobleSearch: false,
  74. shelfList: [],
  75. noDataText: '暂无货架',
  76. status: 'loading',
  77. tempData: null,
  78. showModal: false
  79. }
  80. },
  81. onShow() {
  82. this.getShelfList()
  83. },
  84. methods: {
  85. clearSearch(){
  86. this.shelfName = ''
  87. this.shelfList = []
  88. this.getShelfList()
  89. },
  90. change(v){
  91. if(v==''){
  92. this.clearSearch()
  93. }
  94. },
  95. // 获取数字货架列表
  96. getShelfList(){
  97. const _this = this
  98. _this.status = 'loading'
  99. selectShelfStockCheck().then(res => {
  100. uni.hideLoading()
  101. if(res.data&&res.data.length){
  102. let list = res.data.filter(item => item.shelfName.indexOf(this.shelfName)>=0)
  103. if (list && list.length){
  104. _this.status = 'nomore'
  105. _this.shelfList = list
  106. } else {
  107. _this.shelfList = []
  108. _this.status = 'nomore'
  109. _this.noDataText = '没有查询到相关货架'
  110. }
  111. }else{
  112. _this.status = 'loadmore'
  113. _this.shelfList = []
  114. _this.noDataText = res.message ? res.message : '网络似乎出错了,请稍后再试'
  115. }
  116. })
  117. },
  118. // 删除盘点单
  119. delCheck(row){
  120. const _this = this
  121. clzConfirm({
  122. title: '提示',
  123. content: '删除后不可恢复,确定删除吗?',
  124. success (ret) {
  125. if (ret.confirm || ret.index == 0) {
  126. uni.showLoading({
  127. title:"正在删除.."
  128. })
  129. stockCheckDeleteBySn({ stockCheckSn: row.stockCheckSn }).then(res => {
  130. if (res.status == 200) {
  131. uni.showToast({
  132. icon: "none",
  133. title: res.message
  134. })
  135. _this.getShelfList()
  136. }
  137. uni.hideLoading()
  138. })
  139. }
  140. }
  141. })
  142. },
  143. viewDetail(item){
  144. this.tempData = item
  145. // 如果有冻结库存
  146. if(item.totalFreezeQty>0){
  147. this.showModal = true
  148. }else{
  149. // 去库存盘点
  150. uni.navigateTo({
  151. url:"/pages/stockCheck/startCheck?data="+encodeURIComponent(JSON.stringify(item))
  152. })
  153. }
  154. }
  155. }
  156. }
  157. </script>
  158. <style lang="less">
  159. .moreShelfPart{
  160. width: 100%;
  161. height: 100vh;
  162. .moreShelfPart-search{
  163. padding: 20rpx;
  164. background-color: #FFFFFF;
  165. }
  166. .moreShelfPart-body{
  167. flex-grow: 1;
  168. background-color: #fff;
  169. }
  170. .nav-right{
  171. padding: 0 30upx;
  172. height: calc(100vh - 110rpx);
  173. box-sizing: border-box;
  174. .nav-right-item{
  175. padding:20upx;
  176. border: 2rpx solid #f5f5f5;
  177. border-radius: 15upx;
  178. margin-bottom: 20upx;
  179. box-shadow: 2rpx 3rpx 5rpx #f8f8f8;
  180. &:active{
  181. background: #f8f8f8;
  182. }
  183. .item-info{
  184. .item-name{
  185. font-size: 30upx;
  186. display: flex;
  187. align-items: center;
  188. }
  189. .item-detail{
  190. margin-top: 15rpx;
  191. display: flex;
  192. align-items: center;
  193. justify-content: space-between;
  194. color: #9DA8B5;
  195. font-size: 26upx;
  196. .item-detail-text{
  197. font-size: 26upx;
  198. color: #333;
  199. }
  200. }
  201. }
  202. .button-box{
  203. display: flex;
  204. margin-top: 20upx;
  205. button{
  206. margin: 0 10upx;
  207. }
  208. > text{
  209. font-size: 24upx;
  210. color: #00aaff;
  211. }
  212. }
  213. }
  214. }
  215. }
  216. </style>