my-product.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218
  1. <template>
  2. <view class="container product clearfix">
  3. <view class="superv-header" :class="forbid ? 'forbid' : ''">
  4. <template v-if="forbid">
  5. <text>提示:您的上架费已到期,已禁止商品的所有操作,支付账户上架费后才能继续操作。</text>
  6. </template>
  7. <template v-else>
  8. <view class="superv-header-click" v-if="!isSuperv">
  9. <view class="oltext" @click="supervClickFn">管理</view>
  10. <view class="ortext" @click="searchClickFn">筛选</view>
  11. </view>
  12. <view class="superv-header-checked" v-else>
  13. <view class="oltext" @click="isCheckedAll">
  14. <view class="checkbox iconfont" :class="[isAllChecked ?'icon-yixuanze':'icon-weixuanze']"></view>
  15. <view class="text">全选</view>
  16. </view>
  17. <view class="ortext" @click="closeSupervFn">完成</view>
  18. </view>
  19. </template>
  20. </view>
  21. <view class="product-content" :style="{ paddingTop :forbid ? '100rpx' : '80rpx' }">
  22. <view :class="{'tui-order-list':scrollTop >= 0}" class="clearfix">
  23. <!-- 空白页 -->
  24. <view class="empty-container" v-if="isEmpty">
  25. <image class="empty-container-image" src="https://img.caimei365.com/group1/M00/03/71/Cmis2F3wna6AY2ZjAABpmnBICH4247.png"></image>
  26. <text class="error-text">暂未发布任何商品~</text>
  27. </view>
  28. <!-- 列表 -->
  29. <checkbox-group @change="buyChange" class="tui-group">
  30. <view class="tui-cart-cell tui-mtop" v-for="(item,index) in dataList" :key="index">
  31. <tui-swipe-actions :actions="item.actions" @click="handlerButton($event,item)" :params="item" :forbid="forbid">
  32. <template v-slot:content>
  33. <view class="tui-goods-item">
  34. <view class="tui-goods-checkBox" v-if="isSuperv">
  35. <view class="checkbox iconfont" :class="[item.isChecked ?'icon-yixuanze':'icon-weixuanze']" @click="checkedSoperv(item)"></view>
  36. </view>
  37. <view class="tui-goods-image">
  38. <image :src="item.image" class="tui-goods-img"/>
  39. </view>
  40. <view class="tui-goods-info" :style="{width:isSuperv ? '360rpx' : '420rpx'}">
  41. <view class="tui-goods-title">{{ item.name }}</view>
  42. <view class="tui-price-box">
  43. <view class="tui-goods-price">¥{{item.price | NumFormat}}</view>
  44. </view>
  45. <view class="tui-goods-pip">市场价:¥{{item.normalPrice | NumFormat}}</view>
  46. <view class="tui-goods-pip">新品展示: <text class="red">{{ item.showFlag | newvalidFlagFilters }}</text> </view>
  47. <view class="tui-goods-pip">分类:{{ item.typeName ? item.typeName : '无' }}</view>
  48. </view>
  49. <view class="tui-goods-status">
  50. <view class="status-text" :style="{ color: verifyColorFilter(item.validFlag)}">
  51. {{ item.validFlag | verifyStatusFilter }}
  52. </view>
  53. </view>
  54. </view>
  55. </template>
  56. </tui-swipe-actions>
  57. </view>
  58. </checkbox-group>
  59. <!--加载loadding-->
  60. <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
  61. <tui-nomore :visible="!pullUpOn" :backgroundColor="'#ffffff'" :text='nomoreText'></tui-nomore>
  62. <!--加载loadding-->
  63. </view>
  64. </view>
  65. <tui-modal :show="modal" @click="handleClick" @cancel="hideMobel" :content="contentModalText" color="#333" :size="32" shape="circle" :maskClosable="false"></tui-modal>
  66. <!--右抽屉-->
  67. <tui-drawer mode="right" :visible="rightDrawer" @close="closeDrawer">
  68. <view class="d-container clearfix">
  69. <scroll-view class="tui-popup-scroll" :scroll-y="true" >
  70. <view class="d-label">商品名称:</view>
  71. <view class="d-input">
  72. <input class="input" type="text" value="" v-model="listQuery.name" placeholder="输入商品名称"/>
  73. </view>
  74. <view class="d-label">商品货号:</view>
  75. <view class="d-input">
  76. <input class="input" type="text" value="" v-model="listQuery.productCode" placeholder="输入商品货号"/>
  77. </view>
  78. <view class="d-label">状态:</view>
  79. <view class="d-input">
  80. <picker @change="bindPickerChange(1,$event)" :value="index" :range="statusActions" range-key="name">
  81. <input class="input" type="text" disabled="false" v-model="validFlagText" value="" placeholder="请选择审核状态"/>
  82. <text class="iconfont icon-xiangyou"></text>
  83. </picker>
  84. </view>
  85. <view class="d-label">主推商品:</view>
  86. <view class="d-input">
  87. <picker @change="bindPickerChange(2,$event)" :value="index" :range="recommendActions" range-key="name">
  88. <input class="input" type="text" disabled="false" v-model="featuredFlagText" value="" placeholder="请选择"/>
  89. <text class="iconfont icon-xiangyou"></text>
  90. </picker>
  91. </view>
  92. <view class="d-label">商品属性:</view>
  93. <view class="d-input">
  94. <picker @change="bindPickerChange(0,$event)" :value="index" :range="commodityTypeActons" range-key="name">
  95. <input class="input" type="text" disabled="false" v-model="commodityTypeText" value="" placeholder="请选择"/>
  96. <text class="iconfont icon-xiangyou"></text>
  97. </picker>
  98. </view>
  99. <view class="d-label">商品分类:</view>
  100. <view class="d-input">
  101. <picker @change="bindPickerChange(3,$event)" :value="index" :range="classificationFirstList" range-key="name">
  102. <input class="input" type="text" disabled="false" v-model="firstClassificationText" value="" placeholder="请选择一分类"/>
  103. <text class="iconfont icon-xiangyou"></text>
  104. </picker>
  105. </view>
  106. <view class="d-input">
  107. <picker @change="bindPickerChange(4,$event)" :value="index" :range="classificationTwoList" range-key="name">
  108. <input class="input" type="text" disabled="false" v-model="twoClassificationText" value="" placeholder="请选择二级分类"/>
  109. <text class="iconfont icon-xiangyou"></text>
  110. </picker>
  111. </view>
  112. <view class="d-input">
  113. <picker @change="bindPickerChange(5,$event)" :value="index" :range="classificationThreeList" range-key="name">
  114. <input class="input" type="text" disabled="false" v-model="threeClassificationText" value="" placeholder="请选择三级分类"/>
  115. <text class="iconfont icon-xiangyou"></text>
  116. </picker>
  117. </view>
  118. <view class="d-label">新品展示:</view>
  119. <view class="d-input">
  120. <picker @change="bindPickerChange(6,$event)" :value="index" :range="newFlagActions" range-key="name">
  121. <input class="input" type="text" disabled="false" v-model="newvalidFlagText" value="" placeholder="请选择"/>
  122. <text class="iconfont icon-xiangyou"></text>
  123. </picker>
  124. </view>
  125. <view class="d-input btn">
  126. <view class="d-btn comfrim" @click="handSearchList">确定</view>
  127. <view class="d-btn clear" @click="handSearchClear">重置</view>
  128. </view>
  129. </scroll-view>
  130. </view>
  131. </tui-drawer>
  132. <!-- 批量操作 -->
  133. <tui-bottom-popup :radius="false" :mask="false" :show="isSuperv">
  134. <view class="tui-popup-box clearfix">
  135. <view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom :isIphoneX ? '68rpx' : '0rpx' }">
  136. <view class="tui-flex-1">
  137. <view class="tui-button" :class="isProductChecked ? 'active' : ''" @click="handleAllUnder()">批量下架</view>
  138. </view>
  139. </view>
  140. </view>
  141. </tui-bottom-popup>
  142. </view>
  143. </template>
  144. <script>
  145. import tuiLoadmore from '@/components/tui-components/loadmore/loadmore'
  146. import tuiNomore from '@/components/tui-components/nomore/nomore'
  147. import modalLayer from '@/components/modal-layer'
  148. import { mapState,mapMutations } from 'vuex'
  149. const defaultListQuery = {
  150. shopId:'',
  151. pageNum:1,
  152. pageSize:10,
  153. productCode:'',//货号
  154. name:'',//商品名称
  155. validFlag:'',//状态
  156. newvalidFlag:'',//新品展示状态
  157. featuredFlag:'',//是否主推
  158. commodityType:'',//商品属性
  159. bigTypeId:0,//一级
  160. smallTypeId:0,//二级
  161. tinyTypeId:0//三级
  162. }
  163. export default{
  164. components: {
  165. tuiLoadmore,
  166. tuiNomore
  167. },
  168. data() {
  169. return{
  170. CustomBar:this.CustomBar,
  171. shopId:0,
  172. isSuperv:false,
  173. isProductChecked:false,
  174. validFlagText:'',
  175. featuredFlagText:'',
  176. newvalidFlagText:'',
  177. commodityTypeText:'产品',//预览商品属性
  178. firstClassificationText:'',
  179. twoClassificationText:'',
  180. threeClassificationText:'',
  181. recommendActions: [{name:'是',value:1},{name: '否',value:0}],
  182. commodityTypeActons: [{name:'产品',value:1},{name: '仪器',value:2}],
  183. newFlagActions: [
  184. {name:'全部',value:''},
  185. {name: '待审核',value:0},
  186. {name: '已展示',value:1},
  187. {name: '展示过期',value:2},
  188. {name: '未展示',value:3},
  189. {name: '审核未通过',value:4},
  190. {name: '已下线',value:5}
  191. ],
  192. statusActions: [
  193. {name:'全部',value:''},
  194. {name: '未审核',value:1},
  195. {name: '审核未通过',value:8},
  196. {name: '已上架',value:2},
  197. {name: '已下架',value:3},
  198. {name: '已冻结',value:10},
  199. {name: '已隐身',value:9},
  200. {name: '已删除',value:0},
  201. ],
  202. classificationFirstList:[],
  203. classificationTwoList:[],
  204. classificationThreeList:[],
  205. currents:0,
  206. userID:0,
  207. listQuery:Object.assign({}, defaultListQuery),
  208. dataList: [],
  209. btnoRderID: 0, //点击按钮传入的的订单ID
  210. scrollTop: 0,
  211. deteleType:'',
  212. skeletonShow: true,
  213. isEmpty: false,
  214. isDelete:false,
  215. isAllChecked:false,
  216. isModalLayer: false,
  217. loadding: false,
  218. pullUpOn: true,
  219. pullFlag: true,
  220. hasNextPage: false,
  221. navbarHeight:'',
  222. nomoreText: '上拉显示更多',
  223. contentModalText:'',//操作文字提示语句
  224. modal:false,
  225. rightDrawer: false,
  226. handlerProduct:{},//储存监听商品信息
  227. OperationType:'',//操作类型
  228. isCmcustomClass : 'left',
  229. featuredNum:0,
  230. productIds:'',//批量下架操作商品ID
  231. forbid:false
  232. }
  233. },
  234. onLoad(option){
  235. switch(option.listType){
  236. case '0':
  237. this.listQuery.validFlag =''
  238. break
  239. case '1':
  240. this.listQuery.validFlag = 2
  241. break
  242. case '2':
  243. this.listQuery.validFlag = 3
  244. break
  245. }
  246. this.$api.getComStorage('userInfo').then((resolve) =>{
  247. this.listQuery.shopId = this.shopId = resolve.shopId
  248. this.GetProductListInfo()
  249. })
  250. },
  251. filters: {
  252. NumFormat:function(text) {//处理金额
  253. return Number(text).toFixed(2)
  254. },
  255. verifyStatusFilter: function(state){
  256. let stateText = '',
  257. stateTextObject={
  258. 0:'已删除',
  259. 1:'待审核',
  260. 2:'已上架',
  261. 3:'已下架',
  262. 8:'审核未通过',
  263. 9:'已隐身',
  264. 10:'已冻结',
  265. }
  266. Object.keys(stateTextObject).forEach(function(key) {
  267. if(key == state){
  268. stateText = stateTextObject[key]
  269. }
  270. })
  271. return stateText
  272. },
  273. newvalidFlagFilters(value) {
  274. //新品展示状态
  275. const map = {
  276. 0: '待审核',
  277. 1: '已展示',
  278. 2: '展示过期',
  279. 3: '未展示',
  280. 4: '审核未通过',
  281. 5: '已下线'
  282. }
  283. return map[value]
  284. }
  285. },
  286. computed: {
  287. ...mapState(['hasLogin','userInfo'])
  288. },
  289. methods:{
  290. ...mapMutations(['login','logout']),
  291. GetProductListInfo(){
  292. this.listQuery.pageNum = 1
  293. this.ShopService.GetSupplierPyProduct(this.listQuery).then(response =>{
  294. let data = response.data.productPage
  295. this.featuredNum = response.data.featuredNum
  296. this.forbid = response.data.listingFee === 1 ? true : false
  297. this.hasNextPage = data.hasNextPage
  298. if(data.results && data.results.length > 0){
  299. this.isEmpty = false
  300. this.dataList = data.results
  301. this.handleDataList()
  302. if(this.hasNextPage){
  303. this.pullUpOn = false
  304. this.nomoreText = '上拉显示更多'
  305. }else{
  306. if(this.dataList.length < 5){
  307. this.pullUpOn = true
  308. }else{
  309. this.pullUpOn = false
  310. this.nomoreText = '已至底部'
  311. }
  312. }
  313. this.GetPrimaryClassification(this.listQuery.commodityType)
  314. }else{
  315. this.dataList = []
  316. this.isEmpty = true
  317. this.pullUpOn = true
  318. }
  319. }).catch(error =>{
  320. this.$util.msg(error.msg,2000)
  321. })
  322. },
  323. GetOnReachBottomData(index){//上拉加载
  324. this.listQuery.pageNum += 1
  325. this.ShopService.GetSupplierPyProduct(this.listQuery).then(response =>{
  326. let data = response.data.productPage
  327. this.featuredNum = response.data.featuredNum
  328. this.hasNextPage = data.hasNextPage
  329. this.dataList = this.dataList.concat(data.results)
  330. this.handleDataList()
  331. this.pullFlag = false// 防上拉暴滑
  332. setTimeout(()=>{this.pullFlag = true},500)
  333. if(this.hasNextPage){
  334. this.pullUpOn = false
  335. this.nomoreText = '上拉显示更多'
  336. }else{
  337. this.loadding = false
  338. this.pullUpOn = false
  339. this.nomoreText = '已至底部'
  340. }
  341. })
  342. },
  343. handleDataList(){//根据商品状态set不同的tabAction返回新的数据
  344. this.dataList.forEach(item =>{
  345. if(item.validFlag === 0 || item.validFlag === 3 || item.validFlag === 8 || item.validFlag === 9){
  346. item.actions = [
  347. {name: '无操作',color: '#fff',fontsize: 26,width: 50,background: '#e1e1e1'},
  348. ]
  349. }else if(item.validFlag === 1 || item.validFlag === 10){
  350. item.actions = [
  351. {name: '查看详情',color: '#fff',fontsize: 26,width: 50,background: '#f9a94b'},
  352. ]
  353. }else if(item.validFlag === 2){
  354. if(item.featuredFlag ===1){
  355. item.actions = [
  356. {name: '查看详情',color: '#fff',fontsize: 26,width: 50,background: '#f9a94b'},
  357. {name: '删除主页推荐',color: '#fff',fontsize: 26,width: 50,background: '#ff7a51'},
  358. {name: '下架',color: '#fff',fontsize: 26,width: 50,background: '#fea785'},
  359. ]
  360. }else{
  361. item.actions = [
  362. {name: '查看详情',color: '#fff',fontsize: 26,width: 50,background: '#f9a94b'},
  363. {name: '添加主页推荐',color: '#fff',fontsize: 26,width: 50,background: '#ff7a51'},
  364. {name: '下架',color: '#fff',fontsize: 26,width: 50,background: '#fea785'},
  365. ]
  366. }
  367. }
  368. })
  369. console.log(this.dataList)
  370. },
  371. handSearchList(){//搜索
  372. this.GetProductListInfo()
  373. this.leftDrawer = false
  374. this.rightDrawer = false
  375. },
  376. handSearchClear(){//重置搜索条件
  377. this.listQuery = Object.assign({}, defaultListQuery)
  378. this.listQuery.shopId = this.shopId
  379. this.validFlagText=''
  380. this.featuredFlagText=''
  381. this.newvalidFlagText=''
  382. this.commodityTypeText=''
  383. this.firstClassificationText=''
  384. this.twoClassificationText=''
  385. this.threeClassificationText=''
  386. this.classificationTwoList = []
  387. this.classificationThreeList = []
  388. },
  389. handlerButton(e,item){//监听侧滑按钮点击事件
  390. if(item.validFlag === 0 || item.validFlag === 3 || item.validFlag === 8 || item.validFlag === 9){
  391. if(e.index == 0){
  392. return
  393. }
  394. }else if(item.validFlag === 1 || item.validFlag === 10){
  395. if(e.index == 0){
  396. this.$api.navigateTo(`/pages/goods/product?id=${item.productId}`)
  397. }
  398. }else if(item.validFlag === 2){
  399. switch(e.index){
  400. case 0:
  401. this.$api.navigateTo(`/pages/goods/product?id=${item.productId}`)
  402. break
  403. case 1:
  404. if(item.featuredFlag === 1){
  405. this.handleDeleteShopRemb(item)
  406. }else{
  407. this.handleAddShopRemb(item)
  408. }
  409. break
  410. case 2:
  411. this.handleUnder(item)
  412. }
  413. }
  414. },
  415. handleAddShopRemb(item){//添加主页推荐
  416. let num = 4- this.featuredNum
  417. this.OperationType = 'add'
  418. this.handlerProduct = item
  419. this.modal = true
  420. this.contentModalText = `总共能添加4个主推商品,您还能添加${num}个确定将该商品添加为主推商品吗?`
  421. },
  422. handleDeleteShopRemb(item){//删除主页推荐
  423. this.OperationType = 'delete'
  424. this.handlerProduct = item
  425. this.modal = true
  426. this.contentModalText = '是否把该商品从主推商品中删除?'
  427. },
  428. handleUnder(item){//下架操作
  429. this.OperationType = 'under'
  430. this.handlerProduct = item
  431. this.modal = true
  432. this.contentModalText = '确定下架该商品吗?'
  433. },
  434. handleAllUnder(){//批量下架操作
  435. let checkedArray = []
  436. let isValidFlag = false
  437. this.productIds = ''
  438. if(this.isProductChecked){
  439. this.dataList.forEach(el => {
  440. if(el.isChecked) {
  441. checkedArray.push(el)
  442. }
  443. })
  444. checkedArray.forEach(el =>{
  445. if(el.validFlag == 2){
  446. this.productIds += el.productId+','
  447. }
  448. if(el.validFlag != 2){
  449. isValidFlag = true
  450. }
  451. })
  452. if(isValidFlag){
  453. this.$util.modal('','部分选中的商品暂未上架,不能进行下架操作','确定','',false,() =>{})
  454. return
  455. }
  456. this.OperationType = 'allunder'
  457. this.modal = true
  458. this.contentModalText = '确定下架选中的商品吗?'
  459. }
  460. },
  461. handleClick(e) {//弹窗提示用户操作
  462. if(e.index == 1){
  463. switch(this.OperationType){
  464. case 'delete'://删除主页推荐
  465. this.SupplierDeleteSwitchFeatured(this.handlerProduct)
  466. break
  467. case 'add'://添加主页推荐
  468. this.SupplierAddSwitchFeatured(this.handlerProduct)
  469. break
  470. case 'under'://下架商品
  471. this.SupplierSoldOutProduct(this.handlerProduct)
  472. break
  473. case 'allunder'://批量下架
  474. this.SupplierAllSoldOutProduct(this.productIds)
  475. break
  476. }
  477. }
  478. this.modal = false
  479. },
  480. SupplierDeleteSwitchFeatured(item){//操作删除主页推荐
  481. this.ShopService.SupplierSwitchFeaturedyProduct({productId:item.productId,featuredFlag:0}).then(response =>{
  482. this.$util.msg('删除成功',2000,true,'success')
  483. setTimeout(() => {
  484. this.GetProductListInfo()
  485. },2000)
  486. }).catch(error =>{
  487. this.$util.msg(error.msg,2000)
  488. })
  489. },
  490. SupplierAddSwitchFeatured(item){//操作添加主页推荐
  491. this.ShopService.SupplierSwitchFeaturedyProduct({productId:item.productId,featuredFlag:1}).then(response =>{
  492. this.$util.msg('添加成功',2000,true,'success')
  493. setTimeout(() => {
  494. this.GetProductListInfo()
  495. },2000)
  496. }).catch(error =>{
  497. this.$util.msg(error.msg,2000)
  498. })
  499. },
  500. SupplierSoldOutProduct(item){//操作下架商品
  501. this.ShopService.SupplierSoldOutProduct({productIds:item.productId}).then(response =>{
  502. this.$util.msg('下架成功',2000,true,'success')
  503. setTimeout(() => {
  504. this.GetProductListInfo()
  505. },2000)
  506. }).catch(error =>{
  507. this.$util.msg(error.msg,2000)
  508. })
  509. },
  510. SupplierAllSoldOutProduct(ids){//操作批量下架商品
  511. this.ShopService.SupplierSoldOutProduct({productIds:ids}).then(response =>{
  512. this.$util.msg('下架成功',2000,true,'success')
  513. this.productIds = ''
  514. setTimeout(() => {
  515. this.GetProductListInfo()
  516. },2000)
  517. }).catch(error =>{
  518. this.$util.msg(error.msg,2000)
  519. })
  520. },
  521. bindPickerChange: function(type,e) {//选择筛选条件
  522. switch(type){
  523. case 0:
  524. this.commodityTypeText = this.statusActions[e.target.value].name
  525. this.listQuery.commodityType = this.commodityTypeActons[e.target.value].value
  526. break
  527. case 1:
  528. this.validFlagText = this.statusActions[e.target.value].name
  529. this.listQuery.validFlag = this.statusActions[e.target.value].value
  530. break
  531. case 2:
  532. this.featuredFlagText = this.recommendActions[e.target.value].name
  533. this.listQuery.featuredFlag = this.recommendActions[e.target.value].value
  534. break
  535. case 3:
  536. this.firstClassificationText = this.classificationFirstList[e.target.value].name
  537. this.listQuery.bigTypeId = this.classificationFirstList[e.target.value].value
  538. this.GetPrimarySecondaryClassification(this.listQuery.bigTypeId)
  539. this.twoClassificationText = ''
  540. this.threeClassificationText=''
  541. break
  542. case 4:
  543. if(this.listQuery.bigTypeId == 0){
  544. this.$util.msg('请先选择一级分类',2000)
  545. return
  546. }
  547. this.twoClassificationText = this.classificationTwoList[e.target.value].name
  548. this.listQuery.smallTypeId = this.classificationTwoList[e.target.value].value
  549. this.GetPrimaryThreeLevelClassification(this.listQuery.smallTypeId)
  550. break
  551. case 5:
  552. if(this.listQuery.smallTypeId == 0){
  553. this.$util.msg('请先选择二级分类',2000)
  554. return
  555. }
  556. this.threeClassificationText = this.classificationThreeList[e.target.value].name
  557. this.listQuery.tinyTypeId = this.classificationThreeList[e.target.value].value
  558. break
  559. case 6:
  560. this.newvalidFlagText = this.newFlagActions[e.target.value].name
  561. this.listQuery.newvalidFlag = this.newFlagActions[e.target.value].value
  562. break
  563. }
  564. },
  565. GetPrimaryClassification(value){//获取筛选条件一级分类
  566. this.ShopService.GetPrimaryClassification({typeSort:value}).then(response =>{
  567. const data = response.data
  568. data.forEach(item =>{
  569. let _obj = {name:item.name,value:item.bigTypeID}
  570. this.classificationFirstList.push(_obj)
  571. })
  572. }).catch(error =>{
  573. this.$util.msg(error.msg,2000)
  574. })
  575. },
  576. GetPrimarySecondaryClassification(value){//获取筛选条件二级分类
  577. this.classificationTwoList = []
  578. this.ShopService.GetPrimarySecondaryClassification({bigTypeId:value}).then(response =>{
  579. const data = response.data
  580. data.forEach(item =>{
  581. let _obj = {name:item.name,value:item.smallTypeID}
  582. this.classificationTwoList.push(_obj)
  583. })
  584. }).catch(error =>{
  585. this.$util.msg(error.msg,2000)
  586. })
  587. },
  588. GetPrimaryThreeLevelClassification(value){//获取筛选条件三级分类
  589. this.classificationThreeList = []
  590. this.ShopService.GetPrimaryThreeLevelClassification({smallTypeId:value}).then(response =>{
  591. const data = response.data
  592. data.forEach(item =>{
  593. let _obj = {name:item.name,value:item.tinyTypeID}
  594. this.classificationThreeList.push(_obj)
  595. })
  596. }).catch(error =>{
  597. this.$util.msg(error.msg,2000)
  598. })
  599. },
  600. hideMobel(){
  601. this.modal = false
  602. },
  603. updateCheckAllBtn() {//勾选单个判断全选
  604. let goodsCheckedLength = 0
  605. this.dataList.forEach(item => {
  606. if(item.isChecked) { goodsCheckedLength++ }
  607. })
  608. this.isAllChecked = goodsCheckedLength === this.dataList.length
  609. if(goodsCheckedLength>0){
  610. this.isProductChecked = true
  611. }else{
  612. this.isProductChecked = false
  613. }
  614. },
  615. updateBothCheckBtn() {//全选勾选判断
  616. this.dataList.forEach((item)=>{
  617. item.isChecked = this.isAllChecked
  618. })
  619. },
  620. isCheckedAll(){//全选
  621. this.isAllChecked = !this.isAllChecked
  622. if(this.isAllChecked){
  623. this.isProductChecked = true
  624. }else{
  625. this.isProductChecked = false
  626. }
  627. this.updateBothCheckBtn()
  628. },
  629. checkedSoperv(item){//选择
  630. item.isChecked = !item.isChecked
  631. console.log(item)
  632. this.updateCheckAllBtn()
  633. },
  634. supervClickFn(){//管理全选
  635. this.isSuperv = true
  636. },
  637. closeSupervFn(){
  638. this.isSuperv = false
  639. },
  640. searchClickFn() {//弹出抽屉
  641. this.rightDrawer = true
  642. },
  643. closeDrawer(e) {//关闭抽屉
  644. this.leftDrawer = false
  645. this.rightDrawer = false
  646. },
  647. orderPriceToFixed (n){
  648. let price =''
  649. price = Number(n).toFixed(2)
  650. return price
  651. },
  652. verifyColorFilter: function(state){
  653. let stateColor = '',
  654. stateColorObject={
  655. 0:'#FFB12A',
  656. 1:'#f9a94b',
  657. 2:'#1890f9',
  658. 3:'#627386',
  659. 8:'#FF2A2A',
  660. 9:'#f94b4b'
  661. }
  662. Object.keys(stateColorObject).forEach(function(key){
  663. if(key == state){
  664. stateColor = stateColorObject[key]
  665. }
  666. })
  667. return stateColor
  668. },
  669. },
  670. onPageScroll(e){//实时获取到滚动的值
  671. if(e.scrollTop>30){
  672. this.isCmcustomClass = 'fiexd'
  673. }else{
  674. this.isCmcustomClass = 'left'
  675. }
  676. },
  677. onReachBottom() {
  678. if(this.hasNextPage){
  679. this.loadding = true
  680. this.pullUpOn = true
  681. this.GetOnReachBottomData()
  682. }
  683. },
  684. onPullDownRefresh() {
  685. setTimeout(() => {
  686. this.listQuery.pageNum = 1
  687. uni.stopPullDownRefresh()
  688. }, 200)
  689. },
  690. onShow(){
  691. }
  692. }
  693. </script>
  694. <style lang="scss">
  695. @import "@/uni.scss";
  696. page{
  697. background:#FFF;
  698. }
  699. .empty-container{
  700. z-index: 9999;
  701. }
  702. .superv-header{
  703. width: 100%;
  704. height: 80rpx;
  705. background-color: #F7F7F7;
  706. line-height: 80rpx;
  707. position: fixed;
  708. top: 0;
  709. left: 0;
  710. box-sizing: border-box;
  711. padding: 0 24rpx;
  712. z-index: 999;
  713. &.forbid{
  714. height: 100rpx;
  715. padding: 10rpx 24rpx;
  716. background-color: #FFF3F3;
  717. line-height: 40rpx;
  718. font-size: 24rpx;
  719. color:#F94B4B ;
  720. }
  721. .superv-header-click{
  722. width: 100%;
  723. height: 80rpx;
  724. font-size: $font-size-30;
  725. .oltext{
  726. width: 120rpx;
  727. float: left;
  728. color: #666666;
  729. }
  730. .ortext{
  731. width: 120rpx;
  732. float: right;
  733. color: $color-system;
  734. text-align: right;
  735. }
  736. }
  737. .superv-header-checked{
  738. width: 100%;
  739. height: 80rpx;
  740. font-size: $font-size-30;
  741. .oltext{
  742. width: 120rpx;
  743. float: left;
  744. color: #666666;
  745. display: flex;
  746. margin-left: 10rpx;
  747. .checkbox{
  748. display: flex;
  749. margin: 0;
  750. padding: 0;
  751. display: flex;
  752. flex-direction: column;
  753. align-items: center;
  754. box-sizing: border-box;
  755. text-align: center;
  756. text-decoration: none;
  757. border-radius: 0;
  758. -webkit-tap-highlight-color: transparent;
  759. overflow: hidden;
  760. font-size: 34rpx;
  761. color:$color-system;
  762. line-height: 80rpx;
  763. }
  764. .text{
  765. float: left;
  766. line-height: 80rpx;
  767. margin-left: 15rpx;
  768. }
  769. }
  770. .ortext{
  771. width: 120rpx;
  772. float: right;
  773. color: $color-system;
  774. text-align: right;
  775. }
  776. }
  777. }
  778. .d-container {
  779. width: 560rpx;
  780. height: 100vh;
  781. box-sizing: border-box;
  782. padding: 80rpx 30rpx;
  783. .tui-popup-scroll{
  784. width: 100%;
  785. height: 100%;
  786. }
  787. .d-title{
  788. width: 100%;
  789. height:80rpx;
  790. line-height: 80rpx;
  791. text-align: center;
  792. color: #4688fa;
  793. font-size: $font-size-32;
  794. float: left;
  795. }
  796. .d-time{
  797. width: 100%;
  798. height: 70rpx;
  799. float: left;
  800. box-sizing: border-box;
  801. padding: 0 10rpx;
  802. border: 1px solid rgba(0,0,0,0.2);
  803. border-radius: 4rpx;
  804. margin-bottom: 30rpx;
  805. .iconfont{
  806. width:70rpx;
  807. height: 60rpx;
  808. display: block;
  809. float: left;
  810. font-size: 50rpx;
  811. color: #666666;
  812. line-height: 70rpx;
  813. text-align: left;
  814. }
  815. .input{
  816. width: 220rpx;
  817. height: 70rpx;
  818. line-height: 70rpx;
  819. float: left;
  820. box-sizing: border-box;
  821. font-size: $font-size-24;
  822. color: #333333;
  823. padding: 0 10rpx;
  824. }
  825. }
  826. .d-label{
  827. width: 100%;
  828. height: 44rpx;
  829. line-height: 44rpx;
  830. text-align: left;
  831. color: #666666;
  832. font-size: $font-size-26;
  833. float: left;
  834. }
  835. .d-input{
  836. width: 100%;
  837. height: 70rpx;
  838. float: left;
  839. box-sizing: border-box;
  840. padding: 0 10rpx;
  841. border: 1px solid rgba(0,0,0,0.2);
  842. border-radius: 4rpx;
  843. margin-bottom: 30rpx;
  844. position: relative;
  845. &.btn{
  846. border: none;
  847. margin-top: 40rpx;
  848. }
  849. .input{
  850. width: 100%;
  851. height: 70rpx;
  852. line-height: 70rpx;
  853. float: left;
  854. box-sizing: border-box;
  855. font-size: $font-size-24;
  856. color: #333333;
  857. padding: 0 10rpx;
  858. padding-right: 68rpx;
  859. }
  860. .iconfont{
  861. width: 50rpx;
  862. height: 68rpx;
  863. display: block;
  864. line-height: 68rpx;
  865. text-align: center;
  866. font-size: 30rpx;
  867. color: #999999;
  868. position: absolute;
  869. right: 0;
  870. top: 0;
  871. }
  872. .d-btn{
  873. width: 210rpx;
  874. height: 84rpx;
  875. border-radius: 42rpx;
  876. background: $btn-confirm;
  877. line-height: 84rpx;
  878. text-align: center;
  879. font-size: $font-size-26;
  880. color: #FFFFFF;
  881. float: right;
  882. &.comfrim{
  883. background: $btn-confirm;
  884. margin-left: 20rpx;
  885. }
  886. &.clear{
  887. background: #e1e1e1;
  888. }
  889. }
  890. }
  891. }
  892. .tui-header {
  893. width: 100%;
  894. font-size: 16px;
  895. font-weight: 500;
  896. height: 32px;
  897. display: flex;
  898. align-items: center;
  899. justify-content: center;
  900. position: relative;
  901. padding: 0 40rpx;
  902. }
  903. .header-sit{
  904. width:100%;
  905. box-sizing: border-box;
  906. height: 80rpx;
  907. line-height: 80rpx;
  908. box-sizing: border-box;
  909. padding:0 40rpx;
  910. text-align: left;
  911. font-size: $font-size-40;
  912. color: #FFFFFF;
  913. font-weight: 600;
  914. font-family: '正楷';
  915. margin-top: 30rpx;
  916. .iconfont{
  917. font-size: 42rpx;
  918. margin-left: 30rpx;
  919. }
  920. }
  921. .mine{
  922. width: 100%;
  923. height: 100%;
  924. position:relative;
  925. }
  926. .product-content{
  927. width: 100%;
  928. height: auto;
  929. position: relative;
  930. padding:0;
  931. box-sizing: border-box;
  932. .header-tabs{
  933. width: 100%;
  934. height: auto;
  935. margin-bottom: 40rpx;
  936. padding: 20rpx;
  937. border-radius: 20rpx;
  938. background:#4688fa;
  939. box-sizing: border-box;
  940. &.day{
  941. background:#FFFFFF;
  942. padding:40rpx 20rpx;
  943. box-shadow:0px 3px 6px rgba(0,0,0,0.2);
  944. }
  945. .title{
  946. font-size: $font-size-36;
  947. line-height: 60rpx;
  948. color: #FFF;
  949. font-weight: bold;
  950. margin-bottom: 20rpx;
  951. }
  952. .main{
  953. width: 100%;
  954. height: 110rpx;
  955. .main-item{
  956. float: left;
  957. width:20%;
  958. text-align: center;
  959. color: #FFFFFF;
  960. box-sizing: border-box;
  961. &.active{
  962. .iconfont{
  963. color: #576efa;
  964. }
  965. .text{
  966. font-weight: bold;
  967. color:#576efa ;
  968. font-size: $font-size-28;
  969. }
  970. }
  971. .text{
  972. width: 100%;
  973. height:60rpx;
  974. line-height: 60rpx;
  975. display: block;
  976. float: left;
  977. font-size:$font-size-24;
  978. color: #666666;
  979. text-align: center;
  980. &.nm{
  981. color: #222222;
  982. height:40rpx;
  983. line-height: 40rpx;
  984. font-size: $font-size-32;
  985. font-weight: bold;
  986. }
  987. }
  988. .iconfont{
  989. font-size:50rpx;
  990. color: #7aa5fa ;
  991. position: relative;
  992. .badg{
  993. padding: 0 10rpx;
  994. height: 30rpx;
  995. display: inline-block;
  996. font-size: $font-size-24;
  997. text-align: center;
  998. line-height: 30rpx;
  999. background-color: #ff4759;
  1000. color: #FFF;
  1001. position: absolute;
  1002. top: -15rpx;
  1003. right:20rpx;
  1004. border-radius: 15rpx;
  1005. }
  1006. }
  1007. }
  1008. }
  1009. }
  1010. .tui-header-btm {
  1011. width: 100%;
  1012. padding: 0 30rpx;
  1013. box-sizing: border-box;
  1014. display: flex;
  1015. align-items: center;
  1016. justify-content: space-between;
  1017. color: #fff;
  1018. }
  1019. .tui-btm-item {
  1020. flex: 1;
  1021. display: flex;
  1022. flex-direction: column;
  1023. align-items: center;
  1024. justify-content: center;
  1025. }
  1026. .tui-btm-num {
  1027. font-size: 32rpx;
  1028. font-weight: 600;
  1029. position: relative;
  1030. }
  1031. .tui-btm-text {
  1032. font-size: 24rpx;
  1033. opacity: 0.85;
  1034. padding-top: 4rpx;
  1035. }
  1036. }
  1037. .tui-goods-item {
  1038. display: flex;
  1039. padding: 30rpx 20rpx;
  1040. box-sizing: border-box;
  1041. border-bottom: 1px solid #EBEBEB;
  1042. position: relative;
  1043. }
  1044. .tui-goods-checkBox{
  1045. display: flex;
  1046. align-items: center;
  1047. margin: 0 15rpx;
  1048. .checkbox{
  1049. display: flex;
  1050. margin: 0;
  1051. padding: 0;
  1052. display: flex;
  1053. flex-direction: column;
  1054. align-items: center;
  1055. box-sizing: border-box;
  1056. text-align: center;
  1057. text-decoration: none;
  1058. border-radius: 0;
  1059. -webkit-tap-highlight-color: transparent;
  1060. overflow: hidden;
  1061. background-color:#FFFFFF;
  1062. font-size: 36rpx;
  1063. color:$color-system;
  1064. }
  1065. .text{
  1066. font-size: $font-size-24;
  1067. margin-left: 10rpx;
  1068. }
  1069. }
  1070. .tui-goods-image{
  1071. width: 180rpx;
  1072. height: 180rpx !important;
  1073. border-radius: 12rpx;
  1074. .tui-goods-img {
  1075. width: 180rpx;
  1076. height: 180rpx !important;
  1077. border-radius: 12rpx;
  1078. flex-shrink: 0;
  1079. display: block;
  1080. }
  1081. }
  1082. .tui-goods-info {
  1083. padding-left: 20rpx;
  1084. display: flex;
  1085. flex-direction: column;
  1086. align-items: flex-start;
  1087. justify-content: space-between;
  1088. box-sizing: border-box;
  1089. overflow: hidden;
  1090. position: relative;
  1091. }
  1092. .tui-goods-status{
  1093. width: 160rpx;
  1094. position: absolute;
  1095. right: 0;
  1096. .status-text{
  1097. font-size: $font-size-24;
  1098. line-height: 44rpx;
  1099. text-align: center;
  1100. color: #666666;
  1101. }
  1102. }
  1103. .tui-goods-title {
  1104. white-space: normal;
  1105. word-break: break-all;
  1106. overflow: hidden;
  1107. text-overflow: ellipsis;
  1108. display: -webkit-box;
  1109. -webkit-box-orient: vertical;
  1110. -webkit-line-clamp: 2;
  1111. font-size: 26rpx;
  1112. color: #333;
  1113. line-height: 44rpx;
  1114. }
  1115. .tui-goods-pip{
  1116. white-space: normal;
  1117. word-break: break-all;
  1118. overflow: hidden;
  1119. text-overflow: ellipsis;
  1120. display: -webkit-box;
  1121. -webkit-box-orient: vertical;
  1122. -webkit-line-clamp: 2;
  1123. font-size: 24rpx;
  1124. color: #999;
  1125. line-height: 44rpx;
  1126. .red{
  1127. color: #FF201F;
  1128. }
  1129. }
  1130. .tui-goods-ediet{
  1131. width: 60rpx;
  1132. height: 60rpx;
  1133. background: linear-gradient(90deg,rgba(122,165,250,1) 0%,rgba(87,110,250,1) 100%);
  1134. border-radius: 50%;
  1135. line-height: 60rpx;
  1136. text-align: center;
  1137. position: absolute;
  1138. right: 0;
  1139. top: 50%;
  1140. .icon-bianji1 {
  1141. flex-shrink: 0;
  1142. display: flex;
  1143. align-items: center;
  1144. justify-content: center;
  1145. color: #FFFFFF;
  1146. font-size: 24rpx;
  1147. }
  1148. }
  1149. .tui-goods-model {
  1150. max-width: 100%;
  1151. color: #FFFFFF;
  1152. background: #4688fa;
  1153. border-radius: 40rpx;
  1154. display: flex;
  1155. align-items: center;
  1156. justify-content: space-between;
  1157. padding: 0 20rpx;
  1158. box-sizing: border-box;
  1159. margin-top: 10rpx;
  1160. }
  1161. .tui-model-text {
  1162. max-width: 100%;
  1163. transform: scale(0.9);
  1164. transform-origin: 0 center;
  1165. font-size: 24rpx;
  1166. line-height: 40rpx;
  1167. white-space: nowrap;
  1168. overflow: hidden;
  1169. text-overflow: ellipsis;
  1170. }
  1171. .tui-price-box {
  1172. width: 100%;
  1173. display: flex;
  1174. align-items: flex-end;
  1175. justify-content: space-between;
  1176. }
  1177. .tui-goods-price {
  1178. font-size: $font-size-28;
  1179. font-weight: 500;
  1180. color: #FF201F;
  1181. }
  1182. .tui-popup-box {
  1183. position: relative;
  1184. box-sizing: border-box;
  1185. min-height: 200rpx;
  1186. padding:6rpx 24rpx;
  1187. }
  1188. .tui-popup-btn {
  1189. width: 100%;
  1190. height: auto;
  1191. float: left;
  1192. box-sizing: border-box;
  1193. padding: 0 75rpx;
  1194. margin-top: 30rpx;
  1195. .tui-button{
  1196. width: 600rpx;
  1197. height: 88rpx;
  1198. background: #e1e1e1;
  1199. line-height: 88rpx;
  1200. text-align: center;
  1201. color: #FFFFFF;
  1202. font-size: $font-size-28;
  1203. border-radius: 44rpx;
  1204. &.active{
  1205. background: $btn-confirm;
  1206. }
  1207. }
  1208. }
  1209. </style>