下单增加保险展示
This commit is contained in:
parent
febbcb457b
commit
3f85de1f93
|
@ -8,7 +8,7 @@
|
|||
<text class="desc">全面保证您的人身财产安全</text>
|
||||
</view>
|
||||
<view class="switch-container">
|
||||
<text class="price">¥ 6.00</text>
|
||||
<text class="price">¥ {{ price }}</text>
|
||||
<view v-show="showSwitch" class="switch" @click="changeState">
|
||||
<widget-switch :open="state" />
|
||||
</view>
|
||||
|
@ -33,6 +33,10 @@ export default {
|
|||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
price: {
|
||||
type: [Number, String],
|
||||
default: 0,
|
||||
},
|
||||
insurance: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
|
|
|
@ -76,6 +76,9 @@ export default {
|
|||
}
|
||||
},
|
||||
service: {
|
||||
insurance: {
|
||||
url: "/index/getyiwai",
|
||||
},
|
||||
aftermarket: {
|
||||
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 class="insurance-box">
|
||||
<service-insurance :insurance="insurance" @change="changeInsuranceState" />
|
||||
<service-insurance :price="insurancePrice" :insurance="insurance" @change="changeInsuranceState" />
|
||||
</view>
|
||||
<view class="demand">
|
||||
<text class="title">留言</text>
|
||||
|
@ -62,6 +62,7 @@ import ServicePreviewItem from "@/components/service/preview-item";
|
|||
import Agreement from "@/components/auth/agreement";
|
||||
import WidgetTips from "@/components/widgets/tips";
|
||||
import ServiceInsurance from "@/components/service/insurance";
|
||||
import { mapState } from "vuex";
|
||||
export default {
|
||||
name: "order-create",
|
||||
data() {
|
||||
|
@ -96,8 +97,14 @@ export default {
|
|||
WidgetTips,
|
||||
ServiceInsurance,
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
insurancePrice: (state) => state.service.insurancePrice,
|
||||
}),
|
||||
},
|
||||
onLoad() {
|
||||
this.pageConfig = getApp().globalData.pageConfig;
|
||||
this.$store.dispatch("service/insurancePrice");
|
||||
},
|
||||
onShow() {},
|
||||
onReady() {},
|
||||
|
|
|
@ -3,11 +3,13 @@ import Vuex from 'vuex'
|
|||
|
||||
import system from "@/store/modules/system"
|
||||
import user from "@/store/modules/user"
|
||||
import service from "@/store/modules/service"
|
||||
|
||||
Vue.use(Vuex)
|
||||
export default new Vuex.Store({
|
||||
modules: {
|
||||
system,
|
||||
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