index.vue 9.9 KB

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