shelfSet.vue 24 KB

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