shelfList.vue 6.0 KB

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