index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  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" placeholder="请输入商品名称" :actionStyle="{color:'#fff'}" @custom="custom"
  6. @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 class="tabClass">
  18. <u-tag style="margin: 0 20rpx 10rpx 20rpx;" plain :text="formTwo.storageName" closable
  19. :show="formTwo.storageName!=null" @close="tabClose(1)"></u-tag>
  20. </view>
  21. <view class="recentSearches" v-show="recentSearches.length != 0">
  22. <view class="recentSearches-head">
  23. <view class="recentSearches-headLeft">
  24. <u-icon name="clock"></u-icon>
  25. <view style="font-size: 26rpx;margin-left: 6rpx;">最近搜索</view>
  26. </view>
  27. <view class="recentSearches-headRight">
  28. <u-icon name="trash" size="20px" @click="searchDeleteShow = true"></u-icon>
  29. </view>
  30. </view>
  31. <view class="recentSearches-text">
  32. <u-tag v-for="(item,index) in recentSearches" :key="index" :text="item" bgColor="#e7e7e7"
  33. color="#000" borderColor="#e7e7e7" size="medium" closable @close="tagClose(index,item)"
  34. @click="tagSearches(item)"></u-tag>
  35. </view>
  36. </view>
  37. </view>
  38. <!-- <view class="statistics_h" style="font-size: 44rpx;">
  39. <view class="statistics">
  40. <view style="display: flex;margin: 5rpx auto;">
  41. <view style="width: 60%;text-align: center;">价格</view>
  42. <view style="width: 40%;text-align: center;">数量</view>
  43. </view>
  44. <view style="display: flex;margin: 5rpx auto;">
  45. <view style="width: 60%;">库存总价:¥{{priceForm.totalPrice}}</view>
  46. <view style="width: 40%;text-align: center;">
  47. {{priceForm.totalNumber?priceForm.totalNumber.slice(0,priceForm.totalNumber.length-3):priceForm.totalNumber}}
  48. </view>
  49. </view>
  50. <view style="display: flex;margin: 5rpx auto;">
  51. <view style="width: 60%;">当期入库:¥{{priceForm.RKPrice}}</view>
  52. <view style="width: 40%;text-align: center;">
  53. {{priceForm.RKNumber?priceForm.RKNumber.slice(0,priceForm.RKNumber.length-3):priceForm.RKNumber}}
  54. </view>
  55. </view>
  56. <view style="display: flex;margin: 5rpx auto;">
  57. <view style="width: 60%;">当期出库:¥{{priceForm.CKPrice}}</view>
  58. <view style="width: 40%;text-align: center;">
  59. {{priceForm.CKNumber?priceForm.CKNumber.slice(0,priceForm.CKNumber.length-3):priceForm.CKNumber}}
  60. </view>
  61. </view>
  62. </view>
  63. </view> -->
  64. <view style="margin: 0rpx auto;width: 96%;" :style="{'margin-top': (50+viewHeght)+'px'}">
  65. <view v-for="(item,index) in dataList" :key="item.id" style="width: 100%;margin: 10rpx auto; padding: 20rpx 0;
  66. background-color: #fff;border-radius: 10rpx;">
  67. <view style="width: 100%;margin: 0 auto;">
  68. <view style="display: flex;height: 180rpx;">
  69. <view style="width: 140rpx;height: 170rpx;">
  70. <image style="width: 100%;height: 100%;"
  71. :src="(item.goodsFilesList!=null&&item.goodsFilesList.length!=0)?item.goodsFilesList[0].url:'../../../static/images/404.png'">
  72. </image>
  73. </view>
  74. <view style="font-size: 24rpx;width: calc(100% - 150rpx);margin-left: 10rpx;">
  75. <view style="font-size: 26rpx;font-weight: bold;">{{item.cname}}</view>
  76. <view style="display: flex;margin: 10rpx 0;">
  77. <view style="width: 50%;">
  78. 均价:{{roleaName.indexOf('业务员') != -1?'***':item.inventoryCostPrice}}</view>
  79. <view style="width: 50%;">批次:{{item.dot}}</view>
  80. </view>
  81. <view style="display: flex">
  82. <view style="width: 50%;">仓库:{{item.storageName}}</view>
  83. <view style="width: 50%;">
  84. 库存:{{item.balanceQuantity?item.balanceQuantity:0}}
  85. </view>
  86. </view>
  87. <view style="display: flex">
  88. <view style="width: 50%;">售价A:{{item.priceOne}}</view>
  89. <view style="width: 50%;">售价B:{{item.priceTwo}}</view>
  90. </view>
  91. <view style="display: flex">
  92. <view style="width: 50%;">售价C:{{item.priceThree}}</view>
  93. <view style="width: 50%;">售价D:{{item.priceFour}} </view>
  94. </view>
  95. <!-- <view style="display: flex">
  96. <view style="width: 50%;">
  97. 库存下限:{{item.lowerLimit?item.lowerLimit.slice(0,item.lowerLimit.length-3):item.lowerLimit}}
  98. </view>
  99. <view style="width: 50%;">
  100. 产品分类:{{item.goodsType}}
  101. </view>
  102. </view> -->
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. <u-empty v-if="total == 0" style="position: absolute;top: 45%;left: 50%;transform:translate(-50%,-50%)"
  108. mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" />
  109. <u-loadmore v-if="total !== 0 && dataList.length != 0" :status="status" />
  110. </view>
  111. <u-popup :show="show" @close="show = false,mask = false" closeable :closeOnClickOverlay="false" zIndex="10070">
  112. <view style="mawidth: 100%;margin: auto 30rpx;margin-top: 20rpx;padding-bottom: 20rpx;">
  113. <text>筛选条件</text>
  114. <u--form labelPosition="left" :model="formTwo" labelWidth="150rpx">
  115. <u-form-item label="仓库" borderBottom :labelWidth='66'>
  116. <u-input readonly v-model="formTwo.storageName" placeholder="请选择仓库" border="none"
  117. @click.native='typeShow=true'></u-input>
  118. <u-icon slot="right" name="arrow-right" @click="typeShow=true"></u-icon>
  119. </u-form-item>
  120. </u--form>
  121. <!-- <text style="font-size: 30rpx;">库存筛选</text>
  122. <view style="display: flex;justify-content: space-between;">
  123. <u-button :type="formTwo.inventoryBalance == 0?'primary':''" text="库存数量>0" @click="stock(0)">
  124. </u-button>
  125. <u-button :type="formTwo.inventoryBalance == 1?'primary':''" text="库存数量≤0" @click="stock(1)">
  126. </u-button>
  127. </view>
  128. <text style="font-size: 30rpx;">标签筛选</text>
  129. <view>
  130. <u-checkbox-group v-model="formTwo.labels" placement="column">
  131. <u-checkbox :customStyle="{marginBottom: '8px'}" v-for="(item, index) in checkboxList"
  132. :key="index" :label="item.dictValue" :name="item.dictKey">
  133. </u-checkbox>
  134. </u-checkbox-group>
  135. </view> -->
  136. <view style="display: flex;justify-content: space-between;padding-top: 20rpx;">
  137. <view style="width: 45%;">
  138. <u-button text="全部清空" type="warning" @click="confirmEmptying"></u-button>
  139. </view>
  140. <view style="width: 45%;">
  141. <u-button text="确认搜索" type="primary" @click="confirmSearch"></u-button>
  142. </view>
  143. </view>
  144. </view>
  145. </u-popup>
  146. <u-modal :show="searchDeleteShow" content="确认删除搜索记录吗?" showCancelButton @confirm="searchDeletefun"
  147. @cancel="searchDeleteShow = false" ref="uModal" :asyncClose="true">
  148. </u-modal>
  149. <u-picker :show="typeShow" :columns="customerList" @close='typeShow=false' @cancel='typeShow=false'
  150. keyName="cname" @confirm='typeConfirm' maxRange='无限制' closeOnClickOverlay></u-picker>
  151. <!-- <u-picker :show="dropDown" :columns="columns" :keyName="keyName" @cancel="dropDown = false" @confirm="confirm">
  152. </u-picker> -->
  153. </view>
  154. </template>
  155. <script>
  156. import {
  157. queryBrand,
  158. queryStock,
  159. appStatistics,
  160. listAll
  161. } from '@/api/views/stock/index.js'
  162. import {
  163. storageDescListAll
  164. } from '@/api/OutboundTask/index.js'
  165. export default {
  166. data() {
  167. return {
  168. list: [{
  169. name: '全部',
  170. value: ''
  171. }],
  172. recentSearches: [], // 搜索数据
  173. searchDeleteShow: false, // 搜索全部删除弹窗
  174. customerList: [],
  175. typeShow: false,
  176. show: false,
  177. mask: false,
  178. dropDown: false,
  179. columns: [],
  180. checkboxList: [],
  181. name: '',
  182. status: 'loadmore',
  183. revenueTop: 0,
  184. keyName: '',
  185. total: 0,
  186. dataList: [],
  187. screen: [],
  188. priceForm: {},
  189. form: {
  190. size: 20,
  191. current: 1,
  192. cname: null
  193. },
  194. formTwo: {
  195. size: 20,
  196. current: 1,
  197. storageName: null,
  198. cname: null
  199. },
  200. roleaName: '', // 当前角色数据
  201. viewHeght: 0
  202. }
  203. },
  204. onLoad() {
  205. if (uni.getStorageSync('recentSearches')) {
  206. this.recentSearches = uni.getStorageSync('recentSearches');
  207. }
  208. this.roleaName = uni.getStorageSync('userInfo').role_name
  209. this.formTwo = uni.getStorageSync('stockForm') ? uni.getStorageSync('stockForm') : this.formTwo
  210. this.form = uni.getStorageSync('stockForm') ? uni.getStorageSync('stockForm') : this.form
  211. this.form.cname = null
  212. this.formTwo.cname = null
  213. this.$u.api.getWorkDicts('goods_lable').then(res => {
  214. this.checkboxList = res.data
  215. this.keyName = "dictValue"
  216. })
  217. // 获取分类
  218. listAll({
  219. corpType: 'SP'
  220. }).then(res => {
  221. res.data.forEach(item => this.list.push({
  222. name: item.title,
  223. value: item.id
  224. }))
  225. this.queryStockfun()
  226. })
  227. uni.getSystemInfo({
  228. success: (e) => {
  229. this.revenueTop = e.statusBarHeight
  230. }
  231. })
  232. storageDescListAll().then(res => {
  233. this.customerList = [res.data]
  234. })
  235. },
  236. onReachBottom() {
  237. this.status = 'loading'
  238. if (this.dataList.length < this.total) {
  239. this.form.current++
  240. this.queryStockfun()
  241. } else {
  242. this.status = 'nomore'
  243. }
  244. },
  245. methods: {
  246. // 搜索全部删除
  247. searchDeletefun() {
  248. this.recentSearches = []
  249. uni.setStorageSync('recentSearches', this.recentSearches);
  250. this.searchDeleteShow = false
  251. this.form.cname = null
  252. // this.custom()
  253. setTimeout(() => {
  254. this.getViewHeight()
  255. }, 100)
  256. },
  257. // 点击搜索
  258. tagSearches(name) {
  259. this.form.cname = name
  260. this.formTwo.cname = name
  261. this.custom()
  262. },
  263. tagClose(index, item) {
  264. this.recentSearches.splice(index, 1)
  265. uni.setStorageSync('recentSearches', this.recentSearches);
  266. if (this.form.cname == item) {
  267. this.form.cname = null
  268. }
  269. setTimeout(() => {
  270. this.getViewHeight()
  271. }, 100)
  272. },
  273. getViewHeight() {
  274. uni.createSelectorQuery().select('.tabClass', ).boundingClientRect(data => {
  275. this.viewHeght = data.height
  276. }).exec();
  277. uni.createSelectorQuery().select('.recentSearches', ).boundingClientRect(data => {
  278. this.viewHeght += data.height
  279. }).exec();
  280. },
  281. tabClose(type) {
  282. if (type == 1) {
  283. this.formTwo.storageName = null
  284. }
  285. uni.setStorageSync('stockForm', this.formTwo);
  286. this.confirmSearch()
  287. },
  288. typeConfirm(e) {
  289. this.formTwo.storageName = e.value[0].cname
  290. uni.setStorageSync('stockForm', this.formTwo);
  291. this.typeShow = false
  292. },
  293. confirmEmptying() {
  294. this.formTwo = {
  295. size: 20,
  296. current: 1,
  297. storageName: null,
  298. cname: null
  299. }
  300. this.form = {
  301. size: 20,
  302. current: 1,
  303. cname: null
  304. }
  305. this.dataList = []
  306. this.show = false
  307. this.mask = false
  308. this.queryStockfun()
  309. },
  310. confirmSearch() {
  311. let form = {
  312. ...JSON.parse(JSON.stringify(this.formTwo)),
  313. labels: this.formTwo.labels ? this.formTwo.labels.join(',') : '',
  314. size: 20,
  315. current: 1
  316. }
  317. this.form = form
  318. this.dataList = []
  319. this.show = false
  320. this.mask = false
  321. this.queryStockfun()
  322. },
  323. stock(val) {
  324. this.$set(this.formTwo, "inventoryBalance", val)
  325. },
  326. //集合筛选条件
  327. filterAll(screen) {
  328. this.screen = screen
  329. switch (screen[1]) {
  330. case "goodsTypeId":
  331. uni.showLoading({
  332. title: '加载中',
  333. mask: true
  334. });
  335. listAll().then(res => {
  336. this.columns = [res.data]
  337. this.keyName = "cname"
  338. this.dropDown = true
  339. uni.hideLoading()
  340. })
  341. break;
  342. }
  343. },
  344. //选择确认
  345. confirm(e) {
  346. this.formTwo[this.screen[0]] = e.value[0].cname
  347. this.formTwo[this.screen[1]] = e.value[0].id
  348. this.dropDown = false
  349. },
  350. queryStockfun() {
  351. uni.showLoading({
  352. title: '加载中',
  353. mask: true
  354. });
  355. /* appStatistics(this.form).then(res => {
  356. this.priceForm = res.data
  357. })*/
  358. queryStock(this.form).then(res => {
  359. this.total = res.data.total || 0
  360. if (res.data.records) {
  361. console.log(res.data.records)
  362. this.dataList = this.dataList.concat(res.data.records)
  363. }
  364. uni.hideLoading();
  365. if (this.total < 10) {
  366. this.status = 'nomore'
  367. }
  368. this.getViewHeight()
  369. })
  370. },
  371. custom(e) {
  372. if (this.form.cname) {
  373. this.recentSearches.unshift(this.form.cname)
  374. // 去重
  375. this.recentSearches = this.recentSearches.filter((item, index) => this.recentSearches.indexOf(item) ===
  376. index);
  377. uni.setStorageSync('recentSearches', this.recentSearches);
  378. }
  379. // this.form.cname=this.name
  380. // this.formTwo.cname=this.name
  381. this.dataList = []
  382. this.form.current = 1
  383. this.queryStockfun()
  384. },
  385. click(item) {
  386. this.dataList = []
  387. this.form.current = 1
  388. this.form.goodsTypeId = item.value,
  389. this.queryStockfun()
  390. }
  391. }
  392. }
  393. </script>
  394. <style scoped>
  395. .tl-show {
  396. overflow: hidden;
  397. position: fixed;
  398. height: 100%;
  399. width: 100%;
  400. }
  401. .topBackground {
  402. position: fixed;
  403. top: 0;
  404. z-index: 1;
  405. width: 100%;
  406. background-color: #FF6F3B;
  407. }
  408. .statistics_h {
  409. position: fixed;
  410. top: calc(88px + var(--status-bar-height));
  411. z-index: 1;
  412. width: 100%;
  413. background-color: #fff;
  414. padding-top: 10rpx;
  415. }
  416. .content {
  417. margin-top: 355rpx !important;
  418. }
  419. .statistics {
  420. width: calc(96% - 20rpx);
  421. margin: 0 auto;
  422. background: url("../../../static/images/bg.png") no-repeat;
  423. background-size: 100% 100%;
  424. border-radius: 20rpx;
  425. color: #fff;
  426. /* padding: 10rpx; */
  427. padding: 10rpx 0rpx 10rpx 10rpx;
  428. font-size: 38rpx;
  429. }
  430. /* ::v-deep .u-line {
  431. border-bottom: 4rpx dashed #B6B6B6 !important;
  432. } */
  433. ::v-deep .u-divider {
  434. margin: 10rpx;
  435. }
  436. ::v-deep .u-album__row__wrapper>uni-image {
  437. border-radius: 10rpx;
  438. border-top-right-radius: 0;
  439. border-bottom-right-radius: 0;
  440. }
  441. ::v-deep .u-navbar__content {
  442. background-image: linear-gradient(to bottom, #FD4B09, #FF6F3B);
  443. }
  444. .tabClass {
  445. display: flex;
  446. flex-direction: row;
  447. flex-wrap: wrap;
  448. background-color: #fff;
  449. }
  450. .recentSearches {
  451. padding: 10rpx 20rpx;
  452. background-color: #f2f2f2;
  453. }
  454. .recentSearches-head {
  455. display: flex;
  456. align-items: center;
  457. justify-content: space-between;
  458. }
  459. .recentSearches-headLeft {
  460. display: flex;
  461. align-items: center;
  462. }
  463. .recentSearches-text {
  464. display: flex;
  465. flex-wrap: wrap;
  466. align-items: baseline;
  467. }
  468. .recentSearches-textWidth {
  469. // width: 140rpx;
  470. }
  471. </style>