shelfList.vue 5.5 KB

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