changePrice.vue 6.9 KB

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