shelfList.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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. onLoad(opts) {
  82. this.getShelfList()
  83. uni.$on("setCustome",(data)=>{
  84. this.pageNo = 1
  85. this.shelfList = []
  86. this.getShelfList()
  87. })
  88. },
  89. onUnload() {
  90. uni.$off("setCustome")
  91. },
  92. methods: {
  93. clearSearch(){
  94. this.shelfName = ''
  95. this.shelfList = []
  96. this.getShelfList()
  97. },
  98. change(v){
  99. if(v==''){
  100. this.clearSearch()
  101. }
  102. },
  103. // 获取数字货架列表
  104. getShelfList(){
  105. const _this = this
  106. _this.status = 'loading'
  107. selectShelfStockCheck().then(res => {
  108. uni.hideLoading()
  109. if(res.data&&res.data.length){
  110. let list = res.data.filter(item => item.shelfName.indexOf(this.shelfName)>=0)
  111. if (list && list.length){
  112. _this.status = 'nomore'
  113. _this.shelfList = list
  114. } else {
  115. _this.shelfList = []
  116. _this.status = 'nomore'
  117. _this.noDataText = '没有查询到相关货架'
  118. }
  119. }else{
  120. _this.status = 'loadmore'
  121. _this.shelfList = []
  122. _this.noDataText = res.message ? res.message : '网络似乎出错了,请稍后再试'
  123. }
  124. })
  125. },
  126. // 删除盘点单
  127. delCheck(row){
  128. const _this = this
  129. clzConfirm({
  130. title: '提示',
  131. content: '删除后不可恢复,确定删除吗?',
  132. success (ret) {
  133. if (ret.confirm || ret.index == 0) {
  134. uni.showLoading({
  135. title:"正在删除.."
  136. })
  137. stockCheckDeleteBySn({ stockCheckSn: row.stockCheckSn }).then(res => {
  138. if (res.status == 200) {
  139. uni.showToast({
  140. icon: "none",
  141. title: res.message
  142. })
  143. _this.getShelfList()
  144. }
  145. uni.hideLoading()
  146. })
  147. }
  148. }
  149. })
  150. },
  151. viewDetail(item){
  152. this.tempData = item
  153. // 如果有冻结库存
  154. if(item.totalFreezeQty>0){
  155. this.showModal = true
  156. }else{
  157. // 去库存盘点
  158. uni.navigateTo({
  159. url:"/pages/stockCheck/startCheck?data="+encodeURIComponent(JSON.stringify(item))
  160. })
  161. }
  162. }
  163. }
  164. }
  165. </script>
  166. <style lang="less">
  167. .moreShelfPart{
  168. width: 100%;
  169. height: 100vh;
  170. .moreShelfPart-search{
  171. padding: 20rpx;
  172. background-color: #FFFFFF;
  173. }
  174. .moreShelfPart-body{
  175. flex-grow: 1;
  176. background-color: #fff;
  177. }
  178. .nav-right{
  179. padding: 0 30upx;
  180. height: calc(100vh - 110rpx);
  181. box-sizing: border-box;
  182. .nav-right-item{
  183. padding:20upx;
  184. border: 2rpx solid #f5f5f5;
  185. border-radius: 15upx;
  186. margin-bottom: 20upx;
  187. box-shadow: 2rpx 3rpx 5rpx #f8f8f8;
  188. &:active{
  189. background: #f8f8f8;
  190. }
  191. .item-info{
  192. .item-name{
  193. font-size: 30upx;
  194. display: flex;
  195. align-items: center;
  196. }
  197. .item-detail{
  198. margin-top: 15rpx;
  199. display: flex;
  200. align-items: center;
  201. justify-content: space-between;
  202. color: #9DA8B5;
  203. font-size: 26upx;
  204. .item-detail-text{
  205. font-size: 26upx;
  206. color: #333;
  207. }
  208. }
  209. }
  210. .button-box{
  211. display: flex;
  212. margin-top: 20upx;
  213. button{
  214. margin: 0 10upx;
  215. }
  216. > text{
  217. font-size: 24upx;
  218. color: #00aaff;
  219. }
  220. }
  221. }
  222. }
  223. }
  224. </style>