shelfSet.vue 24 KB

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