shelfSet.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  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">
  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">
  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"><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" 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. const win = uni.getWindowInfo()
  99. console.log(win,'win')
  100. this.pleft = Math.floor(win.windowWidth * 0.3)
  101. this.ptop = Math.floor(win.windowHeight - 70)
  102. },
  103. onUnload() {
  104. uni.$off("editCustome")
  105. },
  106. methods: {
  107. tapPopup(e){
  108. console.log(e)
  109. },
  110. showTip(){
  111. uni.showModal({
  112. showCancel:false,
  113. confirmText:"好的",
  114. title: "提示",
  115. content: "只有当数字货架的“是否设置完成”为“是”,系统才会自动对该货架生成补货单,修理厂才能正常下单。"
  116. })
  117. },
  118. // 设置完成是否
  119. switchChange(v){
  120. const params = {
  121. shelfSn: this.shelfSn,
  122. finishFlag: v ? '1' : '0'
  123. }
  124. modifFinishFlag(params).then(res => {
  125. if (res.status == 200) {
  126. uni.showToast({
  127. icon: 'none',
  128. title: res.message
  129. })
  130. }
  131. })
  132. },
  133. // 关联客户
  134. customeSet(){
  135. uni.navigateTo({
  136. url: "/pages/sales/chooseCustomer?backPage=shelfEdit&shelfName="+this.detailData.shelfName
  137. })
  138. },
  139. // 保存数字货架基本信息
  140. saveShelf(data,type){
  141. const params = {
  142. shelfSn: this.shelfSn
  143. }
  144. if(type == 1){
  145. params.shelfName = data.shelfName
  146. }else{
  147. params.customerSn = data.customerSn
  148. }
  149. shelfSave(params).then(res => {
  150. if (res.status == 200) {
  151. uni.showToast({
  152. icon: 'none',
  153. title: res.message
  154. })
  155. this.getShelfDetal()
  156. }
  157. })
  158. },
  159. getShelfDetal(){
  160. shelfDetail({ sn: this.shelfSn }).then(res => {
  161. if (res.status == 200) {
  162. this.detailData = res.data
  163. this.switchVal = res.data.finishFlag == 1
  164. } else {
  165. this.detailData = null
  166. }
  167. })
  168. }
  169. }
  170. }
  171. </script>
  172. <style lang="less">
  173. .content{
  174. width:100%;
  175. }
  176. .card-box{
  177. background-color: #fff;
  178. border-radius: 0.5rem;
  179. box-shadow: 0.1rem 0.2rem 0.3rem #eee;
  180. padding: 0 1rem;
  181. margin: 0.5rem;
  182. .card-row{
  183. border-bottom: 0.1rpx solid #eee;
  184. padding: 20rpx 0;
  185. min-height: 90rpx;
  186. &:last-child{
  187. border-bottom: 0;
  188. }
  189. .label{
  190. flex: 1;
  191. width: 20%;
  192. }
  193. .text{
  194. width: 80%;
  195. color: #666;
  196. }
  197. }
  198. }
  199. .shelfPlace{
  200. .shelfPlaceHead{
  201. padding: 0.2rem 0.5rem 0.5rem;
  202. justify-content: space-between;
  203. .lt{
  204. font-size: 0.9rem;
  205. color: #999;
  206. text{
  207. color: #ff5500;
  208. font-size: 1rem;
  209. }
  210. }
  211. .search-btn{
  212. border:0.1rpx solid #eee;
  213. border-radius: 50rpx;
  214. width: 50%;
  215. justify-content: space-between;
  216. padding:0.3rem 0.5rem;
  217. color: #999;
  218. background-color: #fff;
  219. font-size: 0.9rem;
  220. &:active{
  221. opacity: 0.6;
  222. }
  223. }
  224. }
  225. .shelfTabs{
  226. height: calc(100vh - 150rpx);
  227. .leftTabs{
  228. width: 20%;
  229. overflow: auto;
  230. > view{
  231. padding: 0.8rem 0.5rem;
  232. border-left: 0.2rem solid #f8f8f8;
  233. text-align: center;
  234. }
  235. .active{
  236. border-color: rgb(47, 126, 209);
  237. background-color: #fff;
  238. }
  239. }
  240. .rightCons{
  241. width: 80%;
  242. background-color: #fff;
  243. position: relative;
  244. .hwList{
  245. overflow: auto;
  246. padding: 0.5rem;
  247. padding-bottom: 105rpx;
  248. > text{
  249. border: 0.1rpx solid #eee;
  250. padding: 0.2rem 0.8rem;
  251. border-radius: 0.3rem;
  252. margin: 0.5rem 2%;
  253. float: left;
  254. width: 20%;
  255. text-align: center;
  256. }
  257. .red{
  258. border-color: orangered;
  259. }
  260. .add{
  261. border-style: dashed;
  262. border-color: #999;
  263. color: #999;
  264. }
  265. }
  266. .hwAction{
  267. padding: 0.5rem;
  268. position: fixed;
  269. bottom: 0;
  270. right: 0;
  271. width: 80%;
  272. background-color: #fff;
  273. button{
  274. width: 240rpx;
  275. }
  276. .newbtn{
  277. background-color: rgb(51, 95, 182);
  278. color: #fff;
  279. }
  280. }
  281. }
  282. }
  283. }
  284. </style>