shelfSet.vue 24 KB

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