index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <template>
  2. <view class="bg-set" :class="mask ? 'tl-show': ''">
  3. <u-navbar :autoBack="true" :placeholder="true" leftIconColor="#fff" bgColor="#FD4B09">
  4. <view slot="center" style="width: 88%;margin-left: 80rpx;">
  5. <u-search v-model="form.cname" :animation="true" placeholder="请输入商品名称"
  6. :actionStyle="{color:'#fff'}" @custom="custom" @search="custom"></u-search>
  7. </view>
  8. </u-navbar>
  9. <view class="topBackground" :style="{top: revenueTop+44+'px'}" style="overflow:hidden">
  10. <u-tabs :list="list" @click="click" :activeStyle="{ color: '#fff' }"
  11. :inactiveStyle="{ color: '#ffffff80' }"
  12. lineColor="#fff">
  13. <!-- <view slot="right" style="font-size: 15px;color: #fff;">
  14. <text style="margin-left: 10rpx;">|<text style="margin:0rpx 15rpx"
  15. @click="show = true,mask = true">筛选</text></text>
  16. </view> -->
  17. </u-tabs>
  18. </view>
  19. <!-- <view class="statistics_h" style="font-size: 44rpx;">
  20. <view class="statistics">
  21. <view style="display: flex;margin: 5rpx auto;">
  22. <view style="width: 60%;text-align: center;">价格</view>
  23. <view style="width: 40%;text-align: center;">数量</view>
  24. </view>
  25. <view style="display: flex;margin: 5rpx auto;">
  26. <view style="width: 60%;">库存总价:¥{{priceForm.totalPrice}}</view>
  27. <view style="width: 40%;text-align: center;">
  28. {{priceForm.totalNumber?priceForm.totalNumber.slice(0,priceForm.totalNumber.length-3):priceForm.totalNumber}}
  29. </view>
  30. </view>
  31. <view style="display: flex;margin: 5rpx auto;">
  32. <view style="width: 60%;">当期入库:¥{{priceForm.RKPrice}}</view>
  33. <view style="width: 40%;text-align: center;">
  34. {{priceForm.RKNumber?priceForm.RKNumber.slice(0,priceForm.RKNumber.length-3):priceForm.RKNumber}}
  35. </view>
  36. </view>
  37. <view style="display: flex;margin: 5rpx auto;">
  38. <view style="width: 60%;">当期出库:¥{{priceForm.CKPrice}}</view>
  39. <view style="width: 40%;text-align: center;">
  40. {{priceForm.CKNumber?priceForm.CKNumber.slice(0,priceForm.CKNumber.length-3):priceForm.CKNumber}}
  41. </view>
  42. </view>
  43. </view>
  44. </view> -->
  45. <view style="margin: 0rpx auto;width: 96%; margin-top: 110rpx;">
  46. <view v-for="(item,index) in dataList" :key="item.id"
  47. style="width: 100%;margin: 10rpx auto; padding: 20rpx 0;
  48. background-color: #fff;border-radius: 10rpx;">
  49. <view style="width: 100%;margin: 0 auto;">
  50. <view style="display: flex;height: 180rpx;">
  51. <view style="width: 140rpx;height: 170rpx;">
  52. <image style="width: 100%;height: 100%;" :src="item.goodsFilesList.length > 0?item.goodsFilesList[0].url:'../../../static/images/404.png'"></image>
  53. </view>
  54. <view style="font-size: 24rpx;width: calc(100% - 150rpx);margin-left: 10rpx;">
  55. <view style="font-size: 26rpx;font-weight: bold;">{{item.cname}}</view>
  56. <view style="display: flex;margin: 10rpx 0;">
  57. <view style="width: 50%;">均价:{{roleaName.indexOf('业务员') != -1?'***':item.inventoryCostPrice}}</view>
  58. <view style="width: 50%;">批次:{{item.dot}}</view>
  59. </view>
  60. <view style="display: flex">
  61. <view style="width: 50%;">仓库:{{item.storageName}}</view>
  62. <view style="width: 50%;">
  63. 库存:{{item.balanceQuantity?item.balanceQuantity:0}}
  64. </view>
  65. </view>
  66. <view style="display: flex">
  67. <view style="width: 50%;">售价A:{{item.priceOne}}</view>
  68. <view style="width: 50%;">售价B:{{item.priceTwo}}</view>
  69. </view>
  70. <view style="display: flex">
  71. <view style="width: 50%;">售价C:{{item.priceThree}}</view>
  72. <view style="width: 50%;">售价D:{{item.priceFour}} </view>
  73. </view>
  74. <!-- <view style="display: flex">
  75. <view style="width: 50%;">
  76. 库存下限:{{item.lowerLimit?item.lowerLimit.slice(0,item.lowerLimit.length-3):item.lowerLimit}}
  77. </view>
  78. <view style="width: 50%;">
  79. 产品分类:{{item.goodsType}}
  80. </view>
  81. </view> -->
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. <u-empty v-if="total == 0" style="position: absolute;top: 45%;left: 50%;transform:translate(-50%,-50%)"
  87. mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" />
  88. <u-loadmore v-if="total !== 0 && dataList.length != 0" :status="status" />
  89. </view>
  90. <u-popup :show="show" @close="show = false,mask = false" closeable :closeOnClickOverlay="false" zIndex="10070">
  91. <view style="mawidth: 100%;margin: auto 30rpx;margin-top: 20rpx;padding-bottom: 20rpx;">
  92. <text>筛选条件</text>
  93. <u--form labelPosition="left" :model="formTwo" labelWidth="150rpx">
  94. <u-form-item label="产品分类" borderBottom @click="filterAll(['goodsTypeName','goodsTypeId'])">
  95. <u-input v-model="formTwo.goodsTypeName" border="none" placeholder="请选择" suffixIcon="arrow-right"
  96. disabled disabledColor="#ffffff" />
  97. </u-form-item>
  98. </u--form>
  99. <text style="font-size: 30rpx;">库存筛选</text>
  100. <view style="display: flex;justify-content: space-between;">
  101. <u-button :type="formTwo.inventoryBalance == 0?'primary':''" text="库存数量>0" @click="stock(0)">
  102. </u-button>
  103. <u-button :type="formTwo.inventoryBalance == 1?'primary':''" text="库存数量≤0" @click="stock(1)">
  104. </u-button>
  105. </view>
  106. <text style="font-size: 30rpx;">标签筛选</text>
  107. <view>
  108. <u-checkbox-group v-model="formTwo.labels" placement="column">
  109. <u-checkbox :customStyle="{marginBottom: '8px'}" v-for="(item, index) in checkboxList"
  110. :key="index" :label="item.dictValue" :name="item.dictKey">
  111. </u-checkbox>
  112. </u-checkbox-group>
  113. </view>
  114. <view style="display: flex;justify-content: space-between;padding-top: 20rpx;">
  115. <view style="width: 45%;">
  116. <u-button text="全部清空" type="warning" @click="confirmEmptying"></u-button>
  117. </view>
  118. <view style="width: 45%;">
  119. <u-button text="确认搜索" type="primary" @click="confirmSearch"></u-button>
  120. </view>
  121. </view>
  122. </view>
  123. </u-popup>
  124. <u-picker :show="dropDown" :columns="columns" :keyName="keyName" @cancel="dropDown = false" @confirm="confirm">
  125. </u-picker>
  126. </view>
  127. </template>
  128. <script>
  129. import {
  130. queryBrand,
  131. queryStock,
  132. appStatistics,
  133. listAll
  134. } from '@/api/views/stock/index.js'
  135. export default {
  136. data() {
  137. return {
  138. list: [{
  139. name: '全部',
  140. value: ''
  141. }],
  142. show: false,
  143. mask: false,
  144. dropDown: false,
  145. columns: [],
  146. checkboxList: [],
  147. status: 'loadmore',
  148. revenueTop: 0,
  149. keyName: '',
  150. total: 0,
  151. dataList: [],
  152. screen: [],
  153. priceForm: {},
  154. form: {
  155. size: 20,
  156. current: 1
  157. },
  158. formTwo: {
  159. size: 20,
  160. current: 1
  161. },
  162. roleaName:'', // 当前角色数据
  163. }
  164. },
  165. onLoad() {
  166. this.roleaName = uni.getStorageSync('userInfo').role_name
  167. this.$u.api.getWorkDicts('goods_lable').then(res => {
  168. this.checkboxList = res.data
  169. this.keyName = "dictValue"
  170. })
  171. // 获取分类
  172. listAll({corpType:'SP'}).then(res => {
  173. res.data.forEach(item => this.list.push({
  174. name: item.title,
  175. value: item.id
  176. }))
  177. this.queryStockfun()
  178. })
  179. uni.getSystemInfo({
  180. success: (e) => {
  181. this.revenueTop = e.statusBarHeight
  182. }
  183. })
  184. },
  185. onReachBottom() {
  186. this.status = 'loading'
  187. if (this.dataList.length < this.total) {
  188. this.form.current++
  189. this.queryStockfun()
  190. } else {
  191. this.status = 'nomore'
  192. }
  193. },
  194. methods: {
  195. confirmEmptying() {
  196. this.formTwo = {
  197. size: 20,
  198. current: 1
  199. }
  200. this.form = {
  201. size: 20,
  202. current: 1
  203. }
  204. this.dataList = []
  205. this.show = false
  206. this.mask = false
  207. this.queryStockfun()
  208. },
  209. confirmSearch() {
  210. let form = {
  211. ...JSON.parse(JSON.stringify(this.formTwo)),
  212. labels: this.formTwo.labels ? this.formTwo.labels.join(',') : '',
  213. size: 20,
  214. current: 1
  215. }
  216. this.form = form
  217. this.dataList = []
  218. this.show = false
  219. this.mask = false
  220. this.queryStockfun()
  221. },
  222. stock(val) {
  223. this.$set(this.formTwo, "inventoryBalance", val)
  224. },
  225. //集合筛选条件
  226. filterAll(screen) {
  227. this.screen = screen
  228. switch (screen[1]) {
  229. case "goodsTypeId":
  230. uni.showLoading({
  231. title: '加载中',
  232. mask: true
  233. });
  234. listAll().then(res => {
  235. this.columns = [res.data]
  236. this.keyName = "cname"
  237. this.dropDown = true
  238. uni.hideLoading()
  239. })
  240. break;
  241. }
  242. },
  243. //选择确认
  244. confirm(e) {
  245. this.formTwo[this.screen[0]] = e.value[0].cname
  246. this.formTwo[this.screen[1]] = e.value[0].id
  247. this.dropDown = false
  248. },
  249. queryStockfun() {
  250. uni.showLoading({
  251. title: '加载中',
  252. mask: true
  253. });
  254. /* appStatistics(this.form).then(res => {
  255. this.priceForm = res.data
  256. })*/
  257. queryStock(this.form).then(res => {
  258. this.total = res.data.total || 0
  259. if (res.data.records) {
  260. this.dataList = this.dataList.concat(res.data.records)
  261. }
  262. uni.hideLoading();
  263. if (this.total < 10) {
  264. this.status = 'nomore'
  265. }
  266. })
  267. },
  268. custom(e) {
  269. this.dataList = []
  270. this.form.current = 1
  271. this.queryStockfun()
  272. },
  273. click(item) {
  274. this.dataList = []
  275. this.form.current = 1
  276. this.form.goodsTypeId = item.value,
  277. this.queryStockfun()
  278. }
  279. }
  280. }
  281. </script>
  282. <style scoped>
  283. .tl-show {
  284. overflow: hidden;
  285. position: fixed;
  286. height: 100%;
  287. width: 100%;
  288. }
  289. .topBackground {
  290. position: fixed;
  291. top: 0;
  292. z-index: 1;
  293. width: 100%;
  294. background-color: #FF6F3B;
  295. }
  296. .statistics_h {
  297. position: fixed;
  298. top: calc(88px + var(--status-bar-height));
  299. z-index: 1;
  300. width: 100%;
  301. background-color: #fff;
  302. padding-top: 10rpx;
  303. }
  304. .content {
  305. margin-top: 355rpx !important;
  306. }
  307. .statistics {
  308. width: calc(96% - 20rpx);
  309. margin: 0 auto;
  310. background: url("../../../static/images/bg.png") no-repeat;
  311. background-size: 100% 100%;
  312. border-radius: 20rpx;
  313. color: #fff;
  314. /* padding: 10rpx; */
  315. padding: 10rpx 0rpx 10rpx 10rpx;
  316. font-size: 38rpx;
  317. }
  318. /* ::v-deep .u-line {
  319. border-bottom: 4rpx dashed #B6B6B6 !important;
  320. } */
  321. ::v-deep .u-divider {
  322. margin: 10rpx;
  323. }
  324. ::v-deep .u-album__row__wrapper>uni-image {
  325. border-radius: 10rpx;
  326. border-top-right-radius: 0;
  327. border-bottom-right-radius: 0;
  328. }
  329. ::v-deep .u-navbar__content {
  330. background-image: linear-gradient(to bottom, #FD4B09, #FF6F3B);
  331. }
  332. </style>