下单增加保险展示
This commit is contained in:
parent
febbcb457b
commit
3f85de1f93
|
@ -8,7 +8,7 @@
|
||||||
<text class="desc">全面保证您的人身财产安全</text>
|
<text class="desc">全面保证您的人身财产安全</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="switch-container">
|
<view class="switch-container">
|
||||||
<text class="price">¥ 6.00</text>
|
<text class="price">¥ {{ price }}</text>
|
||||||
<view v-show="showSwitch" class="switch" @click="changeState">
|
<view v-show="showSwitch" class="switch" @click="changeState">
|
||||||
<widget-switch :open="state" />
|
<widget-switch :open="state" />
|
||||||
</view>
|
</view>
|
||||||
|
@ -33,6 +33,10 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
price: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
insurance: {
|
insurance: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
|
|
|
@ -76,6 +76,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
service: {
|
service: {
|
||||||
|
insurance: {
|
||||||
|
url: "/index/getyiwai",
|
||||||
|
},
|
||||||
aftermarket: {
|
aftermarket: {
|
||||||
url: "/index/category2",
|
url: "/index/category2",
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import Vue from "vue"
|
||||||
|
let prototype = Vue.prototype;
|
||||||
|
|
||||||
|
export default {
|
||||||
|
getInsurancePrice() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
prototype.$request({
|
||||||
|
api: "service.insurance",
|
||||||
|
}).then((response) => {
|
||||||
|
if (response.code == 1) {
|
||||||
|
let money = parseFloat(response.data.money);
|
||||||
|
resolve(money > 0 ? money : 0)
|
||||||
|
}
|
||||||
|
}).catch(e => { });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -32,7 +32,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="insurance-box">
|
<view class="insurance-box">
|
||||||
<service-insurance :insurance="insurance" @change="changeInsuranceState" />
|
<service-insurance :price="insurancePrice" :insurance="insurance" @change="changeInsuranceState" />
|
||||||
</view>
|
</view>
|
||||||
<view class="demand">
|
<view class="demand">
|
||||||
<text class="title">留言</text>
|
<text class="title">留言</text>
|
||||||
|
@ -62,6 +62,7 @@ import ServicePreviewItem from "@/components/service/preview-item";
|
||||||
import Agreement from "@/components/auth/agreement";
|
import Agreement from "@/components/auth/agreement";
|
||||||
import WidgetTips from "@/components/widgets/tips";
|
import WidgetTips from "@/components/widgets/tips";
|
||||||
import ServiceInsurance from "@/components/service/insurance";
|
import ServiceInsurance from "@/components/service/insurance";
|
||||||
|
import { mapState } from "vuex";
|
||||||
export default {
|
export default {
|
||||||
name: "order-create",
|
name: "order-create",
|
||||||
data() {
|
data() {
|
||||||
|
@ -96,8 +97,14 @@ export default {
|
||||||
WidgetTips,
|
WidgetTips,
|
||||||
ServiceInsurance,
|
ServiceInsurance,
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
insurancePrice: (state) => state.service.insurancePrice,
|
||||||
|
}),
|
||||||
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.pageConfig = getApp().globalData.pageConfig;
|
this.pageConfig = getApp().globalData.pageConfig;
|
||||||
|
this.$store.dispatch("service/insurancePrice");
|
||||||
},
|
},
|
||||||
onShow() {},
|
onShow() {},
|
||||||
onReady() {},
|
onReady() {},
|
||||||
|
|
|
@ -3,11 +3,13 @@ import Vuex from 'vuex'
|
||||||
|
|
||||||
import system from "@/store/modules/system"
|
import system from "@/store/modules/system"
|
||||||
import user from "@/store/modules/user"
|
import user from "@/store/modules/user"
|
||||||
|
import service from "@/store/modules/service"
|
||||||
|
|
||||||
Vue.use(Vuex)
|
Vue.use(Vuex)
|
||||||
export default new Vuex.Store({
|
export default new Vuex.Store({
|
||||||
modules: {
|
modules: {
|
||||||
system,
|
system,
|
||||||
user,
|
user,
|
||||||
|
service,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
import service from "@/core/models/service";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
namespaced: true,
|
||||||
|
state: {
|
||||||
|
insurancePrice: 0,
|
||||||
|
},
|
||||||
|
getters: {},
|
||||||
|
mutations: {
|
||||||
|
insurancePrice(state, data) {
|
||||||
|
state.insurancePrice = data;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
insurancePrice(context) {
|
||||||
|
service.getInsurancePrice().then(price => {
|
||||||
|
context.commit('insurancePrice', price);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue