changePrice.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <view>
  3. <view class="price-content">
  4. <AForm ref="form" :form="form" @isUncomplete="isUncomplete"></AForm>
  5. <view style="height: 70px;" />
  6. </view>
  7. <view class="height"></view>
  8. <view class="footer">
  9. <view class="add" :class="uncomplete ? 'forbidden' : ''" hover-class="navigator-hover"
  10. @click="uncomplete || loading ? '' : submit()">
  11. <u-loading-icon v-if="loading" />
  12. <block v-else>
  13. {{ '保存' }}
  14. </block>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import AForm from '../../components/my_form2.vue'
  21. export default {
  22. components:{AForm},
  23. data () {
  24. return{
  25. uncomplete:true,
  26. loading:false,
  27. form: [],
  28. sa_storeid:uni.getStorageSync('shop').sa_storeid
  29. }
  30. },
  31. methods: {
  32. async init () {
  33. let from = [{
  34. key: "cufang_min",
  35. type: "text",
  36. inputmode:'digit',
  37. label: "厨房最小单价",
  38. isMust: true,//是否必填
  39. value: "",
  40. title:'1个厨房(6平方)',
  41. descript:'官方指导价199元',
  42. },{
  43. key: "cufang_max",
  44. type: "text",
  45. inputmode:'digit',
  46. label: "厨房最大单价",
  47. isMust: true,//是否必填
  48. value: "",
  49. marginBottom:10,
  50. paddingBottom:15,
  51. borderRadius:true
  52. },{
  53. key: "weiyu_min",
  54. type: "text",
  55. inputmode:'digit',
  56. label: "卫浴最小单价",
  57. isMust: true,//是否必填
  58. value: "",
  59. title:'1个卫浴(4平方)',
  60. descript:'官方指导价799元'
  61. },{
  62. key: "weiyu_max",
  63. type: "text",
  64. inputmode:'digit',
  65. label: "卫浴最大单价",
  66. isMust: true,//是否必填
  67. value: "",
  68. marginBottom:10,
  69. paddingBottom:15,
  70. borderRadius:true
  71. },{
  72. key: "bg_min",
  73. type: "text",
  74. inputmode:'digit',
  75. label: "背景墙最小单价",
  76. isMust: true,//是否必填
  77. value: "",
  78. paddingBottom:false,
  79. title:'1个背景墙(4延米)',
  80. descript:'官方指导价199元'
  81. },{
  82. key: "bg_max",
  83. type: "text",
  84. inputmode:'digit',
  85. label: "背景墙最大单价",
  86. isMust: true,//是否必填
  87. value: "",
  88. paddingBottom:15,
  89. borderRadius:true
  90. }]
  91. await this.$Http.basic({
  92. "id": 20240515131702,
  93. "content": {
  94. "sa_storeid": this.sa_storeid
  95. }
  96. }).then(res => {
  97. for (let i = 0; i < res.data.length; i++) {
  98. for (let j = 0; j < from.length; j++) {
  99. if (from[j].label.indexOf(res.data[i].type) != -1) {
  100. if (from[j].key.indexOf('min') != -1) {
  101. from[j].value = res.data[i].min_price
  102. } else {
  103. from[j].value = res.data[i].max_price
  104. }
  105. }
  106. }
  107. }
  108. console.log(res.data,'门店价');
  109. })
  110. await this.$Http.basic({
  111. "id": 20240515133602,
  112. "content": {
  113. }
  114. }).then(res => {
  115. for (let i = 0; i < res.data.length; i++) {
  116. for (let j = 0; j < from.length; j++) {
  117. if (from[j].label.indexOf(res.data[i].type) != -1) {
  118. if (from[j].key.indexOf('min') != -1) {
  119. from[j].descript = '官方指导价' + res.data[i].min_price + '元'
  120. } else {
  121. from[j].descript = '官方指导价' + res.data[i].max_price + '元'
  122. }
  123. }
  124. }
  125. }
  126. this.form = from
  127. console.log(res.data,'官方价');
  128. console.log(this.form,'value');
  129. })
  130. },
  131. isUncomplete(uncomplete,actions) {
  132. console.log(uncomplete,'验证');
  133. this.uncomplete = uncomplete;
  134. },
  135. submit() {
  136. this.loading = true;
  137. let that = this;
  138. this.$refs.form.submit().then(data => {
  139. this.$Http.basic({
  140. "id": 20240515134102,
  141. "content": {
  142. sa_storeid:that.sa_storeid,
  143. "items": [
  144. {
  145. "type": "厨房",
  146. "min_price": data.cufang_min,
  147. "max_price": data.cufang_max
  148. },
  149. {
  150. "type": "卫浴",
  151. "min_price": data.weiyu_min,
  152. "max_price": data.weiyu_max
  153. },
  154. {
  155. "type": "背景墙",
  156. "min_price": data.bg_min,
  157. "max_price": data.bg_max
  158. }
  159. ]
  160. }
  161. }).then(async res => {
  162. this.loading = false;
  163. console.log("修改信息", res)
  164. if (this.cutoff(res.msg)) return;
  165. uni.showToast({
  166. title:'修改成功'
  167. })
  168. })
  169. })
  170. },
  171. },
  172. onLoad () {
  173. this.init()
  174. uni.setNavigationBarTitle({
  175. title:'装修预算改价',
  176. })
  177. }
  178. }
  179. </script>
  180. <style lang="scss">
  181. .price-content {
  182. padding: 10px 10px 0 10px;
  183. box-sizing: border-box;
  184. }
  185. .height {
  186. height: 20px;
  187. }
  188. .footer {
  189. position: fixed;
  190. bottom: 0;
  191. width: 100vw;
  192. height: 65px;
  193. background: #FFFFFF;
  194. box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
  195. box-sizing: border-box;
  196. padding: 5px 10px;
  197. z-index: 5;
  198. .add {
  199. display: flex;
  200. align-items: center;
  201. justify-content: center;
  202. width: 100%;
  203. height: 45px;
  204. background: #C30D23;
  205. border-radius: 5px;
  206. font-family: PingFang SC, PingFang SC;
  207. font-size: 14px;
  208. color: #FFFFFF;
  209. }
  210. .forbidden {
  211. opacity: .6;
  212. }
  213. }
  214. </style>