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