shelfSet.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <view class="content">
  3. <view class="card-box" v-if="detailData">
  4. <view class="card-row flex justify_between">
  5. <view class="label">货架名称</view>
  6. <view class="text flex align_center" @click="editShelf">
  7. <text style="width: 80%;flex: 1;">{{detailData.shelfName}}</text>
  8. <u-icon name="arrow-right" color="#969da3" size="28"></u-icon>
  9. </view>
  10. </view>
  11. <view class="card-row flex justify_between">
  12. <view class="label">关联客户</view>
  13. <view class="text flex align_center" @click="customeSet">
  14. <text style="width: 80%;flex: 1;">{{ (detailData&&detailData.customerEntity&&detailData.customerEntity.customerName) || '--' }}</text>
  15. <u-icon name="arrow-right" color="#969da3" size="28"></u-icon>
  16. </view>
  17. </view>
  18. <view class="card-row align_center flex justify_between">
  19. <view class="label" style="width: 50%;" @click="showTip">是否设置完成 <u-icon color="#2979ff" name="question-circle"></u-icon></view>
  20. <view class="text" style="width: 50%;text-align: right;"><u-switch v-model="switchVal" @change="switchChange"></u-switch></view>
  21. </view>
  22. </view>
  23. <!-- 货位信息 -->
  24. <view class="shelfPlace">
  25. <view class="flex align_center shelfPlaceHead">
  26. <view class="lt"><text>□</text>表示没有绑定产品</view>
  27. <view class="search-btn flex align_center" @click="toSearchHw">
  28. <view><u-icon name="search"></u-icon><text>按产品搜索</text></view>
  29. <u-icon name="scan"></u-icon>
  30. </view>
  31. </view>
  32. <view class="flex shelfTabs">
  33. <view class="leftTabs">
  34. <view class="active">A层</view>
  35. <view>B层</view>
  36. <view>C层</view>
  37. <view>D层</view>
  38. <view>E层</view>
  39. <view>B层</view>
  40. <view>C层</view>
  41. <view>D层</view>
  42. <view>E层</view>
  43. <view>B层</view>
  44. <view>C层</view>
  45. <view>D层</view>
  46. <view>E层</view>
  47. <view>B层</view>
  48. <view>C层</view>
  49. <view>D层</view>
  50. <view>E层</view>
  51. <view>B层</view>
  52. <view>C层</view>
  53. <view>D层</view>
  54. <view>E层</view>
  55. </view>
  56. <view class="rightCons flex flex_column">
  57. <view class="hwList flex_1">
  58. <text>A01</text>
  59. <text>A01</text>
  60. <text>A01</text>
  61. <text class="red">A01</text>
  62. <text>A01</text>
  63. <text>A01</text>
  64. <text class="add" @click="addHw"><u-icon name="plus"></u-icon></text>
  65. </view>
  66. <view class="hwAction flex justify_between">
  67. <u-button shape="circle" @click="showMenus=true" size="medium">更多功能</u-button>
  68. <u-button class="newbtn" @click="addHw" type='primary' shape="circle" size="medium">新增货位</u-button>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <chunLeiPopups v-model="showMenus" theme="dark" :popData="popData" @tapPopup="tapPopup" :x="pleft" :y="ptop" placement="bottom-start"></chunLeiPopups>
  74. </view>
  75. </template>
  76. <script>
  77. import chunLeiPopups from "@/components/chunLei-popups/chunLei-popups.vue";
  78. import { shelfDetail, shelfSave, modifFinishFlag } from '@/api/shelf'
  79. export default {
  80. components:{chunLeiPopups},
  81. data() {
  82. return {
  83. shelfSn: null,
  84. detailData: null,
  85. switchVal: false,
  86. showMenus:false,
  87. popData:[{title:'快速补货',val:'0'},{title:'打印贴签',val:'1'}],
  88. pleft:0,
  89. ptop:0
  90. }
  91. },
  92. onLoad(option) {
  93. this.shelfSn = option.shelfSn
  94. this.getShelfDetal()
  95. uni.$on("editCustome",(data)=>{
  96. this.saveShelf(data,0)
  97. })
  98. uni.$on("editShelfName",(data)=>{
  99. this.saveShelf(data,1)
  100. })
  101. const win = uni.getWindowInfo()
  102. this.pleft = Math.floor(win.windowWidth * 0.3)
  103. this.ptop = Math.floor(win.windowHeight - 70)
  104. },
  105. onUnload() {
  106. uni.$off("editCustome")
  107. uni.$off("editShelfName")
  108. },
  109. methods: {
  110. // 更多操作
  111. tapPopup(e){
  112. console.log(e)
  113. },
  114. showTip(){
  115. uni.showModal({
  116. showCancel:false,
  117. confirmText:"好的",
  118. title: "提示",
  119. content: "只有当数字货架的“是否设置完成”为“是”,系统才会自动对该货架生成补货单,修理厂才能正常下单。"
  120. })
  121. },
  122. // 设置完成是否
  123. switchChange(v){
  124. const params = {
  125. shelfSn: this.shelfSn,
  126. finishFlag: v ? '1' : '0'
  127. }
  128. modifFinishFlag(params).then(res => {
  129. if (res.status == 200) {
  130. uni.showToast({
  131. icon: 'none',
  132. title: res.message
  133. })
  134. }
  135. })
  136. },
  137. // 关联客户
  138. customeSet(){
  139. uni.navigateTo({
  140. url: "/pages/sales/chooseCustomer?backPage=shelfEdit&shelfName="+this.detailData.shelfName
  141. })
  142. },
  143. // 修改货架名称
  144. editShelf(){
  145. uni.navigateTo({
  146. url: "/pages/shelfSetting/editShelf?shelfName="+this.detailData.shelfName
  147. })
  148. },
  149. // 按照产品搜索货位
  150. toSearchHw(){
  151. uni.navigateTo({
  152. url: "/pages/shelfSetting/searchShelfHw?shelfName="+this.detailData.shelfName+"&shelfSn="+this.shelfSn
  153. })
  154. },
  155. // 新增货位
  156. addHw(){
  157. uni.navigateTo({
  158. url: "/pages/shelfSetting/addShelfHw?shelfName="+this.detailData.shelfName+"&shelfSn="+this.shelfSn
  159. })
  160. },
  161. // 保存数字货架基本信息
  162. saveShelf(data,type){
  163. const params = {
  164. shelfSn: this.shelfSn
  165. }
  166. if(type == 1){
  167. params.customerSn = this.detailData.customerSn
  168. params.shelfName = data.shelfName
  169. }else{
  170. params.customerSn = data.customerSn
  171. }
  172. shelfSave(params).then(res => {
  173. if (res.status == 200) {
  174. uni.showToast({
  175. icon: 'none',
  176. title: res.message
  177. })
  178. this.getShelfDetal()
  179. }
  180. })
  181. },
  182. getShelfDetal(){
  183. shelfDetail({ sn: this.shelfSn }).then(res => {
  184. if (res.status == 200) {
  185. this.detailData = res.data
  186. this.switchVal = res.data.finishFlag == 1
  187. } else {
  188. this.detailData = null
  189. }
  190. })
  191. }
  192. }
  193. }
  194. </script>
  195. <style lang="less">
  196. .content{
  197. width:100%;
  198. }
  199. .card-box{
  200. background-color: #fff;
  201. border-radius: 0.5rem;
  202. box-shadow: 0.1rem 0.2rem 0.3rem #eee;
  203. padding: 0 1rem;
  204. margin: 0.5rem;
  205. .card-row{
  206. border-bottom: 0.1rpx solid #eee;
  207. padding: 20rpx 0;
  208. min-height: 90rpx;
  209. &:last-child{
  210. border-bottom: 0;
  211. }
  212. .label{
  213. flex: 1;
  214. width: 20%;
  215. }
  216. .text{
  217. width: 80%;
  218. color: #666;
  219. }
  220. }
  221. }
  222. .shelfPlace{
  223. .shelfPlaceHead{
  224. padding: 0.2rem 0.5rem 0.5rem;
  225. justify-content: space-between;
  226. .lt{
  227. font-size: 0.9rem;
  228. color: #999;
  229. text{
  230. color: #ff5500;
  231. font-size: 1rem;
  232. }
  233. }
  234. .search-btn{
  235. border:0.1rpx solid #eee;
  236. border-radius: 50rpx;
  237. width: 50%;
  238. justify-content: space-between;
  239. padding:0.3rem 0.5rem;
  240. color: #999;
  241. background-color: #fff;
  242. font-size: 0.9rem;
  243. &:active{
  244. opacity: 0.6;
  245. }
  246. }
  247. }
  248. .shelfTabs{
  249. height: calc(100vh - 150rpx);
  250. .leftTabs{
  251. width: 20%;
  252. overflow: auto;
  253. > view{
  254. padding: 0.8rem 0.5rem;
  255. border-left: 0.2rem solid #f8f8f8;
  256. text-align: center;
  257. }
  258. .active{
  259. border-color: rgb(47, 126, 209);
  260. background-color: #fff;
  261. }
  262. }
  263. .rightCons{
  264. width: 80%;
  265. background-color: #fff;
  266. position: relative;
  267. .hwList{
  268. overflow: auto;
  269. padding: 0.5rem;
  270. padding-bottom: 105rpx;
  271. > text{
  272. border: 0.1rpx solid #eee;
  273. padding: 0.2rem 0.8rem;
  274. border-radius: 0.3rem;
  275. margin: 0.5rem 2%;
  276. float: left;
  277. width: 20%;
  278. text-align: center;
  279. }
  280. .red{
  281. border-color: orangered;
  282. }
  283. .add{
  284. border-style: dashed;
  285. border-color: #999;
  286. color: #999;
  287. }
  288. }
  289. .hwAction{
  290. padding: 0.5rem;
  291. position: fixed;
  292. bottom: 0;
  293. right: 0;
  294. width: 80%;
  295. background-color: #fff;
  296. button{
  297. width: 240rpx;
  298. }
  299. .newbtn{
  300. background-color: rgb(51, 95, 182);
  301. color: #fff;
  302. }
  303. }
  304. }
  305. }
  306. }
  307. </style>