shelfSet.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
  1. <template>
  2. <view class="content">
  3. <u-navbar back-text="货架设置" :border-bottom="false" :background="{backgroundColor: $config('primaryColor')}"
  4. back-icon-color="#fff" :back-text-style="{ color: '#fff' }">
  5. <view slot='right' style="padding: 0 30upx;color: #ffffff;" @click="toPlRacking" v-if="shelfPlaceList">
  6. <u-icon name="piliangshangjia" custom-prefix="iscm-icon"></u-icon>
  7. <text style="margin-left: 6rpx;">批量上架</text>
  8. <u-badge v-if="showDot" :is-dot="true" size="mini" type="error"></u-badge>
  9. </view>
  10. </u-navbar>
  11. <view class="body-content flex flex_column">
  12. <view class="card-box" v-if="detailData">
  13. <view class="card-row flex align_center justify_between">
  14. <view class="label">货架名称:</view>
  15. <view class="text flex align_center justify_end" @click="editShelf">
  16. <text>{{detailData.shelfName}}</text>
  17. <u-icon name="arrow-right" color="#969da3" size="28"></u-icon>
  18. </view>
  19. </view>
  20. <view class="card-row flex align_center justify_between">
  21. <view class="label">关联客户:</view>
  22. <view class="text flex align_center justify_end" @click="customeSet">
  23. <text>{{ (detailData&&detailData.customerEntity&&detailData.customerEntity.customerName) || '--' }}</text>
  24. <u-icon name="arrow-right" color="#969da3" size="28"></u-icon>
  25. </view>
  26. </view>
  27. <view class="card-row align_center flex justify_between">
  28. <view class="label" @click="showTip(0)">价格权限设置 <u-icon color="#ffaa00"
  29. name="question-circle"></u-icon>:</view>
  30. <view class="text flex align_center justify_end" @click="openSetPriceShow" v-if="$hasPermissions('B_shelfSet_mobile_priceSetting')">
  31. <view style="flex-grow: 1;">
  32. <view>货架产品:<text style="width: 80%;flex: 1;">{{showPriceStr.length ? showPriceStr.join("/") : '--'}}</text></view>
  33. <view>非货架产品:<text style="width: 80%;flex: 1;">{{showNonPriceStr.length ? showNonPriceStr.join("/") : '--'}}</text></view>
  34. </view>
  35. <u-icon name="arrow-right" color="#969da3" size="28"></u-icon>
  36. </view>
  37. <view class="text flex align_center justify_end" v-else>
  38. <view style="flex-grow: 1;">
  39. <view>货架产品:<text style="width: 80%;flex: 1;">{{showPriceStr.length ? showPriceStr.join("/") : '--'}}</text></view>
  40. <view>非货架产品:<text style="width: 80%;flex: 1;">{{showNonPriceStr.length ? showNonPriceStr.join("/") : '--'}}</text></view>
  41. </view>
  42. <u-icon name="arrow-right" color="#969da3" size="28"></u-icon>
  43. </view>
  44. </view>
  45. <view class="card-row align_center flex justify_between" v-if="showMore">
  46. <view class="label">货架状态:</view>
  47. <view v-if="$hasPermissions('B_shelfSet_mobile_enable')" class="text flex align_center justify_end" @click="showEnableShelf=true">
  48. <text v-if="detailData">{{detailData.state == 'ENABLE'?'启用':'停用'}}</text>
  49. <u-icon name="arrow-right" color="#969da3" size="28"></u-icon>
  50. </view>
  51. <view v-else>{{detailData?detailData.state == 'ENABLE'?'启用':'停用':'--'}}</view>
  52. </view>
  53. <view class="card-row align_center flex justify_between" v-if="showMore&&$hasPermissions('B_shelfSet_mobile_logout')">
  54. <view class="label">货架注销:</view>
  55. <view class="text">
  56. <u-button type="primary" size="mini" @click="showCancelShelf=true">注销</u-button>
  57. </view>
  58. </view>
  59. <!-- <view class="card-row align_center flex justify_between" v-if="showMore">
  60. <view class="label" @click="showTip(1)">是否设置完成<u-icon color="#ffaa00"
  61. name="question-circle"></u-icon>: </view>
  62. <view class="text"><u-switch :size="40" v-model="switchVal"
  63. @change="switchChange"></u-switch></view>
  64. </view> -->
  65. <view class="moreSeting" @click="showMore=!showMore">
  66. <text>{{!showMore?'更多设置':'收起'}}</text> <u-icon :name="showMore?'arrow-up':'arrow-down'"></u-icon>
  67. </view>
  68. </view>
  69. <!-- 货位信息 -->
  70. <view class="shelfPlace" :style="{height: scrollH+'px'}" v-if="shelfPlaceList">
  71. <view class="flex align_center shelfPlaceHead">
  72. <view class="lt"><text>□</text>表示没有绑定产品</view>
  73. <view class="search-btn flex align_center" @click="toSearchHw">
  74. <view><u-icon name="search"></u-icon><text>按产品搜索</text></view>
  75. <u-icon name="scan"></u-icon>
  76. </view>
  77. </view>
  78. <view class="flex shelfTabs">
  79. <view class="leftTabs">
  80. <view v-for="item in placeTab" :key="item" :class="curTab==item?'active':''"
  81. @click="tabChange(item)">{{item}}层</view>
  82. </view>
  83. <view class="rightCons flex flex_column">
  84. <view class="hwList flex_1">
  85. <text @click="editHw(item)" v-for="item in shelfPlaceList[curTab]"
  86. :key="item.shelfPlaceCode"
  87. :class="item.shelfProductApiEntity && item.shelfProductApiEntity.productSn?'':'red'">
  88. {{item.shelfPlaceCode}}
  89. </text>
  90. <text class="add" @click="addHw('add',1)"><u-icon name="plus"></u-icon></text>
  91. </view>
  92. <view class="hwAction flex justify_between">
  93. <u-button shape="circle" @click="tapPopup(1)" size="medium">打印贴签</u-button>
  94. <u-button class="newbtn" @click="tapPopup(2)" type='primary' shape="circle"
  95. size="medium">快速补货</u-button>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. <view style="width: 100%;" v-else>
  101. <view class="nodata" v-if="!loading">
  102. <view>
  103. <u-image :src="`../../static/${$config('themePath')}/def_no_data@3x.png`" width="180"
  104. height="180" border-radius="10"></u-image>
  105. </view>
  106. <view>暂无货位信息,请点击</view>
  107. <view class="flex">
  108. <view>
  109. <text @click="toPlRacking">批量上架</text>
  110. <u-badge :offset="[-6,-10]" v-if="showDot" :is-dot="true" size="mini"
  111. type="error"></u-badge>
  112. </view>
  113. <view>
  114. <text></text>或
  115. <text @click="toImportTpl">导入模板</text>
  116. </view>
  117. </view>
  118. </view>
  119. <view class="nodata" v-else>
  120. <u-loadmore :load-text="$config('loadText')" status="loading" />
  121. </view>
  122. </view>
  123. </view>
  124. <!-- 设置价格显示弹框 -->
  125. <u-modal v-model="updateShowPrice" :show-cancel-button="true" title="价格权限设置" @confirm="savePriceSet">
  126. <view class="slot-content" style="padding: 1rem 1rem 1.5rem;text-align: center;">
  127. <view style="color: #999;font-size: 0.8rem;margin: 0.5rem;">提示:不勾选则不显示价格</view>
  128. <view style="text-align: left;font-size: 0.9rem;padding-left: 1rem;">货架产品:</view>
  129. <u-checkbox-group @change="priceSetChange">
  130. <u-checkbox v-for="item in showPrice" :key="item.paramCode" v-model="item.checked"
  131. :name="item.paramCode">{{item.text}}</u-checkbox>
  132. </u-checkbox-group>
  133. <view style="text-align: left;font-size: 0.9rem;padding-left: 1rem;margin-top: 0.5rem;">非货架产品:</view>
  134. <u-checkbox-group @change="nonPriceSetChange">
  135. <u-checkbox v-for="item in showNonPrice" :key="item.paramCode" v-model="item.checked"
  136. :name="item.paramCode">{{item.text}}</u-checkbox>
  137. </u-checkbox-group>
  138. </view>
  139. </u-modal>
  140. <!-- 启用禁用货架 -->
  141. <u-modal v-model="showEnableShelf" :show-cancel-button="true" title="货架状态" @confirm="enbaleShelf">
  142. <view class="slot-content" style="padding: 1rem 1rem 1.5rem;text-align: center;">
  143. <u-radio-group v-model="shelfStatus">
  144. <u-radio name="ENABLE">启用</u-radio>
  145. <u-radio name="DISABLED">停用</u-radio>
  146. </u-radio-group>
  147. </view>
  148. </u-modal>
  149. <!-- 注销货架 -->
  150. <u-popup v-model="showCancelShelf" mode="center" border-radius="14" length="80%">
  151. <view style="padding: 1rem;text-align: center;font-size: 1rem;">是否注销该数字货架?</view>
  152. <view class="slot-content" style="padding: 0 1rem 1rem;text-align: center;">
  153. 点击确定,该数字货架就不可做任何操作,用户不可登陆。
  154. </view>
  155. <view class="flex align_center justify_between" style="text-align: center;font-size: 1rem;">
  156. <view @click="cancelShelf" style="border: 1px solid #eee;border-right:0;border-bottom:0;width: 50%;padding: 0.6rem 0;color: dodgerblue;">确定</view>
  157. <view @click="showCancelShelf=false" style="border: 1px solid #eee;border-bottom:0;width: 50%;padding: 0.6rem 0;">取消</view>
  158. </view>
  159. </u-popup>
  160. <!-- 导入模板 -->
  161. <u-popup v-model="showImportTpl" mode="center" border-radius="14" length="80%">
  162. <view style="padding: 1rem;text-align: center;font-size: 1rem;">请选择货架模板</view>
  163. <scroll-view
  164. scroll-y
  165. class="slot-content"
  166. style="padding: 0 1rem 1rem;text-align: center;height: 30vh;">
  167. <u-radio-group v-model="templateSn" :wrap="true">
  168. <u-radio
  169. v-for="(item, index) in templateList" :key="item.id"
  170. :name="item.templateSn"
  171. >
  172. {{item.templateName}}
  173. </u-radio>
  174. </u-radio-group>
  175. </scroll-view>
  176. <view class="flex align_center justify_between" style="text-align: center;font-size: 1rem;">
  177. <view @click="toImportTplOk" style="border: 1px solid #eee;border-right:0;border-bottom:0;width: 50%;padding: 0.6rem 0;color: dodgerblue;">确定</view>
  178. <view @click="toImportTpCancel" style="border: 1px solid #eee;border-bottom:0;width: 50%;padding: 0.6rem 0;">取消</view>
  179. </view>
  180. </u-popup>
  181. </view>
  182. </template>
  183. <script>
  184. import {
  185. shelfDetail,
  186. shelfSave,
  187. modifFinishFlag,
  188. getProductPlace,
  189. getShelfPriceShow,
  190. updateShelfPriceShow,
  191. shelfModifState,
  192. shelfTemplateList,
  193. importShelfTemplate
  194. } from '@/api/shelf'
  195. import {
  196. shelfCartNotEmpty
  197. } from '@/api/shelfCart'
  198. import {
  199. createShelfReplenishBill
  200. } from '@/api/shelfReplenish'
  201. export default {
  202. components: {},
  203. data() {
  204. return {
  205. loading: false,
  206. shelfSn: null,
  207. detailData: null,
  208. switchVal: false,
  209. showMenus: false,
  210. scrollH: 400,
  211. showImportTpl: false,
  212. templateSn: null,
  213. templateList: [],
  214. popData: [{
  215. title: '快速补货',
  216. val: '0'
  217. }, {
  218. title: '打印贴签',
  219. val: '1'
  220. }],
  221. pleft: 0,
  222. ptop: 0,
  223. shelfPlaceList: null,
  224. placeTab: [],
  225. curTab: '',
  226. isLoad: false,
  227. webView: null,
  228. showDot: false,
  229. showPrice: [],
  230. showNonPrice:[],
  231. showPriceStr: [],
  232. showNonPriceStr:[],
  233. updateShowPrice: false,
  234. showPriceBak: [],
  235. showMore: false,
  236. showEnableShelf: false,
  237. shelfStatus: undefined,
  238. showCancelShelf: false
  239. }
  240. },
  241. watch: {
  242. showMore(a, b) {
  243. this.getScrollHeight(a)
  244. },
  245. },
  246. onLoad(option) {
  247. this.shelfSn = option.shelfSn
  248. // 获取货架详情
  249. this.getShelfDetal()
  250. // 获取货物
  251. this.getShelfPlace()
  252. this.isLoad = true
  253. // this.webView = this.$mp.page.$getAppWebview();
  254. uni.$on("editCustome", (data) => {
  255. this.isLoad = true
  256. this.saveShelf(data, 0)
  257. })
  258. uni.$on("editShelfName", (data) => {
  259. this.isLoad = true
  260. this.saveShelf(data, 1)
  261. })
  262. // const win = uni.getWindowInfo()
  263. // this.pleft = Math.floor(win.windowWidth * 0.3)
  264. // this.ptop = Math.floor(win.windowHeight - 70)
  265. this.getScrollHeight(this.showMore)
  266. console.log(this.shelfSn)
  267. },
  268. onUnload() {
  269. uni.$off("editCustome")
  270. uni.$off("editShelfName")
  271. },
  272. onShow() {
  273. if (!this.isLoad) {
  274. this.updateHw()
  275. }
  276. },
  277. methods: {
  278. getScrollHeight(a) {
  279. const sys = uni.getSystemInfoSync()
  280. const h = a ? 290 : 250
  281. if (sys.platform == 'android') {
  282. this.scrollH = sys.windowHeight - h
  283. } else {
  284. if (sys.safeArea.top) {
  285. this.scrollH = sys.windowHeight - h + sys.statusBarHeight - 34
  286. } else {
  287. this.scrollH = sys.windowHeight - h - 14
  288. }
  289. }
  290. },
  291. // 刷新货位
  292. updateHw() {
  293. this.placeTab = []
  294. this.shelfPlaceList = null
  295. this.getShelfPlace(true)
  296. },
  297. // 导入模板弹框
  298. toImportTpl(){
  299. if(this.templateList.length == 0){
  300. uni.showLoading({
  301. mask: true,
  302. title: '加载中...'
  303. })
  304. shelfTemplateList({pageNo:1,pageSize:100}).then(res=>{
  305. this.templateList = res.data&&res.data.list||[]
  306. if(this.templateList.length){
  307. this.showImportTpl = true
  308. uni.hideLoading()
  309. }else{
  310. this.toashMsg(res.message)
  311. }
  312. })
  313. }else{
  314. this.showImportTpl = true
  315. }
  316. },
  317. // 导入模板弹框确定
  318. toImportTplOk(){
  319. if(this.templateSn){
  320. uni.showLoading({
  321. mask: true,
  322. title: '导入模板弹...'
  323. })
  324. importShelfTemplate({ shelfSn: this.shelfSn, templateSn: this.templateSn }).then(res => {
  325. if (res.status == 200) {
  326. this.toashMsg(res.message)
  327. this.toImportTpCancel()
  328. this.getShelfDetal()
  329. this.updateHw()
  330. }
  331. uni.hideLoading()
  332. })
  333. }else{
  334. this.toashMsg('请选择模板')
  335. }
  336. },
  337. // 关闭模板导入
  338. toImportTpCancel(){
  339. this.showImportTpl = false
  340. this.templateSn = null
  341. },
  342. // 批量上架
  343. toPlRacking() {
  344. const url = this.showDot ? '/pages/batchShelves/cartList' : '/pages/batchShelves/index'
  345. uni.navigateTo({
  346. url: url + "?shelfSn=" + this.shelfSn + '&shelfName=' + this.detailData.shelfName +
  347. '&customerSn=' + this.detailData.customerSn
  348. })
  349. },
  350. // 更多操作
  351. tapPopup(e) {
  352. // 打印贴签
  353. if (e == 1) {
  354. if (this.hasNoBindPro()) {
  355. uni.navigateTo({
  356. url: "/pages/latePlay/chooseProduct?shelfSn=" + this.shelfSn + '&shelfName=' + this
  357. .detailData.shelfName
  358. })
  359. } else {
  360. uni.showModal({
  361. showCancel: false,
  362. confirmText: "好的",
  363. title: "提示",
  364. content: "所有货位都没有绑定产品,无法打印贴签!"
  365. })
  366. }
  367. }
  368. // 快速补货
  369. if (e == 2) {
  370. createShelfReplenishBill({
  371. shelfSn: this.shelfSn,
  372. enableFlag: 1
  373. }).then(res => {
  374. console.log(res.data)
  375. if (res.data && res.data.length) {
  376. const params = Object.assign(this.detailData, {
  377. list: res.data
  378. })
  379. this.$store.state.vuex_tempData = params
  380. uni.navigateTo({
  381. url: "/pages/shelfSetting/quickReplenish"
  382. })
  383. } else {
  384. uni.showModal({
  385. showCancel: false,
  386. confirmText: "好的",
  387. title: "提示",
  388. content: "没有需要补货的产品"
  389. })
  390. }
  391. })
  392. }
  393. },
  394. showTip(type) {
  395. uni.showModal({
  396. showCancel: false,
  397. confirmText: "好的",
  398. title: "提示",
  399. content: type ? "只有当数字货架的“是否设置完成”为“是”,系统才会自动对该货架生成补货单,修理厂才能正常下单。" :
  400. "不勾选则不显示价格,结算价:即易码通进货价"
  401. })
  402. },
  403. // 注销货架
  404. cancelShelf(){
  405. const params = {
  406. shelfSn: this.shelfSn,
  407. state: 'WRITE_OFF'
  408. }
  409. shelfModifState(params).then(res => {
  410. if(res.status == 200){
  411. this.toashMsg(res.message)
  412. this.showCancelShelf = false
  413. if(res.status == 200){
  414. uni.navigateBack()
  415. }
  416. }
  417. })
  418. },
  419. // 启用禁用货架
  420. enbaleShelf(){
  421. const params = {
  422. shelfSn: this.shelfSn,
  423. state: this.shelfStatus
  424. }
  425. shelfModifState(params).then(res => {
  426. this.toashMsg(res.message)
  427. this.showEnableShelf = false
  428. if(res.status == 200){
  429. this.getShelfDetal()
  430. }
  431. })
  432. },
  433. // 设置完成是否
  434. switchChange(v) {
  435. const params = {
  436. shelfSn: this.shelfSn,
  437. finishFlag: v ? '1' : '0'
  438. }
  439. modifFinishFlag(params).then(res => {
  440. if (res.status == 200) {
  441. uni.showToast({
  442. icon: 'none',
  443. title: res.message
  444. })
  445. }
  446. })
  447. },
  448. // 关联客户
  449. customeSet() {
  450. uni.navigateTo({
  451. url: "/pages/sales/chooseCustomer?backPage=shelfEdit&shelfName=" + this.detailData.shelfName
  452. })
  453. },
  454. // 修改货架名称
  455. editShelf() {
  456. uni.navigateTo({
  457. url: "/pages/shelfSetting/editShelf?shelfName=" + this.detailData.shelfName
  458. })
  459. },
  460. // 是否没有绑定任何产品
  461. hasNoBindPro() {
  462. let noBindPro = null;
  463. for (let i = 0; i < this.placeTab.length; i++) {
  464. noBindPro = this.shelfPlaceList[this.placeTab[i]].find(item => item.shelfProductApiEntity && item
  465. .shelfProductApiEntity.productSn);
  466. if (!!noBindPro) {
  467. break
  468. }
  469. }
  470. return !!noBindPro
  471. },
  472. // 按照产品搜索货位
  473. toSearchHw() {
  474. if (this.hasNoBindPro()) {
  475. uni.navigateTo({
  476. url: "/pages/shelfSetting/searchShelfHw?shelfName=" + this.detailData.shelfName +
  477. "&shelfSn=" + this.shelfSn
  478. })
  479. } else {
  480. uni.showModal({
  481. showCancel: false,
  482. confirmText: "好的",
  483. title: "提示",
  484. content: "所有货位都没有绑定产品,无法搜索!"
  485. })
  486. }
  487. },
  488. // 编辑货位
  489. editHw(item) {
  490. const hasProduct = item.shelfProductApiEntity && item.shelfProductApiEntity.productSn
  491. const type = hasProduct ? 'edit' : 'bind'
  492. const params = Object.assign(this.detailData, item)
  493. this.$store.state.vuex_tempData = params
  494. uni.navigateTo({
  495. url: "/pages/shelfSetting/editShelfHw?type=" + type
  496. })
  497. },
  498. // 新增货位
  499. addHw(type, flag) {
  500. let shelfPlaceCode = ''
  501. if (type == 'edit') {
  502. shelfPlaceCode = flag
  503. }
  504. if (type == 'add' && flag == 1) {
  505. const row = this.shelfPlaceList[this.curTab]
  506. const num = row[row.length - 1].shelfPlaceCode.replace(this.curTab, '')
  507. const nextNum = Number(num) + 1
  508. shelfPlaceCode = this.curTab + (nextNum < 10 ? '0' : '') + nextNum
  509. }
  510. const params = {
  511. customerSn: this.detailData.customerSn,
  512. shelfSn: this.detailData.shelfSn,
  513. id: this.detailData.id
  514. }
  515. uni.navigateTo({
  516. url: "/pages/shelfSetting/addShelfHw?detailData=" + encodeURIComponent(JSON.stringify(
  517. params)) + "&type=" + type + "&shelfPlaceCode=" + shelfPlaceCode
  518. })
  519. },
  520. // 保存数字货架基本信息
  521. saveShelf(data, type) {
  522. const params = {
  523. shelfSn: this.shelfSn
  524. }
  525. if (type == 1) {
  526. params.customerSn = this.detailData.customerSn
  527. params.shelfName = data.shelfName
  528. } else {
  529. params.customerSn = data.customerSn
  530. }
  531. shelfSave(params).then(res => {
  532. if (res.status == 200) {
  533. this.toashMsg(res.message)
  534. this.getShelfDetal()
  535. }
  536. })
  537. },
  538. // 获取价格显示设置
  539. getShelfPriceShow() {
  540. getShelfPriceShow({
  541. shelfSn: this.shelfSn
  542. }).then(res => {
  543. if (res.status == 200) {
  544. const ret = res.data && res.data
  545. this.showPriceBak = ret
  546. console.log(ret)
  547. this.formatPriceShow()
  548. }
  549. })
  550. },
  551. // 格式化价格显示
  552. checkPrice(item){
  553. if(item.paramCode.indexOf("non_")>=0){
  554. this.showNonPrice.push({
  555. paramCode: item.paramCode,
  556. paramValue: item.paramValue,
  557. text: item.paramCode == 'non_shelf_price_show' ? '车主价' : '结算价',
  558. checked: item.paramValue == 1
  559. })
  560. }else{
  561. this.showPrice.push({
  562. paramCode: item.paramCode,
  563. paramValue: item.paramValue,
  564. text: item.paramCode == 'shelf_price_show' ? '车主价' : '结算价',
  565. checked: item.paramValue == 1
  566. })
  567. }
  568. },
  569. formatPriceShow(){
  570. this.showPrice = []
  571. this.showPriceStr = []
  572. this.showNonPrice = []
  573. this.showNonPriceStr = []
  574. const a = this.showPriceBak.filter(item => item.paramCode.indexOf('shelf_price_show')>=0)
  575. const b = this.showPriceBak.filter(item => item.paramCode.indexOf('shelf_cost_show')>=0)
  576. a.map(item => {
  577. if (item.paramCode == 'shelf_price_show' && item.paramValue == 1) {
  578. this.showPriceStr.push("车主价")
  579. }
  580. if (item.paramCode == 'non_shelf_price_show' && item.paramValue == 1) {
  581. this.showNonPriceStr.push("车主价")
  582. }
  583. this.checkPrice(item)
  584. })
  585. b.map(item => {
  586. if (item.paramCode == 'shelf_cost_show' && item.paramValue == 1) {
  587. this.showPriceStr.push("结算价")
  588. }
  589. if (item.paramCode == 'non_shelf_cost_show' && item.paramValue == 1) {
  590. this.showNonPriceStr.push("结算价")
  591. }
  592. this.checkPrice(item)
  593. })
  594. },
  595. openSetPriceShow(){
  596. this.formatPriceShow()
  597. this.updateShowPrice = true
  598. },
  599. // 选择价格显示
  600. priceSetChange(e) {
  601. console.log(e)
  602. this.showPrice.map(item => {
  603. item.paramValue = e.includes(item.paramCode) ? 1 : 0
  604. })
  605. },
  606. nonPriceSetChange(e){
  607. this.showNonPrice.map(item => {
  608. item.paramValue = e.includes(item.paramCode) ? 1 : 0
  609. })
  610. },
  611. // 价格显示保存
  612. savePriceSet() {
  613. uni.showLoading({
  614. mask: true,
  615. title: '正在保存价格设置...'
  616. })
  617. // 更新价格显示
  618. updateShelfPriceShow({
  619. shelfSn: this.shelfSn,
  620. paramValue: [...this.showPrice,...this.showNonPrice]
  621. }).then(res => {
  622. if (res.status == 200) {
  623. this.getShelfPriceShow()
  624. this.toashMsg(res.message)
  625. }
  626. uni.hideLoading()
  627. })
  628. },
  629. getShelfDetal() {
  630. shelfDetail({
  631. sn: this.shelfSn
  632. }).then(res => {
  633. if (res.status == 200) {
  634. this.detailData = res.data
  635. this.switchVal = res.data.finishFlag == 1
  636. this.shelfStatus = res.data.state
  637. // 价格设置
  638. this.getShelfPriceShow()
  639. } else {
  640. this.detailData = null
  641. }
  642. })
  643. },
  644. getShelfPlace(flag) {
  645. this.loading = true
  646. getProductPlace({
  647. shelfSn: this.shelfSn
  648. }).then(res => {
  649. if (res.status == 200 && res.data) {
  650. this.shelfPlaceList = res.data
  651. // 获取层
  652. for (let a in res.data) {
  653. this.placeTab.push(a)
  654. }
  655. // 排序
  656. this.placeTab.sort(function(a, b) {
  657. return (a + '').localeCompare(b + '');
  658. });
  659. console.log(this.placeTab)
  660. if (!flag || !this.curTab) {
  661. this.curTab = this.placeTab[0]
  662. }
  663. if (this.placeTab.length == 0) {
  664. this.shelfPlaceList = null
  665. }
  666. } else {
  667. this.shelfPlaceList = null
  668. this.placeTab = []
  669. }
  670. // 是否有已录入的产品
  671. this.getHasCartNotEmpty()
  672. this.isLoad = false
  673. this.loading = false
  674. })
  675. },
  676. tabChange(item) {
  677. this.curTab = item
  678. },
  679. getHasCartNotEmpty() {
  680. shelfCartNotEmpty({
  681. shelfSn: this.shelfSn
  682. }).then(res => {
  683. this.showDot = res.data == 1
  684. })
  685. }
  686. }
  687. }
  688. </script>
  689. <style lang="less">
  690. .content {
  691. width: 100%;
  692. .nodata {
  693. padding: 100rpx 50rpx;
  694. text-align: center;
  695. display: flex;
  696. flex-direction: column;
  697. justify-content: center;
  698. align-items: center;
  699. >view {
  700. position: relative;
  701. padding: 10upx 0;
  702. text {
  703. color: #00aaff;
  704. margin-left: 10rpx;
  705. }
  706. }
  707. }
  708. .body-content {
  709. width: 100%;
  710. }
  711. .card-box {
  712. background-color: #fff;
  713. border-radius: 0.5rem;
  714. box-shadow: 0.1rem 0.2rem 0.3rem #eee;
  715. padding: 0 1rem;
  716. margin: 0.5rem;
  717. .card-row {
  718. border-bottom: 1rpx solid #eee;
  719. padding: 10rpx 0;
  720. min-height: 80rpx;
  721. &:last-child {
  722. border-bottom: 0;
  723. }
  724. .label{
  725. min-width: 30%;
  726. }
  727. .text {
  728. color: #666;
  729. flex-grow: 1;
  730. text-align: right;
  731. }
  732. }
  733. .moreSeting {
  734. text-align: center;
  735. color: #999;
  736. padding: 20upx;
  737. >text {
  738. margin-right: 10rpx;
  739. }
  740. }
  741. }
  742. .shelfPlace {
  743. height: calc(100% - 300rpx);
  744. .shelfPlaceHead {
  745. padding: 0.2rem 0.5rem 0.5rem;
  746. justify-content: space-between;
  747. .lt {
  748. font-size: 0.9rem;
  749. color: #999;
  750. text {
  751. color: #ff5500;
  752. font-size: 1rem;
  753. }
  754. }
  755. .search-btn {
  756. border: 1rpx solid #eee;
  757. border-radius: 50rpx;
  758. width: 50%;
  759. justify-content: space-between;
  760. padding: 0.3rem 0.5rem;
  761. color: #999;
  762. background-color: #fff;
  763. font-size: 0.9rem;
  764. &:active {
  765. opacity: 0.6;
  766. }
  767. }
  768. }
  769. .shelfTabs {
  770. height: calc(100% - 85rpx);
  771. .leftTabs {
  772. width: 20%;
  773. overflow: auto;
  774. >view {
  775. padding: 0.8rem 0.5rem;
  776. border-left: 0.2rem solid #f8f8f8;
  777. text-align: center;
  778. }
  779. .active {
  780. border-color: rgb(47, 126, 209);
  781. background-color: #fff;
  782. }
  783. }
  784. .rightCons {
  785. width: 80%;
  786. background-color: #fff;
  787. position: relative;
  788. .hwList {
  789. overflow: auto;
  790. padding: 0.5rem;
  791. padding-bottom: 105rpx;
  792. >text {
  793. border: 1rpx solid #eee;
  794. padding: 0.2rem 0.8rem;
  795. border-radius: 0.3rem;
  796. margin: 0.5rem 2%;
  797. float: left;
  798. width: 20%;
  799. text-align: center;
  800. }
  801. .red {
  802. border-color: #ff5500;
  803. }
  804. .add {
  805. border-style: dashed;
  806. border-color: #999;
  807. color: #999;
  808. }
  809. }
  810. .hwAction {
  811. padding: 0.5rem;
  812. position: fixed;
  813. bottom: 0;
  814. right: 0;
  815. width: 80%;
  816. background-color: #fff;
  817. button {
  818. width: 240rpx;
  819. }
  820. .newbtn {
  821. background-color: rgb(51, 95, 182);
  822. color: #fff;
  823. }
  824. }
  825. }
  826. }
  827. }
  828. }
  829. </style>