123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- <template>
- <view>
- <view class="price-content">
- <AForm ref="form" :form="form" @isUncomplete="isUncomplete"></AForm>
- <view style="height: 70px;" />
-
- </view>
- <view class="height"></view>
- <view class="footer">
- <view class="add" :class="uncomplete ? 'forbidden' : ''" hover-class="navigator-hover"
- @click="uncomplete || loading ? '' : submit()">
- <u-loading-icon v-if="loading" />
- <block v-else>
- {{ '保存' }}
- </block>
- </view>
- </view>
- </view>
-
- </template>
- <script>
- import AForm from '../../components/my_form2.vue'
- export default {
- components:{AForm},
- data () {
- return{
- uncomplete:true,
- loading:false,
- form: [],
- sa_storeid:uni.getStorageSync('shop').sa_storeid
- }
- },
- methods: {
- async init () {
- let from = [{
- key: "cufang_min",
- type: "text",
- inputmode:'digit',
- label: "厨房最小单价",
- isMust: true,//是否必填
- value: "",
- title:'1个厨房(6平方)',
- descript:'官方指导价199元',
- },{
- key: "cufang_max",
- type: "text",
- inputmode:'digit',
- label: "厨房最大单价",
- isMust: true,//是否必填
- value: "",
- marginBottom:10,
- paddingBottom:15,
- borderRadius:true
- },{
- key: "weiyu_min",
- type: "text",
- inputmode:'digit',
- label: "卫浴最小单价",
- isMust: true,//是否必填
- value: "",
- title:'1个卫浴(4平方)',
- descript:'官方指导价799元'
- },{
- key: "weiyu_max",
- type: "text",
- inputmode:'digit',
- label: "卫浴最大单价",
- isMust: true,//是否必填
- value: "",
- marginBottom:10,
- paddingBottom:15,
- borderRadius:true
- },{
- key: "bg_min",
- type: "text",
- inputmode:'digit',
- label: "背景墙最小单价",
- isMust: true,//是否必填
- value: "",
- paddingBottom:false,
- title:'1个背景墙(4延米)',
- descript:'官方指导价199元'
- },{
- key: "bg_max",
- type: "text",
- inputmode:'digit',
- label: "背景墙最大单价",
- isMust: true,//是否必填
- value: "",
- paddingBottom:15,
- borderRadius:true
- }]
- await this.$Http.basic({
- "id": 20240515131702,
- "content": {
- "sa_storeid": this.sa_storeid
- }
- }).then(res => {
- for (let i = 0; i < res.data.length; i++) {
- for (let j = 0; j < from.length; j++) {
- if (from[j].label.indexOf(res.data[i].type) != -1) {
- if (from[j].key.indexOf('min') != -1) {
- from[j].value = res.data[i].min_price
- } else {
- from[j].value = res.data[i].max_price
- }
- }
- }
- }
- console.log(res.data,'门店价');
- })
- await this.$Http.basic({
- "id": 20240515133602,
- "content": {
- }
- }).then(res => {
- for (let i = 0; i < res.data.length; i++) {
- for (let j = 0; j < from.length; j++) {
- if (from[j].label.indexOf(res.data[i].type) != -1) {
- if (from[j].key.indexOf('min') != -1) {
- from[j].descript = '官方指导价' + res.data[i].min_price + '元'
- } else {
- from[j].descript = '官方指导价' + res.data[i].max_price + '元'
- }
- }
- }
- }
- this.form = from
- console.log(res.data,'官方价');
- console.log(this.form,'value');
- })
- },
- isUncomplete(uncomplete,actions) {
- console.log(uncomplete,'验证');
- this.uncomplete = uncomplete;
- },
- submit() {
- this.loading = true;
- let that = this;
- this.$refs.form.submit().then(data => {
- this.$Http.basic({
- "id": 20240515134102,
- "content": {
- sa_storeid:that.sa_storeid,
- "items": [
- {
- "type": "厨房",
- "min_price": data.cufang_min,
- "max_price": data.cufang_max
- },
- {
- "type": "卫浴",
- "min_price": data.weiyu_min,
- "max_price": data.weiyu_max
- },
- {
- "type": "背景墙",
- "min_price": data.bg_min,
- "max_price": data.bg_max
- }
- ]
- }
- }).then(async res => {
- this.loading = false;
- console.log("修改信息", res)
- if (this.cutoff(res.msg)) return;
- uni.showToast({
- title:'修改成功'
- })
- })
- })
- },
- },
- onLoad () {
- this.init()
- uni.setNavigationBarTitle({
- title:'装修预算改价',
- })
- }
- }
- </script>
- <style lang="scss">
- .price-content {
- padding: 10px 10px 0 10px;
- box-sizing: border-box;
- }
- .height {
- height: 20px;
- }
- .footer {
- position: fixed;
- bottom: 0;
- width: 100vw;
- height: 65px;
- background: #FFFFFF;
- box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
- box-sizing: border-box;
- padding: 5px 10px;
- z-index: 5;
- .add {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 100%;
- height: 45px;
- background: #C30D23;
- border-radius: 5px;
- font-family: PingFang SC, PingFang SC;
- font-size: 14px;
- color: #FFFFFF;
- }
- .forbidden {
- opacity: .6;
- }
- }
- </style>
|