shelfList.vue 5.9 KB

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