index.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230
  1. <template>
  2. <view class="goods-list">
  3. <!-- #ifdef MP || APP-PLUS -->
  4. <NavBar titleText="商品管理" bagColor="#F5F5F5" :iconColor="iconColor" :textColor="iconColor"
  5. :isScrolling="isScrolling" showBack></NavBar>
  6. <!-- #endif -->
  7. <view class="searchCon acea-row row-between-wrapper">
  8. <view class="search acea-row row-middle">
  9. <text class="iconfont icon-ic_search"></text>
  10. <input class="inputs" placeholder='请输入商品名称/关键字' placeholder-class='placeholder' confirm-type='search'
  11. name="search" v-model="keyword" @confirm="searchSubmit"></input>
  12. </view>
  13. <view class="edit acea-row row-center-wrapper" @click="filtrate">
  14. <text class="iconfont icon-a-icon_filter1x"></text>
  15. </view>
  16. <view @click="manageTap" v-if="administer">取消</view>
  17. <view class="edit acea-row row-center-wrapper" @click="manageTap" v-else>
  18. <text class="iconfont icon-ic_batch"></text>
  19. </view>
  20. </view>
  21. <!-- #ifdef H5 -->
  22. <view class="nav acea-row row-middle">
  23. <!-- #endif -->
  24. <!-- #ifndef H5 -->
  25. <view class="nav acea-row row-middle" :style="{
  26. top:getHeight.barTop+getHeight.barHeight+'px'
  27. }">
  28. <!-- #endif -->
  29. <scroll-view scroll-x="true" class="scroll_view">
  30. <view class="item" :class="current == index?'on':''" v-for="(item, index) in navList" :key="index"
  31. @click="navTap(item,index)">
  32. {{item.name}}({{tabsArr?tabsArr[index].count:0}})
  33. <image src="../static/adorn.png" v-if="current == index"></image>
  34. </view>
  35. </scroll-view>
  36. </view>
  37. <view class="list" v-if="goodsList.length">
  38. <checkbox-group @change="checkboxChange">
  39. <view class="acea-row row-middle" v-for="(item, index) in goodsList" :key="index">
  40. <!-- #ifndef MP -->
  41. <checkbox class="checkbox" v-if="administer" :value="(item.id).toString()"
  42. :checked="item.checked" />
  43. <!-- #endif -->
  44. <!-- #ifdef MP -->
  45. <checkbox class="checkbox" v-if="administer" :value="item.id" :checked="item.checked" />
  46. <!-- #endif -->
  47. <view class="item">
  48. <view class="item_header">
  49. <view class="item_header-type"><text class="iconfont icon-color"
  50. :class="goods_type_icon[item.type]"></text>{{goods_type[item.type]}}
  51. </view>
  52. <view class="item_header_right">{{item.isShow?'已上架':'未上架'}}</view>
  53. </view>
  54. <view class="top acea-row row-center-wrapper" @tap="priceNum(item.id,item.type)">
  55. <view class="pictrue">
  56. <image :src="item.image"></image>
  57. </view>
  58. <view class="text">
  59. <view class="name line1">{{item.name}}</view>
  60. <view class="info">
  61. <text>销量: {{item.sales}}</text>
  62. <!-- <text>库存: {{item.stock}}</text> -->
  63. </view>
  64. <view class="acea-row svip-box">
  65. <baseMoney :money="item.price" symbolSize="20" integerSize="32" decimalSize="20"
  66. color="#333333"></baseMoney>
  67. <view class="svip-price-box acea-row" v-if="item.isPaidMember">
  68. <view class="svip">
  69. SVIP
  70. </view>
  71. <view class="svip-price semiBold">
  72. {{item.vipPrice}}
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="bottom acea-row row-right" v-if="!administer&&type==1">
  79. <view class="bnt acea-row row-center-wrapper" :class="item.isShow?'':'up'"
  80. @click="setUpDown(item.isShow,item.id)">{{item.isShow?'下架':'上架'}}</view>
  81. <!-- <view class="bnt on acea-row row-center-wrapper" v-if="item.type!=6"
  82. @click="addNum(item.id)">增加库存</view> -->
  83. <view class="bnt on acea-row row-center-wrapper" v-if="item.type!=6"
  84. @click="priceNum(item.id)">价格库存</view>
  85. </view>
  86. <view class="bottom acea-row row-right" v-if="!administer&&(type==2||type==3||type==4)">
  87. <!-- <view class="bnt acea-row row-center-wrapper" @click="editClass(item.id)">修改分类</view> -->
  88. <view class="bnt acea-row row-center-wrapper" v-if="item.type!=6"
  89. @click="priceNum(item.id)">价格库存</view>
  90. <!-- <view class="bnt acea-row row-center-wrapper" v-if="item.type!=6&&item.isShow"
  91. @click="addNum(item.id)">增加库存</view> -->
  92. <view class="bnt on acea-row row-center-wrapper"
  93. @click="setUpDown(item.isShow,item.id)">{{item.isShow?'下架':'上架'}}</view>
  94. </view>
  95. <view class="bottom acea-row row-right" v-if="!administer&&type==8">
  96. <view class="bnt acea-row row-center-wrapper" @click="hsToggle('center',item.id)">加入回收站
  97. </view>
  98. <view class="bnt acea-row row-center-wrapper" v-if="item.type!=6"
  99. @click="priceNum(item.id)">价格库存</view>
  100. <view class="bnt on acea-row row-center-wrapper" @click="shToggle(item.id)">提交审核</view>
  101. </view>
  102. <view class="bottom acea-row row-right" v-if="!administer&&(type==6||type==7)">
  103. <view class="bnt acea-row row-center-wrapper" @click="hsToggle('center',item.id)">加入回收站
  104. </view>
  105. </view>
  106. <view class="bottom acea-row row-right" v-if="!administer&&type==5">
  107. <view class="bnt acea-row row-center-wrapper" @click="toDelete(item.id)">删除</view>
  108. <view class="bnt on acea-row row-center-wrapper" @click="toRestore(item.id)">恢复商品</view>
  109. </view>
  110. </view>
  111. </view>
  112. </checkbox-group>
  113. </view>
  114. <view class="empty-box" v-if="goodsList.length == 0 && !loading">
  115. <emptyPage title="暂无商品~" :imgSrc="urlDomain+'crmebimage/presets/noShopper.png'"></emptyPage>
  116. </view>
  117. <Loading :loaded="loadend" :loading="loading"></Loading>
  118. <view class="footerH"></view>
  119. <view class="footer acea-row row-between-wrapper" v-if="administer">
  120. <checkbox-group @change="checkboxAllChange">
  121. <checkbox value="all" :checked="isAllSelect" />
  122. <text class='checkAll'>全选({{getIds().length}})</text>
  123. </checkbox-group>
  124. <view class="acea-row row-middle" v-if="type == 1">
  125. <view class="bnt acea-row row-center-wrapper" @click="setShow('',1,0)">批量下架</view>
  126. </view>
  127. <view class="acea-row row-middle" v-if="type == 2">
  128. <view class="bnt acea-row row-center-wrapper" @click="toRecycleAll('',1,1)">加入回收站</view>
  129. <view class="bnt acea-row row-center-wrapper" @click="setShow('',1,1)">批量上架</view>
  130. </view>
  131. <view class="acea-row row-middle" v-if="(type == 3||type == 4)">
  132. <view class="bnt acea-row row-center-wrapper" @click="setShow('',1,0)">批量下架</view>
  133. <view class="bnt acea-row row-center-wrapper" @click="setShow('',1,1)">批量上架</view>
  134. </view>
  135. <view class="acea-row row-middle" v-if="type == 8">
  136. <view class="bnt acea-row row-center-wrapper" @click="toRecycleAll('',1,1)">加入回收站</view>
  137. <view class="bnt acea-row row-center-wrapper" @click="shToggleAll">批量提审</view>
  138. </view>
  139. <view class="acea-row row-middle" v-if="type == 6||type ==7">
  140. <view class="bnt acea-row row-center-wrapper" @click="toRecycleAll('',1,1)">加入回收站</view>
  141. </view>
  142. <view class="acea-row row-middle" v-if="type == 5">
  143. <view class="bnt acea-row row-center-wrapper" @click="toDeleteAll">批量删除</view>
  144. <view class="bnt acea-row row-center-wrapper" @click="toRestoreAll('',1,1)">恢复商品</view>
  145. </view>
  146. </view>
  147. <footer-page></footer-page>
  148. <base-drawer mode="bottom" :visible="visible" background-color="transparent" mask maskClosable
  149. @close="closeDrawer">
  150. <view class="edit-list rd-t-40rpx">
  151. <view class="item" v-for="(item, index) in editList" :key="index" @tap="editInfo(index)">
  152. {{item.name}}
  153. </view>
  154. </view>
  155. </base-drawer>
  156. <edit-price :visible='visiblePrice' :goodsInfo='goodsInfo' @closeDrawer='priceCloseDrawer'
  157. @successChange='successChange'></edit-price>
  158. <edit-lable ref="lable" :visible='visibleLable' @closeDrawer='lableCloseDrawer'
  159. @successChange='successChange'></edit-lable>
  160. <!-- 提交审核 -->
  161. <uni-popup ref="sh_popup" background-color="#fff" borderRadius="10px">
  162. <view class="sh_popup-content"
  163. :class="{ 'popup-height': popup_center === 'left' || popup_center === 'right' }">
  164. <view class="sh_popup_title">
  165. 提交审核
  166. </view>
  167. <view class="sh_popup_text">
  168. 你确定要将选中商品提交审核吗?
  169. </view>
  170. <view class="sh_popup_btn">
  171. <view class="no_btn btn" @click="shPopupClose">取消</view>
  172. <view class="yes_btn btn" @click="toAudit">确认</view>
  173. </view>
  174. </view>
  175. </uni-popup>
  176. <!-- 回收站 -->
  177. <uni-popup ref="hs_popup" background-color="#fff" borderRadius="10px">
  178. <view class="sh_popup-content"
  179. :class="{ 'popup-height': popup_center === 'left' || popup_center === 'right' }">
  180. <view class="sh_popup_title">
  181. 加入回收站
  182. </view>
  183. <view class="sh_popup_text">
  184. 你确定要将选中商品加入回收站吗?
  185. </view>
  186. <view class="sh_popup_btn">
  187. <view class="no_btn btn" @click="hsPopupClose">取消</view>
  188. <view class="yes_btn btn" @click="toRecycle">确认</view>
  189. </view>
  190. </view>
  191. </uni-popup>
  192. <!-- 恢复商品 -->
  193. <uni-popup ref="hf_popup" background-color="#fff" borderRadius="10px">
  194. <view class="sh_popup-content"
  195. :class="{ 'popup-height': popup_center === 'left' || popup_center === 'right' }">
  196. <view class="sh_popup_title">
  197. 恢复商品
  198. </view>
  199. <view class="sh_popup_text">
  200. 你确定要将选中商品恢复吗?
  201. </view>
  202. <view class="sh_popup_btn">
  203. <view class="no_btn btn" @click="hfPopupClose">取消</view>
  204. <view class="yes_btn btn" @click="toRestoreBtn">确认</view>
  205. </view>
  206. </view>
  207. </uni-popup>
  208. <!-- 删除商品 -->
  209. <uni-popup ref="sc_popup" background-color="#fff" borderRadius="10px">
  210. <view class="sh_popup-content"
  211. :class="{ 'popup-height': popup_center === 'left' || popup_center === 'right' }">
  212. <view class="sh_popup_title">
  213. 删除商品
  214. </view>
  215. <view class="sh_popup_text">
  216. 你确定要将选中商品删除吗?
  217. </view>
  218. <view class="sh_popup_btn">
  219. <view class="no_btn btn" @click="scPopupClose">取消</view>
  220. <view class="yes_btn btn" @click="toDeleteBtn">确认</view>
  221. </view>
  222. </view>
  223. </uni-popup>
  224. </view>
  225. </template>
  226. <script>
  227. import Loading from '../components/Loading/index';
  228. import emptyPage from '@/components/emptyPage.vue';
  229. import footerPage from '../components/footerPage/index.vue';
  230. import editPrice from './components/editPrice/index.vue';
  231. import editLable from './components/label/index.vue';
  232. import baseDrawer from '@/components/tui-drawer/tui-drawer.vue';
  233. import NavBar from '../components/NavBar.vue'
  234. import baseMoney from '../components/BaseMoney.vue'
  235. import {
  236. employeeProductList,
  237. employeeProductUp,
  238. employeeProductDown,
  239. employeeBatchUp,
  240. employeeBatchDown,
  241. employeeBatchRecycle,
  242. employeeBatchRestore,
  243. employeeRestore,
  244. employeeProductDelete,
  245. employeeBatchDelete,
  246. employeeSubmitAudit,
  247. employeeBatchAudit,
  248. productTabsHeaders,
  249. productCategroyGetTree
  250. } from '@/api/work.js';
  251. export default {
  252. components: {
  253. editPrice,
  254. editLable,
  255. footerPage,
  256. emptyPage,
  257. Loading,
  258. baseDrawer,
  259. NavBar,
  260. baseMoney
  261. },
  262. data() {
  263. return {
  264. urlDomain: this.$Cache.get("imgHost"),
  265. goods_type: ['普通商品', '积分商品', '虚拟商品', '','视频号', '云盘商品', '卡密商品'],
  266. goods_type_icon:['icon-ic_daifahuo','','icon-ic_xuni','','','icon-a-icon_cloud1x','icon-ic_daifukuan'],
  267. getHeight: this.$util.getWXStatusHeight(),
  268. navList: [{
  269. name: '出售中',
  270. type: 1
  271. },
  272. {
  273. name: '仓库中',
  274. type: 2
  275. },
  276. {
  277. name: '已售罄',
  278. type: 3
  279. },
  280. {
  281. name: '库存警告',
  282. type: 4
  283. },
  284. {
  285. name: '待提审',
  286. type: 8
  287. },
  288. {
  289. name: '审核中',
  290. type: 6
  291. },
  292. {
  293. name: '审核未通过',
  294. type: 7
  295. },
  296. {
  297. name: '回收站',
  298. type: 5
  299. }
  300. ],
  301. editList: [{
  302. name: '修改价格/库存'
  303. },
  304. {
  305. name: '商品分类'
  306. },
  307. {
  308. name: '商品标签'
  309. },
  310. ],
  311. current: 0,
  312. administer: 0,
  313. isAllSelect: false,
  314. goodsList: [],
  315. goodsInfo: {},
  316. visible: false,
  317. visiblePrice: false, //价格库存是否显示
  318. visibleLable: false, //标签是否显示
  319. loadTitle: '加载更多',
  320. loading: false,
  321. loadend: false,
  322. limit: 10,
  323. page: 1,
  324. keyword: '', //搜索字段
  325. type: 1, //商品状态
  326. visibleClass: false,
  327. iconColor: '#333333',
  328. isScrolling: false,
  329. popup_center: 'center',
  330. cateId: '', //商户商品分类ID
  331. categoryId: '', //平台商品分类ID
  332. productType: '', //商品类型:0=普通商品, 5-云盘商品,6-卡密商品
  333. recycleId: '',
  334. toRecycleType: '',
  335. restoreId: '',
  336. toRestoreType: '',
  337. deleteId: '',
  338. toDeleteType: '',
  339. auditId: '',
  340. toAuditType: '',
  341. tabsArr: '',
  342. loadShow:false
  343. }
  344. },
  345. onShow() {
  346. !this.loadShow&&this.init()
  347. this.loadShow=false
  348. },
  349. onLoad(option) {
  350. if(option.type){
  351. this.loadShow=true
  352. this.type = option.type?option.type:1;
  353. for (let i = 0; i < this.navList.length; i++) {
  354. if (this.navList[i].type == this.type) {
  355. this.current = i;
  356. break;
  357. }
  358. }
  359. this.init();
  360. }
  361. },
  362. methods: {
  363. tabsHeader() {
  364. productTabsHeaders({
  365. keywords: this.keyword,
  366. type: this.type,
  367. cateId: this.cateId,
  368. categoryId: this.categoryId,
  369. productType: this.productType
  370. }).then(res => {
  371. let arr = res.data
  372. let oldVal = arr[4].count
  373. let newVal = arr[7].count
  374. arr[4].count = newVal
  375. arr[7].count = oldVal
  376. this.tabsArr = arr
  377. })
  378. },
  379. scPopupClose() {
  380. this.$refs.sc_popup.close()
  381. },
  382. hfPopupClose() {
  383. this.$refs.hf_popup.close()
  384. },
  385. hsPopupClose() {
  386. this.$refs.hs_popup.close()
  387. },
  388. hsToggle(type, id) {
  389. this.popup_center = type
  390. // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
  391. this.$refs.hs_popup.open(type)
  392. this.recycleId = id
  393. this.toRecycleType = 0
  394. },
  395. shPopupClose() {
  396. this.$refs.sh_popup.close()
  397. },
  398. shToggle(id) {
  399. this.$refs.sh_popup.open('center')
  400. this.auditId = id
  401. this.toAuditType = 0
  402. },
  403. //筛选
  404. filtrate() {
  405. this.visibleLable = true
  406. this.visible = false
  407. },
  408. //增加库存
  409. addNum(id) {
  410. uni.navigateTo({
  411. url: `/pages/admin/goods/inventory?id=${id}`
  412. })
  413. },
  414. //价格库存
  415. priceNum(id,type) {
  416. if(type==6){
  417. return this.$util.Tips({
  418. title: '卡密商品无法查看'
  419. });
  420. }
  421. uni.navigateTo({
  422. url: `/pages/admin/goods/specs?id=${id}`
  423. })
  424. },
  425. editClass(id) {
  426. this.$refs.classify.category([id], '');
  427. let that = this;
  428. setTimeout(function() {
  429. that.visibleClass = true
  430. }, 200)
  431. },
  432. classCloseDrawer() {
  433. this.visibleClass = false
  434. },
  435. successChange(select) {
  436. this.visibleClass = false
  437. this.visibleLable = false
  438. this.visiblePrice = false
  439. this.cateId = select.cateId
  440. this.productType = select.productType
  441. this.init();
  442. },
  443. //批量获取id集合
  444. getIds() {
  445. let ids = []
  446. this.goodsList.forEach(item => {
  447. if (item.checked) {
  448. ids.push(item.id)
  449. }
  450. })
  451. ids.slice(0, 100)
  452. return ids
  453. },
  454. setShow(item, num, type) {
  455. let data = {}
  456. if (num) {
  457. if (!this.getIds().length) {
  458. this.$util.Tips({
  459. title: '请选择商品'
  460. });
  461. return
  462. }
  463. data = {
  464. id: this.getIds(),
  465. is_show: type
  466. }
  467. } else {
  468. data = {
  469. id: item.id,
  470. is_show: item.is_show ? 0 : 1
  471. }
  472. }
  473. if (data.is_show == 0) {
  474. employeeBatchDown({
  475. idList: data.id
  476. }).then(res => {
  477. if (res.code == 200) {
  478. this.$util.Tips({
  479. title: '下架成功'
  480. })
  481. this.init()
  482. }
  483. })
  484. } else {
  485. employeeBatchUp({
  486. idList: data.id
  487. }).then(res => {
  488. if (res.code == 200) {
  489. this.$util.Tips({
  490. title: '上架成功'
  491. })
  492. this.init()
  493. }
  494. })
  495. }
  496. },
  497. //确认提审按钮
  498. toAudit() {
  499. if (this.toAuditType == 0) {
  500. employeeSubmitAudit(this.auditId).then(res => {
  501. if (res.code == 200) {
  502. this.$refs.sh_popup.close()
  503. this.init()
  504. }
  505. })
  506. } else {
  507. let data = {}
  508. data = {
  509. id: this.getIds(),
  510. }
  511. employeeBatchAudit({
  512. idList: data.id
  513. }).then(res => {
  514. if (res.code == 200) {
  515. this.$refs.sh_popup.close()
  516. this.init()
  517. }
  518. })
  519. }
  520. },
  521. //确认删除按钮
  522. toDeleteBtn() {
  523. if (this.toDeleteType == 0) {
  524. employeeProductDelete({
  525. id: this.deleteId,
  526. type: 'delete'
  527. }).then(res => {
  528. if (res.code == 200) {
  529. this.$refs.sc_popup.close()
  530. this.init()
  531. }
  532. })
  533. } else {
  534. let data = {}
  535. data = {
  536. id: this.getIds(),
  537. }
  538. employeeBatchDelete({
  539. idList: data.id
  540. }).then(res => {
  541. if (res.code == 200) {
  542. this.$refs.sc_popup.close()
  543. this.init()
  544. }
  545. })
  546. }
  547. },
  548. //确认恢复商品
  549. toRestoreBtn() {
  550. if (this.toRestoreType == 0) {
  551. employeeRestore(this.restoreId).then(res => {
  552. if (res.code == 200) {
  553. this.$refs.hf_popup.close()
  554. this.init()
  555. }
  556. })
  557. } else {
  558. let data = {}
  559. data = {
  560. id: this.getIds(),
  561. }
  562. employeeBatchRestore({
  563. idList: data.id
  564. }).then(res => {
  565. if (res.code == 200) {
  566. this.$refs.hf_popup.close()
  567. this.init()
  568. }
  569. })
  570. }
  571. },
  572. //确认加入回收站
  573. toRecycle() {
  574. if (this.toRecycleType == 0) {
  575. employeeProductDelete({
  576. id: this.recycleId,
  577. type: 'recycle'
  578. }).then(res => {
  579. this.$refs.hs_popup.close()
  580. this.init()
  581. })
  582. } else {
  583. let data = {}
  584. data = {
  585. id: this.getIds(),
  586. }
  587. employeeBatchRecycle({
  588. idList: data.id
  589. }).then(res => {
  590. if (res.code == 200) {
  591. this.$refs.hs_popup.close()
  592. this.init()
  593. }
  594. })
  595. }
  596. },
  597. //批量加入回收站
  598. toRecycleAll(item, num, type) {
  599. if (!this.getIds().length) {
  600. this.$util.Tips({
  601. title: '请选择商品'
  602. });
  603. return
  604. } else {
  605. this.toRecycleType = 1
  606. this.$refs.hs_popup.open(type)
  607. }
  608. },
  609. //恢复商品
  610. toRestore(id) {
  611. this.toRestoreType = 0
  612. this.restoreId = id
  613. this.$refs.hf_popup.open('center')
  614. },
  615. //批量恢复商品
  616. toRestoreAll(item, num, type) {
  617. if (!this.getIds().length) {
  618. this.$util.Tips({
  619. title: '请选择商品'
  620. });
  621. return
  622. }
  623. this.toRestoreType = 1
  624. this.$refs.hf_popup.open('center')
  625. },
  626. //删除商品
  627. toDelete(id) {
  628. this.toDeleteType = 0
  629. this.deleteId = id
  630. this.$refs.sc_popup.open('center')
  631. },
  632. //批量删除
  633. toDeleteAll() {
  634. if (!this.getIds().length) {
  635. this.$util.Tips({
  636. title: '请选择商品'
  637. });
  638. return
  639. }
  640. this.toDeleteType = 1
  641. this.$refs.sc_popup.open('center')
  642. },
  643. //批量提审
  644. shToggleAll() {
  645. if (!this.getIds().length) {
  646. this.$util.Tips({
  647. title: '请选择商品'
  648. });
  649. return
  650. }
  651. this.toAuditType = 1
  652. this.$refs.sh_popup.open('center')
  653. },
  654. //上下架 0-未上架 1-上架
  655. setUpDown(show, id) {
  656. if (show == 0) {
  657. employeeProductUp(id).then(res => {
  658. if (res.code == 200) {
  659. this.$util.Tips({
  660. title: '上架成功'
  661. })
  662. this.init()
  663. }
  664. })
  665. } else {
  666. employeeProductDown(id).then(res => {
  667. if (res.code == 200) {
  668. this.$util.Tips({
  669. title: '下架成功'
  670. })
  671. this.init()
  672. }
  673. })
  674. }
  675. },
  676. init() {
  677. this.goodsList = [];
  678. this.page = 1;
  679. this.loadend = false;
  680. this.loading = false;
  681. this.productList();
  682. this.tabsHeader()
  683. },
  684. searchSubmit() {
  685. this.init();
  686. },
  687. productList() {
  688. let that = this;
  689. if (this.loading) return;
  690. if (this.loadend) return;
  691. that.loading = true;
  692. that.loadTitle = "";
  693. employeeProductList({
  694. page: that.page,
  695. limit: that.limit,
  696. keywords: that.keyword,
  697. type: that.type,
  698. cateId: that.cateId,
  699. categoryId: that.categoryId,
  700. productType: that.productType
  701. }).then(res => {
  702. let goodsList = res.data.list;
  703. goodsList.forEach(item => {
  704. item.checked = false;
  705. })
  706. this.isAllSelect = false
  707. let loadend = goodsList.length < that.limit;
  708. that.goodsList = that.$util.SplitArray(goodsList, that.goodsList);
  709. that.$set(that, 'goodsList', that.goodsList);
  710. that.loadend = loadend;
  711. that.loadTitle = loadend ? '没有更多内容啦~' : '加载更多';
  712. that.page = that.page + 1;
  713. that.loading = false;
  714. }).catch(err => {
  715. that.loading = false;
  716. that.loadTitle = "加载更多";
  717. that.$util.Tips({
  718. title: err
  719. })
  720. })
  721. },
  722. editInfo(index) {
  723. switch (index) {
  724. case 0:
  725. this.visible = false
  726. if (this.goodsInfo.spec_type) {
  727. uni.navigateTo({
  728. url: '/pages/admin/goods/specs?id=' + this.goodsInfo.id
  729. })
  730. } else {
  731. this.visiblePrice = true
  732. }
  733. break;
  734. case 1:
  735. this.visible = false
  736. this.visibleClass = true
  737. break;
  738. case 2:
  739. this.visibleLable = true
  740. this.visible = false
  741. break;
  742. }
  743. },
  744. lableCloseDrawer() {
  745. this.visibleLable = false
  746. },
  747. priceCloseDrawer() {
  748. this.visiblePrice = false
  749. },
  750. openDrawer(item) {
  751. this.visible = true
  752. this.goodsInfo = JSON.parse(JSON.stringify(item))
  753. this.$refs.lable.productLabel(this.goodsInfo, 0, []);
  754. this.$refs.classify.category(item.id, item.cate_id);
  755. },
  756. closeDrawer() {
  757. this.visible = false
  758. },
  759. manageTap() {
  760. this.administer = !this.administer;
  761. },
  762. navTap(item, index) {
  763. this.current = index;
  764. if (this.type != item.type) {
  765. this.type = item.type;
  766. this.init();
  767. }
  768. },
  769. checkboxChange(event) {
  770. let idList = event.detail.value;
  771. this.goodsList.forEach((item) => {
  772. if (idList.indexOf(item.id + '') !== -1) {
  773. item.checked = true;
  774. } else {
  775. item.checked = false;
  776. }
  777. })
  778. if (idList.length == this.goodsList.length) {
  779. this.isAllSelect = true;
  780. } else {
  781. this.isAllSelect = false;
  782. }
  783. },
  784. forGoods(val) {
  785. let that = this;
  786. if (!that.goodsList.length) return
  787. that.goodsList.forEach((item) => {
  788. if (val) {
  789. item.checked = true;
  790. } else {
  791. item.checked = false;
  792. }
  793. })
  794. },
  795. checkboxAllChange(event) {
  796. let value = event.detail.value;
  797. if (value.length) {
  798. if (this.goodsList.length > 100) {
  799. this.$util.Tips({
  800. title: '每次最多只提交100条数据'
  801. });
  802. }
  803. this.isAllSelect = true;
  804. this.forGoods(1)
  805. } else {
  806. this.isAllSelect = false;
  807. this.forGoods(0)
  808. }
  809. },
  810. },
  811. onReachBottom() {
  812. this.productList();
  813. }
  814. }
  815. </script>
  816. <style lang="scss" scoped>
  817. /deep/checkbox .uni-checkbox-input.uni-checkbox-input-checked {
  818. border-color: #2A7EFB !important;
  819. background-color: #2A7EFB !important;
  820. color: #fff !important;
  821. }
  822. /deep/checkbox .wx-checkbox-input.wx-checkbox-input-checked {
  823. border: 1px solid #2A7EFB !important;
  824. background-color: #2A7EFB !important;
  825. color: #fff !important;
  826. }
  827. /deep/uni-checkbox .uni-checkbox-input {
  828. margin-top: -4rpx;
  829. }
  830. /deep/checkbox:not([disabled]) .uni-checkbox-input:hover {
  831. border-color: #d1d1d1 !important;
  832. }
  833. .empty-box {
  834. padding: 0 20rpx;
  835. }
  836. .accountTitle {
  837. background: #F5F5F5;
  838. position: fixed;
  839. left: 0;
  840. top: 0;
  841. width: 100%;
  842. z-index: 99;
  843. padding-bottom: 6rpx;
  844. .sysTitle {
  845. width: 100%;
  846. position: relative;
  847. font-weight: 500;
  848. color: #333333;
  849. font-size: 30rpx;
  850. .iconfont {
  851. position: absolute;
  852. font-size: 42rpx;
  853. left: 20rpx;
  854. width: 60rpx;
  855. font-weight: 500;
  856. }
  857. }
  858. }
  859. .goods-list {
  860. padding-top: 20rpx;
  861. .searchCon {
  862. padding: 0 20rpx;
  863. .search {
  864. width: 550rpx;
  865. height: 72rpx;
  866. background: #FFFFFF;
  867. border-radius: 50rpx;
  868. padding: 0 34rpx;
  869. .iconfont {
  870. color: #999;
  871. font-size: 32rpx;
  872. margin-right: 16rpx;
  873. }
  874. .inputs {
  875. font-size: 28rpx;
  876. width: 100%;
  877. height: 100%;
  878. flex: 1;
  879. }
  880. .placeholder {
  881. color: #ccc;
  882. }
  883. }
  884. .edit {
  885. width: 72rpx;
  886. height: 72rpx;
  887. background: #FFFFFF;
  888. border-radius: 50%;
  889. .iconfont {
  890. color: #666;
  891. font-size: 36rpx;
  892. }
  893. }
  894. }
  895. .nav {
  896. padding: 20rpx 20rpx 18rpx 34rpx;
  897. position: sticky !important;
  898. top: 0;
  899. left: 0;
  900. width: 100%;
  901. background-color: #F5F5F5;
  902. z-index: 99;
  903. .item {
  904. font-weight: 400;
  905. font-size: 26rpx;
  906. color: #333333;
  907. padding: 10rpx 0;
  908. position: relative;
  909. &~.item {
  910. margin-left: 72rpx;
  911. }
  912. &.on {
  913. font-weight: 500;
  914. color: #2A7EFB;
  915. font-size: 30rpx;
  916. font-family: PingFang SC, PingFang SC;
  917. }
  918. image {
  919. width: 14rpx;
  920. height: 14rpx;
  921. display: block;
  922. position: absolute;
  923. bottom: 0;
  924. right: -4rpx;
  925. }
  926. }
  927. }
  928. .list {
  929. padding-bottom: 20rpx;
  930. padding: 0 20rpx 20rpx 20rpx;
  931. /deep/uni-checkbox .uni-checkbox-input {
  932. background-color: #f5f5f5;
  933. margin: 0 20rpx 20rpx 0;
  934. }
  935. /deep/wx-checkbox .wx-checkbox-input {
  936. background-color: #f5f5f5;
  937. margin: 0 20rpx 20rpx 0;
  938. }
  939. .item {
  940. width: 100%;
  941. background-color: #fff;
  942. padding: 24rpx;
  943. box-sizing: border-box;
  944. margin-bottom: 20rpx;
  945. border-radius: 24rpx;
  946. flex: 1;
  947. overflow: hidden;
  948. .item_header {
  949. display: flex;
  950. justify-content: space-between;
  951. padding-bottom: 20rpx;
  952. align-items: center;
  953. .item_header_right {
  954. font-weight: 400;
  955. font-size: 13px;
  956. color: #FF7E00;
  957. }
  958. }
  959. .top {
  960. .checkbox {
  961. margin-right: 10rpx;
  962. }
  963. .pictrue {
  964. width: 136rpx;
  965. height: 136rpx;
  966. margin-right: 20rpx;
  967. image {
  968. width: 100%;
  969. height: 100%;
  970. border-radius: 16rpx;
  971. }
  972. }
  973. .text {
  974. flex: 1;
  975. overflow: hidden;
  976. .name {
  977. font-size: 28rpx;
  978. font-weight: 400;
  979. color: #333333;
  980. }
  981. .info {
  982. font-size: 24rpx;
  983. font-weight: 400;
  984. color: #666666;
  985. margin: 10rpx 0 18rpx 0;
  986. text {
  987. margin-right: 40rpx;
  988. }
  989. }
  990. }
  991. }
  992. .bottom {
  993. margin-top: 26rpx;
  994. .bnt {
  995. width: 144rpx;
  996. height: 56rpx;
  997. border: 1px solid #ccc;
  998. font-size: 24rpx;
  999. font-family: PingFang SC, PingFang SC;
  1000. font-weight: 400;
  1001. color: #333333;
  1002. border-radius: 50rpx;
  1003. &~.bnt {
  1004. margin-left: 16rpx;
  1005. }
  1006. &.on {
  1007. border-color: #2A7EFB;
  1008. background-color: #2A7EFB;
  1009. color: #fff;
  1010. }
  1011. &.up {
  1012. border-color: #FF7E00;
  1013. color: #FF7E00;
  1014. }
  1015. }
  1016. }
  1017. }
  1018. }
  1019. .footerH {
  1020. height: 110rpx;
  1021. height: calc(110rpx + constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  1022. height: calc(110rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  1023. }
  1024. .footer {
  1025. box-sizing: border-box;
  1026. padding: 0 32rpx;
  1027. width: 100%;
  1028. height: 96rpx;
  1029. background-color: #fff;
  1030. position: fixed;
  1031. bottom: 0;
  1032. z-index: 30;
  1033. height: calc(96rpx + constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  1034. height: calc(96rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  1035. padding-bottom: constant(safe-area-inset-bottom); ///兼容 IOS<11.2/
  1036. padding-bottom: env(safe-area-inset-bottom); ///兼容 IOS>11.2/
  1037. width: 100%;
  1038. left: 0;
  1039. .bnt {
  1040. width: 160rpx;
  1041. height: 64rpx;
  1042. border-radius: 50rpx;
  1043. border: 1rpx solid #2A7EFB;
  1044. color: #2A7EFB;
  1045. font-size: 24rpx;
  1046. font-family: PingFang SC, PingFang SC;
  1047. font-weight: 500;
  1048. &~.bnt {
  1049. margin-left: 16rpx;
  1050. }
  1051. }
  1052. }
  1053. .edit-list {
  1054. background-color: #fff;
  1055. padding: 45rpx 34rpx;
  1056. .item {
  1057. font-family: PingFang SC, PingFang SC;
  1058. font-weight: 400;
  1059. color: #333333;
  1060. font-size: 32rpx;
  1061. text-align: center;
  1062. height: 106rpx;
  1063. line-height: 106rpx;
  1064. }
  1065. }
  1066. }
  1067. .scroll_view {
  1068. white-space: nowrap;
  1069. // padding: 0 30rpx;
  1070. .item {
  1071. display: inline-block;
  1072. color: #999999;
  1073. }
  1074. }
  1075. /deep/ .uni-popup__wrapper {
  1076. width: 600rpx;
  1077. height: 310rpx;
  1078. background: #FFFFFF;
  1079. border-radius: 14rpx;
  1080. }
  1081. .sh_popup-content {
  1082. .sh_popup_title {
  1083. font-weight: 500;
  1084. font-size: 32rpx;
  1085. color: #333333;
  1086. text-align: center;
  1087. margin-top: 40rpx;
  1088. }
  1089. .sh_popup_text {
  1090. font-weight: 400;
  1091. font-size: 30rpx;
  1092. color: #666666;
  1093. text-align: center;
  1094. margin-top: 30rpx;
  1095. }
  1096. .sh_popup_btn {
  1097. display: flex;
  1098. justify-content: space-between;
  1099. margin-top: 40rpx;
  1100. padding: 0 47rpx;
  1101. .btn {
  1102. width: 244rpx;
  1103. height: 72rpx;
  1104. border-radius: 50rpx;
  1105. text-align: center;
  1106. line-height: 72rpx;
  1107. }
  1108. .no_btn {
  1109. border: 1px solid #2A7EFB;
  1110. color: #2A7EFB;
  1111. }
  1112. .yes_btn {
  1113. background: #2A7EFB;
  1114. color: #FFFFFF;
  1115. }
  1116. }
  1117. }
  1118. .svip {
  1119. width: 60rpx;
  1120. height: 26rpx;
  1121. background: linear-gradient(90deg, #484643 0%, #1F1B17 100%);
  1122. font-size: 18rpx;
  1123. color: #FDDAA4;
  1124. text-align: center;
  1125. line-height: 26rpx;
  1126. margin-left: 10rpx;
  1127. border-radius: 20rpx 0 20rpx 0 / 20rpx 0 20rpx 0;
  1128. z-index: 3;
  1129. }
  1130. .svip-box {
  1131. align-items: center;
  1132. }
  1133. .svip-price-box {
  1134. position: relative;
  1135. }
  1136. .svip-price {
  1137. font-size: 22rpx;
  1138. color: #333333;
  1139. padding: 0 20rpx;
  1140. height: 26rpx;
  1141. background: #FFF0D1;
  1142. border-radius: 44rpx;
  1143. line-height: 26rpx;
  1144. text-align: center;
  1145. position: absolute;
  1146. left: 57rpx;
  1147. }
  1148. .base-money {
  1149. font-weight: 600;
  1150. }
  1151. .icon-color {
  1152. color: #2A7EFB;
  1153. margin-right: 8rpx;
  1154. }
  1155. .icon-a-icon_filter1x {
  1156. font-size: 40rpx !important;
  1157. }
  1158. /* #ifndef H5 */
  1159. .checkbox {
  1160. margin-right: 20rpx;
  1161. }
  1162. /* #endif */
  1163. .item_header-type{
  1164. align-items: center;
  1165. display: flex;
  1166. }
  1167. </style>