index.vue 9.9 KB

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