shelfSet.vue 24 KB

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