pointsMall.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. <template>
  2. <view>
  3. <view class="search">
  4. <view style="margin: 10rpx 20rpx;margin-top: 20rpx;">
  5. <u-search placeholder="请输入商品名称" inputAlign="center" bgColor="#fff" shape="square" v-model="search.cname"
  6. @search="searchButton" @custom="searchButton" :animation="false">
  7. </u-search>
  8. </view>
  9. <view v-if="false" style="margin: -15rpx auto 10rpx auto;display: flex;padding: 0 20rpx;z-index: 999;" >
  10. <u-tag :text="search.brandNmae" borderColor="#E75F37" color="#E75F37" plain size="medium" closable
  11. :show="false" @close="close" @click="close"></u-tag>
  12. <!-- <u-tag text="原厂" borderColor="#E75F37" color="#E75F37" plain size="medium" closable v-if="originalFactory"
  13. :show="originalFactory" @close="yuanchangclose('originalFactory')" @click="yuanchangclose('originalFactory')"></u-tag>
  14. <u-tag text="自修补" borderColor="#E75F37" color="#E75F37" plain size="medium" closable v-if="selfRecovery"
  15. :show="selfRecovery" @close="yuanchangclose('selfRecovery')" @click="yuanchangclose('selfRecovery')"></u-tag>
  16. <u-tag text="防爆" borderColor="#E75F37" color="#E75F37" plain size="medium" closable v-if="explosionProof"
  17. :show="explosionProof" @close="yuanchangclose('explosionProof')" @click="yuanchangclose('explosionProof')"></u-tag> -->
  18. </view>
  19. </view>
  20. <!-- :style="{marginTop:show == true?'108rpx':'108rpx'}" -->
  21. <view style="background-color: #fff;margin-bottom: 20rpx;margin-top:108rpx" >
  22. <view class="cardBox classification">
  23. <view class="classificationBox" v-for="(item,index) in brandList" :key="item.id"
  24. @click="click(index)">
  25. <view class="classificationBox_img">
  26. <image :src="item.brandFilesList[0].url" mode=""></image>
  27. </view>
  28. <view class="classificationBox_text" :style="PPindex == index?'color:#3c9cff':''">{{item.cname}}</view>
  29. </view>
  30. <view class="classificationBox" @click="Moreprojectsfun"
  31. v-if="brandList.length >= 7 && gengduofalse">
  32. <view class="classificationBox_img">
  33. <image src="../../static/images/view/buyGoods/gengduo.png"
  34. style="width: 60rpx;height: 60rpx;" mode=""></image>
  35. </view>
  36. <view class="classificationBox_text">更多项目</view>
  37. </view>
  38. <view class="classificationBox" @click="shohuifun"
  39. v-if="brandList.length >= zsbrandList.length && zsbrandList.length > 8">
  40. <view class="classificationBox_img">
  41. <image src="../../static/images/view/buyGoods/fanhui.png"
  42. style="width: 60rpx;height: 60rpx;" mode=""></image>
  43. </view>
  44. <view class="classificationBox_text">收回项目</view>
  45. </view>
  46. <!-- <u-grid :border="false" @click="click" col="4">
  47. <u-grid-item v-for="(item,index) in brandList" :key="index">
  48. <view v-if="item.brandFilesList.length>0" style="text-align: center;">
  49. <view v-for="(li,i) in item.brandFilesList" :key="i" :src="li.url">
  50. <image :src="li.url" style="width: 80rpx;height: 80rpx;"></image>
  51. <view style="font-size: 28rpx;" :style="PPindex == index?'color:#3c9cff':''" >{{item.cname}}</view>
  52. </view>
  53. </view>
  54. <view v-else style="text-align: center;">
  55. <u-icon :customStyle="{paddingBottom:8+'rpx'}" labelPos="bottom" name="error-circle"
  56. :size="40"></u-icon>
  57. <view style="font-size: 28rpx;">{{item.cname}}</view>
  58. </view>
  59. </u-grid-item>
  60. </u-grid> -->
  61. </view>
  62. <view style="margin-top: 10rpx;display: flex;">
  63. <u-tabs :list="dianjiqielist" v-model="groupModel" @click="groupChange"></u-tabs>
  64. </view>
  65. <view style="padding: 20rpx 20rpx;">
  66. <u-divider text="爆品推荐"></u-divider>
  67. </view>
  68. </view>
  69. <view style="margin-top: 0rpx;" class="content">
  70. <view class="left">
  71. <block v-for="(item,index) in dataList" :key="index" v-if="index%2==0">
  72. <view class="item" @click="choice(item,index)">
  73. <image v-for="(ite,ind) in item.filesList" :key="ind" v-if="ite.version === '0'" :src="ite.url"
  74. style="width: 100%;height: 340rpx;border-top-left-radius: 20rpx;border-top-right-radius: 20rpx;">
  75. </image>
  76. <view style="width: calc(100% - 20rpx);margin: 0 auto;">
  77. <u--text :text="item.cname" lines="2" size="12"></u--text>
  78. <view style="display: flex;justify-content: space-between;margin: 5rpx auto;">
  79. <view style="padding-top: 12rpx;">
  80. <view v-if="item.billType == 0"
  81. style="font-size: 16rpx;background-color: #E75F37;color: #fff;padding: 6rpx;border-radius: 6rpx;">
  82. 今日达</view>
  83. <view v-else
  84. style="font-size: 16rpx;background-color: #5ac725;color: #fff;padding: 6rpx;border-radius: 6rpx;">
  85. 次日达</view>
  86. </view>
  87. <view style="color: #E75F37;font-size: 40rpx;">¥{{checkStatus == '通过'?item.mallPrice:'***'}}</view>
  88. </view>
  89. </view>
  90. </view>
  91. </block>
  92. </view>
  93. <view class="right">
  94. <block v-for="(item,index) in dataList" :key="index" v-if="index%2==1">
  95. <view class="item" @click="choice(item,index)">
  96. <image v-for="(ite,ind) in item.filesList" :key="ind" v-if="ite.version === '0'" :src="ite.url"
  97. style="width: 100%;height: 340rpx;border-top-left-radius: 20rpx;
  98. border-top-right-radius: 20rpx;">
  99. </image>
  100. <view style="width: calc(100% - 20rpx);margin: 0 auto;">
  101. <u--text :text="item.cname" lines="2" size="12"></u--text>
  102. <view style="display: flex;justify-content: space-between;margin: 5rpx auto;">
  103. <view style="padding-top: 12rpx;">
  104. <view v-if="item.billType == 0"
  105. style="font-size: 16rpx;background-color: #E75F37;color: #fff;padding: 6rpx;border-radius: 6rpx;">
  106. 今日达</view>
  107. <view v-else
  108. style="font-size: 16rpx;background-color: #5ac725;color: #fff;padding: 6rpx;border-radius: 6rpx;">
  109. 次日达</view>
  110. </view>
  111. <view style="color: #E75F37;font-size: 40rpx;">¥{{checkStatus == '通过'?item.mallPrice:'***'}}</view>
  112. </view>
  113. </view>
  114. </view>
  115. </block>
  116. </view>
  117. </view>
  118. <u-empty v-if="dataList.length == 0" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" />
  119. <u-loadmore v-if="page.total !== 0 && dataList.length != 0" :status="status" />
  120. </view>
  121. </template>
  122. <script>
  123. import {
  124. appList,
  125. userDept,
  126. validationCorpEmpty,
  127. } from '@/api/tabBar/home.js'
  128. import {
  129. listAll
  130. } from '@/api/tabBar/classification.js'
  131. import {
  132. details,
  133. } from '@/api/views/personalInformation/index.js'
  134. export default {
  135. data() {
  136. return {
  137. show:false,
  138. search: {},
  139. page: {
  140. total: 0,
  141. size: 10,
  142. current: 1
  143. },
  144. status: 'loadmore',
  145. dataList: [],
  146. brandList: [],
  147. // 静音棉
  148. originalFactory:0,
  149. // 自修补
  150. selfRecovery:0,
  151. // 防爆
  152. explosionProof:0,
  153. dianjiqielist:[
  154. {
  155. name: '全部',
  156. },
  157. {
  158. name: '静音棉',
  159. },
  160. {
  161. name: '自修补',
  162. },
  163. {
  164. name: '防爆',
  165. }
  166. ],
  167. groupModel:null,
  168. PPindex:null,
  169. // 品牌
  170. zsbrandList:[],
  171. brandDescfor:7,
  172. gengduofalse:true,
  173. // 审核状态
  174. checkStatus:'',
  175. enableOrNot:'',
  176. }
  177. },
  178. onReachBottom() {
  179. this.status = 'loading'
  180. if (this.dataList.length < this.page.total) {
  181. this.page.current++
  182. this.onSearch()
  183. } else {
  184. this.status = 'nomore'
  185. }
  186. },
  187. onLoad(e) {
  188. console.log(e,200);
  189. },
  190. onShow() {
  191. // tenant_id
  192. if (uni.getStorageSync('cname')) {
  193. this.$set(this.search,'cname',JSON.parse(JSON.stringify(uni.getStorageSync('cname'))))
  194. uni.removeStorageSync('cname')
  195. }
  196. // 获取审核状态
  197. details().then(res => {
  198. this.checkStatus = res.data.checkStatus
  199. this.enableOrNot = res.data.enableOrNot
  200. uni.setStorageSync('checkStatus', res.data.checkStatus);
  201. uni.setStorageSync('enableOrNot', res.data.enableOrNot);
  202. })
  203. uni.showLoading({
  204. title: '加载中',
  205. mask: true
  206. });
  207. // 判断是怎么登录的
  208. if (JSON.parse(JSON.stringify(uni.getStorageSync('userInfo'))).tenant_id != '000000') {
  209. validationCorpEmpty().then(res => {
  210. uni.hideLoading();
  211. //获取公司名称
  212. userDept().then(res => {
  213. uni.setNavigationBarTitle({
  214. title: res.data.fullName
  215. })
  216. })
  217. //获取所有品牌
  218. listAll({type:'PP', enableOrNot:'1'}).then(res => {
  219. this.zsbrandList = []
  220. this.brandList = []
  221. // this.zsbrandList = res.data
  222. this.zsbrandList = res.data.sort(this.compare('sort'))
  223. if (this.zsbrandList.length <= 8) {
  224. this.gengduofalse = false
  225. this.brandList = this.zsbrandList
  226. }else {
  227. for(let i in res.data) {
  228. if (i < this.brandDescfor) {
  229. this.brandList.push(res.data[i])
  230. }
  231. }
  232. }
  233. })
  234. this.page = {
  235. total: 0,
  236. size: 10,
  237. current: 1
  238. }
  239. this.dataList = []
  240. this.onSearch()
  241. }).catch(err => {
  242. uni.hideLoading();
  243. uni.$u.route('/pages/views/personalInformation/index');
  244. })
  245. }else {
  246. uni.setNavigationBarTitle({
  247. title: '青岛途宝'
  248. })
  249. //获取所有品牌
  250. listAll({type:'PP', enableOrNot:'1'}).then(res => {
  251. this.zsbrandList = []
  252. this.brandList = []
  253. // this.zsbrandList = res.data
  254. this.zsbrandList = res.data.sort(this.compare('sort'))
  255. if (this.zsbrandList.length <= 8) {
  256. this.gengduofalse = false
  257. this.brandList = this.zsbrandList
  258. }else {
  259. for(let i in res.data) {
  260. if (i < this.brandDescfor) {
  261. this.brandList.push(res.data[i])
  262. }
  263. }
  264. }
  265. })
  266. this.page = {
  267. total: 0,
  268. size: 10,
  269. current: 1
  270. }
  271. this.dataList = []
  272. this.onSearch()
  273. }
  274. uni.hideLoading();
  275. },
  276. methods: {
  277. // 数组排序 property:根据什么属性排序
  278. compare(property){
  279. return function(a,b) {
  280. var value1 = a[property]
  281. var value2 = b[property]
  282. return value1 - value2
  283. }
  284. },
  285. // 更多项目盒子
  286. Moreprojectsfun(){
  287. this.brandDescfor += 4
  288. this.brandList = []
  289. console.log(123);
  290. for(let i in this.zsbrandList) {
  291. if (i < this.brandDescfor) {
  292. this.brandList.push(this.zsbrandList[i])
  293. }
  294. }
  295. if (this.brandDescfor >= this.zsbrandList.length) {
  296. this.gengduofalse = false
  297. }
  298. },
  299. // 收回项目
  300. shohuifun(){
  301. this.brandDescfor = 7
  302. this.brandList = []
  303. for(let i in this.zsbrandList) {
  304. if (i < this.brandDescfor) {
  305. this.brandList.push(this.zsbrandList[i])
  306. }
  307. }
  308. this.gengduofalse = true
  309. // if (this.brandDescfor >= this.zsbrandList.length) {
  310. // this.gengduofalse = false
  311. // }
  312. },
  313. groupChange(e){
  314. console.log(e,228);
  315. if (e.name == '静音棉') {
  316. this.originalFactory = 1
  317. this.selfRecovery = 0
  318. this.explosionProof = 0
  319. }else if (e.name == '自修补') {
  320. this.originalFactory = 0
  321. this.selfRecovery = 1
  322. this.explosionProof = 0
  323. }else if (e.name == '防爆') {
  324. this.originalFactory = 0
  325. this.selfRecovery = 0
  326. this.explosionProof = 1
  327. }else {
  328. this.originalFactory = 0
  329. this.selfRecovery = 0
  330. this.explosionProof = 0
  331. }
  332. this.page.current = 1
  333. this.dataList = []
  334. this.onSearch()
  335. },
  336. // 点击筛选条件
  337. dianjiqiehuan(name){
  338. if (this[name] == 0) {
  339. this[name] = 1
  340. }else {
  341. this[name] = 0
  342. }
  343. this.click()
  344. },
  345. // 获取列表数据
  346. onSearch() {
  347. uni.showLoading({
  348. title: '加载中',
  349. mask: true
  350. });
  351. let obj = {}
  352. if(this.originalFactory){
  353. obj.originalFactory = 1
  354. }
  355. if (this.selfRecovery){
  356. obj.selfRecovery = 1
  357. }
  358. if (this.explosionProof) {
  359. obj.explosionProof = 1
  360. }
  361. appList({
  362. size: this.page.size,
  363. current: this.page.current,
  364. ...obj,
  365. ...this.search,
  366. whetherIntegral:1
  367. }).then(res => {
  368. this.dataList = this.dataList.concat(res.data.records)
  369. this.page.total = res.data.total
  370. if (this.dataList.length == res.data.total) {
  371. this.status = 'nomore'
  372. }
  373. uni.hideLoading();
  374. }).catch(err => {
  375. uni.hideLoading();
  376. })
  377. },
  378. close(){
  379. this.show = false
  380. this.search.brandId = ''
  381. this.search.brandName = ''
  382. },
  383. // 原厂点击差号
  384. yuanchangclose(type){
  385. if (type == 'originalFactory') {
  386. this.originalFactory = false
  387. }else if (type == 'selfRecovery') {
  388. this.selfRecovery = false
  389. }else {
  390. this.explosionProof = false
  391. }
  392. this.click()
  393. },
  394. click(name) {
  395. if (name != undefined) {
  396. this.page = {
  397. total: 0,
  398. size: 10,
  399. current: 1,
  400. }
  401. this.dataList = []
  402. if (this.PPindex == name) {
  403. this.PPindex = null
  404. delete this.search.brandId
  405. delete this.search.brandNmae
  406. }else {
  407. this.PPindex = name
  408. this.search = {
  409. ...this.search,
  410. brandId: this.brandList[this.PPindex].id,
  411. brandNmae: this.brandList[this.PPindex].cname,
  412. }
  413. }
  414. }
  415. this.show = true
  416. this.onSearch()
  417. },
  418. searchButton(value) {
  419. this.dataList = []
  420. this.page = {
  421. total: 0,
  422. size: 10,
  423. current: 1
  424. }
  425. this.search = {
  426. ...this.search,
  427. cname: value,
  428. }
  429. this.onSearch()
  430. },
  431. //打开明细
  432. choice(item, index) {
  433. if (this.checkStatus != '通过') {
  434. uni.showToast({
  435. title: "当前用户未授权,请联系客服",
  436. icon: "none",
  437. mask:true
  438. });
  439. return
  440. }
  441. uni.$u.route('/pages/views/buyGoods/pointsDetails', {
  442. id: item.id
  443. });
  444. },
  445. }
  446. }
  447. </script>
  448. <style lang="scss" scoped>
  449. ::v-deep .u-divider {
  450. margin: 0 !important;
  451. }
  452. .content {
  453. text-align: justify;
  454. }
  455. .left,
  456. .right {
  457. display: inline-block;
  458. vertical-align: top;
  459. width: 50%;
  460. }
  461. .item {
  462. width: calc(100% - 20rpx);
  463. margin: 0 auto;
  464. background-color: #FFFFFF;
  465. border-radius: 10rpx;
  466. break-inside: avoid;
  467. margin-bottom: 20rpx;
  468. }
  469. .search {
  470. width: 100%;
  471. position: fixed;
  472. top: 0;
  473. z-index: 8;
  474. background-color: #f2f2f2;
  475. }
  476. .cardBox {
  477. margin-top: 20rpx;
  478. background: #fff;
  479. border-radius: 12rpx;
  480. width: 100%;
  481. padding: 40rpx;
  482. box-sizing: border-box;
  483. .classificationBox {
  484. width: 25%;
  485. display: flex;
  486. flex-direction: column;
  487. align-items: center;
  488. margin: 10rpx 0;
  489. .classificationBox_img {
  490. width: 70rpx;
  491. height: 70rpx;
  492. // filter: grayscale(100%) hue-rotate(180deg) brightness(0.5) contrast(200%);
  493. // mix-blend-mode: screen;
  494. // background-color: #FF00FF;
  495. }
  496. .classificationBox_text {
  497. margin-top: 10rpx;
  498. font-size: 28rpx;
  499. color: #101010;
  500. }
  501. .brandDescColor {
  502. color: #92c3fd;
  503. // border: 2rpx solid;
  504. }
  505. }
  506. }
  507. .classification {
  508. display: flex;
  509. flex-wrap: wrap;
  510. min-height: 180rpx;
  511. }
  512. image {
  513. width: 100%;
  514. height: 100%;
  515. }
  516. </style>