|
|
@@ -31,59 +31,410 @@
|
|
|
<img src="../static/imgs/icon_into.png" class="into" />
|
|
|
</div>
|
|
|
<div class="desc-item" v-for="(detailItem, i) in item.descDetailList" :key="i">
|
|
|
- <div class="tag" v-if="detailItem.tip">{{ detailItem.tip }}</div>
|
|
|
+ <div class="tag" v-if="detailItem.tip">
|
|
|
+ {{ detailItem.tip }}
|
|
|
+ </div>
|
|
|
<div class="content">{{ detailItem.content }}</div>
|
|
|
</div>
|
|
|
<div class="divider" v-if="index < ((info.sku || {}).descInformationList || []).length - 1"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div class="form-block">
|
|
|
+ <div class="item">
|
|
|
+ <div class="label">适用车型:</div>
|
|
|
+ <div class="value">全部车型</div>
|
|
|
+ <img src="../static/imgs/icon_into.png" class="into" />
|
|
|
+ </div>
|
|
|
+ <div class="item">
|
|
|
+ <div class="label">选择颜色:</div>
|
|
|
+ <div class="value">到店为准</div>
|
|
|
+ <img src="../static/imgs/icon_into.png" class="into" />
|
|
|
+ </div>
|
|
|
+ <div class="item" @click="showCityPicker = true">
|
|
|
+ <div class="label">选择城市:</div>
|
|
|
+ <div class="value" v-if="cityId">{{ cityName }}</div>
|
|
|
+ <div class="value placeholder" v-else>请选择</div>
|
|
|
+ <img src="../static/imgs/icon_into.png" class="into" />
|
|
|
+ </div>
|
|
|
+ <div class="item noborder" @click="chooseDealer">
|
|
|
+ <div class="label">线下提车:</div>
|
|
|
+ <div class="value" v-if="dealerId">{{ dealerName }}</div>
|
|
|
+ <div class="value placeholder" v-else>请选择</div>
|
|
|
+ <img src="../static/imgs/icon_into.png" class="into" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<div class="tabs flex">
|
|
|
- <div class="tab f15 text2 flex center" :class="{ active: tab === 0 }" @click="tab = 0">商品详情</div>
|
|
|
- <div class="tab f15 text2 flex center" :class="{ active: tab === 1 }" @click="tab = 1">参数配置</div>
|
|
|
- <div class="tab f15 text2 flex center" @click="calculator">贷款计算器</div>
|
|
|
+ <div class="tab f15 text2 flex center" :class="{ active: tab === 0 }" @click="tab = 0">
|
|
|
+ 商品详情
|
|
|
+ </div>
|
|
|
+ <div class="tab f15 text2 flex center" :class="{ active: tab === 1 }" @click="(tab = 1), scroll()">
|
|
|
+ 参数配置
|
|
|
+ </div>
|
|
|
+ <div class="tab f15 text2 flex center" @click="calculator">
|
|
|
+ 贷款计算器
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div class="detail-wrapper" style="padding-bottom: calc(env(safe-area-inset-bottom) + 44px);">
|
|
|
+ <div class="detail-wrapper" style="font-size: 0; padding-bottom: calc(env(safe-area-inset-bottom) + 44px)">
|
|
|
<rich-text :nodes="info.mobileDesc || ''" v-if="tab === 0"></rich-text>
|
|
|
- <rich-text :nodes="info.mobileConfig || ''" v-if="tab === 1"></rich-text>
|
|
|
+ <div v-if="tab === 1" class="specs-container">
|
|
|
+ <div class="specs-card" v-if="config">
|
|
|
+ <div class="title">{{ info.name.split(' ')[0] }}</div>
|
|
|
+ <div class="dropdown f12 text1" @click="showModelPicker = true">
|
|
|
+ <div style="flex-grow: 1">{{ config.name }}</div>
|
|
|
+ <img src="../static/imgs/icon_dropdown.png" />
|
|
|
+ </div>
|
|
|
+ <div class="tip f11">
|
|
|
+ <div class="item"><span class="sym">●</span>标配</div>
|
|
|
+ <div class="item"><span class="sym">○</span>选配</div>
|
|
|
+ <div class="item"><span class="sym">–</span>无</div>
|
|
|
+ </div>
|
|
|
+ <div class="row">
|
|
|
+ <div class="col1">官方指导价</div>
|
|
|
+ <div class="col2 prim b f12">¥{{ numberWithCommas(config.officialQuotes) }}起</div>
|
|
|
+ </div>
|
|
|
+ <div class="spec-group" v-for="(item, i) in specs" :key="i">
|
|
|
+ <div class="head" @click="item.show = !item.show">
|
|
|
+ <img
|
|
|
+ :src="
|
|
|
+ item.show ? require('../static/imgs/minus.png') : require('../static/imgs/plus.png')
|
|
|
+ "
|
|
|
+ class="icon"
|
|
|
+ />
|
|
|
+ <div>{{ item.name }}</div>
|
|
|
+ </div>
|
|
|
+ <div v-if="item.show">
|
|
|
+ <div class="row" v-for="(child, j) in item.children" :key="j">
|
|
|
+ <div class="col1">{{ child.name }}</div>
|
|
|
+ <div class="col2">{{ child.value }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="f11 text1" style="margin: 15px 0 0 35px">
|
|
|
+ 备注:详情可咨询当地经销商
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<van-button :color="$colors.prim" block class="btn-order" @click="submit">立即下订</van-button>
|
|
|
+ <van-action-sheet :show="showModelPicker">
|
|
|
+ <van-picker
|
|
|
+ :columns="models"
|
|
|
+ show-toolbar
|
|
|
+ title="选择车型"
|
|
|
+ value-key="name"
|
|
|
+ @cancel="showModelPicker = false"
|
|
|
+ @confirm="confirmModel"
|
|
|
+ id="modelPicker"
|
|
|
+ ></van-picker>
|
|
|
+ </van-action-sheet>
|
|
|
+
|
|
|
+ <van-action-sheet :show="showCityPicker">
|
|
|
+ <!-- eslint-disable -->
|
|
|
+ <van-picker
|
|
|
+ :columns="[
|
|
|
+ { values: [], className: 'column1' },
|
|
|
+ { values: [], className: 'column2' }
|
|
|
+ ]"
|
|
|
+ value-key="name"
|
|
|
+ show-toolbar
|
|
|
+ title="选择城市"
|
|
|
+ @cancel="showCityPicker = false"
|
|
|
+ @confirm="confirmCity"
|
|
|
+ @change="pickerChange"
|
|
|
+ id="cityPicker"
|
|
|
+ />
|
|
|
+ <!-- eslint-enable -->
|
|
|
+ </van-action-sheet>
|
|
|
+
|
|
|
+ <van-action-sheet :show="showDealerPicker">
|
|
|
+ <van-picker
|
|
|
+ :columns="dealerList"
|
|
|
+ value-key="name"
|
|
|
+ show-toolbar
|
|
|
+ title="选择经销商"
|
|
|
+ @cancel="showDealerPicker = false"
|
|
|
+ @confirm="confirmDealer"
|
|
|
+ id="dealerPicker"
|
|
|
+ />
|
|
|
+ </van-action-sheet>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+import qs from 'qs';
|
|
|
+var QQMapWX = require('../qqmap-wx-jssdk.js');
|
|
|
+let qqmapsdk;
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
info: {},
|
|
|
- tab: 0
|
|
|
+ tab: 0,
|
|
|
+ showModelPicker: false,
|
|
|
+ models: [],
|
|
|
+ config: null,
|
|
|
+ specs: [],
|
|
|
+ provinceName: null,
|
|
|
+ provinceId: null,
|
|
|
+ cityName: null,
|
|
|
+ cityId: null,
|
|
|
+ showCityPicker: null,
|
|
|
+ picker: null,
|
|
|
+ dealerName: '',
|
|
|
+ dealerId: null,
|
|
|
+ dealerList: [],
|
|
|
+ showDealerPicker: false
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
+ qqmapsdk = new QQMapWX({
|
|
|
+ key: 'MC4BZ-4QDWP-B5ZDD-VS3HX-NHBAO-CRBOQ'
|
|
|
+ });
|
|
|
+ this.locate();
|
|
|
this.$http
|
|
|
.get('/applets/queryspudetail', {
|
|
|
skuId: this.$mp.query.id
|
|
|
})
|
|
|
.then(res => {
|
|
|
- console.log(res.data);
|
|
|
if (res.data.mobileDesc) {
|
|
|
res.data.mobileDesc = res.data.mobileDesc.replace(/<img/g, '<img class="rich-text-img"');
|
|
|
}
|
|
|
if (res.data.mobileConfig) {
|
|
|
res.data.mobileConfig = res.data.mobileConfig.replace(/<img/g, '<img class="rich-text-img"');
|
|
|
}
|
|
|
- console.log(res.data.mobileConfig);
|
|
|
this.info = res.data;
|
|
|
+ this.$http
|
|
|
+ .get(
|
|
|
+ // eslint-disable-next-line prettier/prettier
|
|
|
+ `https://dealer.jetour.com.cn/api-basic/api/carmodel/front/findCarModelBySeriesId/${res.data.categories[0].carSystem}`,
|
|
|
+ {},
|
|
|
+ {
|
|
|
+ header: {
|
|
|
+ Authorization: ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ this.models = res;
|
|
|
+ this.getConfig(res[0].id);
|
|
|
+ });
|
|
|
+ this.$http
|
|
|
+ .get(
|
|
|
+ // eslint-disable-next-line prettier/prettier
|
|
|
+ `https://dealer.jetour.com.cn/api-dealer/dealer-info/getProvinceBySeriesId/0cbe50af-c29a-4eb0-91cc-4a05c5f05c57/${res.data.categories[0].carSystem}`,
|
|
|
+ {},
|
|
|
+ { header: { Authorization: '' } }
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ this.picker.setColumnValues(
|
|
|
+ 0, //
|
|
|
+ res.data.sort((a, b) => a.id - b.id)
|
|
|
+ );
|
|
|
+ if (res.data[0]) {
|
|
|
+ this.pickerChange({
|
|
|
+ detail: {
|
|
|
+ index: 0,
|
|
|
+ value: [res.data[0]]
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
},
|
|
|
+ onShow() {
|
|
|
+ this.picker = this.$mp.page.selectComponent('#cityPicker');
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ locate() {
|
|
|
+ let province, city, provinceId, cityId;
|
|
|
+ this.$http
|
|
|
+ .get('https://apis.map.qq.com/ws/location/v1/ip', {
|
|
|
+ key: 'MC4BZ-4QDWP-B5ZDD-VS3HX-NHBAO-CRBOQ'
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ console.log(res);
|
|
|
+ this.location = res.result.location;
|
|
|
+ province = res.result.ad_info.province;
|
|
|
+ city = res.result.ad_info.city;
|
|
|
+ return this.$http.get(
|
|
|
+ 'https://dealer.jetour.com.cn/api-basic/api/region/findAllProvinces',
|
|
|
+ {},
|
|
|
+ {
|
|
|
+ header: {
|
|
|
+ Authorization: ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ provinceId = (res.find(i => i.name === province) || {}).id;
|
|
|
+ if (provinceId) {
|
|
|
+ return this.$http.get(
|
|
|
+ `https://dealer.jetour.com.cn/api-basic/api/region/findCityByProvinceId/${provinceId}`,
|
|
|
+ {},
|
|
|
+ {
|
|
|
+ header: {
|
|
|
+ Authorization: ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ return Promise.reject('找不到省份');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ cityId = (res.find(i => i.name === city) || {}).id;
|
|
|
+ if (cityId) {
|
|
|
+ return Promise.resolve();
|
|
|
+ } else {
|
|
|
+ return Promise.reject('找不到城市');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ console.log(provinceId, cityId);
|
|
|
+ this.provinceName = province;
|
|
|
+ this.cityName = city;
|
|
|
+ this.provinceId = provinceId;
|
|
|
+ this.cityId = cityId;
|
|
|
+ this.getDealer();
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ console.log(e);
|
|
|
+ });
|
|
|
+ },
|
|
|
calculator() {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/calculator'
|
|
|
});
|
|
|
},
|
|
|
submit() {
|
|
|
+ if (!this.cityId) {
|
|
|
+ wx.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '请选择城市'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!this.dealerId) {
|
|
|
+ wx.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '请选择经销商'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
wx.navigateTo({
|
|
|
- url: '/pages/submit'
|
|
|
+ url:
|
|
|
+ '/pages/submit?' +
|
|
|
+ qs.stringify({
|
|
|
+ skuId: this.info.id,
|
|
|
+ provinceId: this.provinceId,
|
|
|
+ cityId: this.cityId,
|
|
|
+ dealerId: this.dealerId,
|
|
|
+ name: this.info.name,
|
|
|
+ image: this.info.images[0]
|
|
|
+ })
|
|
|
+ });
|
|
|
+ },
|
|
|
+ scroll() {
|
|
|
+ const query = wx.createSelectorQuery();
|
|
|
+ query.select('.tabs').boundingClientRect();
|
|
|
+ query.selectViewport().scrollOffset();
|
|
|
+ query.exec(function(res) {
|
|
|
+ console.log(res);
|
|
|
+ wx.pageScrollTo({
|
|
|
+ scrollTop: res[0].top + res[1].scrollTop,
|
|
|
+ duration: 250
|
|
|
+ });
|
|
|
});
|
|
|
+ },
|
|
|
+ confirmModel(e) {
|
|
|
+ let value = this.$mp.page.selectComponent('#modelPicker').getColumnValue(0);
|
|
|
+ this.getConfig(value.id);
|
|
|
+ this.showModelPicker = false;
|
|
|
+ },
|
|
|
+ getConfig(id) {
|
|
|
+ this.$http
|
|
|
+ .get(
|
|
|
+ `https://dealer.jetour.com.cn/api-basic/api/carmodel/front/${id}`,
|
|
|
+ {},
|
|
|
+ { header: { Authorization: '' } }
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ this.specs = JSON.parse(res.config).map((i, index) => {
|
|
|
+ i.name = i.name.replace('■', '');
|
|
|
+ i.show = index === 0;
|
|
|
+ return i;
|
|
|
+ });
|
|
|
+ console.log('config::', this.specs);
|
|
|
+ this.config = res;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ numberWithCommas(x) {
|
|
|
+ return x.toLocaleString('en');
|
|
|
+ },
|
|
|
+ confirmCity() {
|
|
|
+ this.provinceId = this.picker.getColumnValue(0).id;
|
|
|
+ this.provinceName = this.picker.getColumnValue(0).name;
|
|
|
+ this.cityId = this.picker.getColumnValue(1).id;
|
|
|
+ this.cityName = this.picker.getColumnValue(1).name;
|
|
|
+ this.showCityPicker = false;
|
|
|
+ this.dealerName = '';
|
|
|
+ this.dealerId = null;
|
|
|
+ this.getDealer();
|
|
|
+ },
|
|
|
+ pickerChange(e) {
|
|
|
+ if (e.detail.index === 0) {
|
|
|
+ this.$http
|
|
|
+ .get(
|
|
|
+ // eslint-disable-next-line prettier/prettier
|
|
|
+ `https://dealer.jetour.com.cn/api-dealer/dealer-info/getCityBySeriesIdAndProvinceId/0cbe50af-c29a-4eb0-91cc-4a05c5f05c57/${this.info.categories[0].carSystem}/${e.detail.value[0].id}`
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ this.picker.setColumnValues(
|
|
|
+ 1, //
|
|
|
+ res.data.sort((a, b) => a.id - b.id)
|
|
|
+ );
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getDealer() {
|
|
|
+ this.$http
|
|
|
+ .post(
|
|
|
+ 'https://dealer.jetour.com.cn/api-dealer/dealer-info/searchDealerListByCondition',
|
|
|
+ {
|
|
|
+ brandId: '0cbe50af-c29a-4eb0-91cc-4a05c5f05c57',
|
|
|
+ provinceId: this.provinceId,
|
|
|
+ cityId: this.cityId,
|
|
|
+ enabledFlag: 1,
|
|
|
+ type: 1
|
|
|
+ },
|
|
|
+ {
|
|
|
+ header: {
|
|
|
+ Authorization: '',
|
|
|
+ 'Content-Type': 'application/json'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ res.data = res.data.filter(
|
|
|
+ i => i.showWebsiteFlag == 1 && !(typeof i.code === 'string' && i.code.startsWith('99999'))
|
|
|
+ );
|
|
|
+ this.dealerList = res.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ chooseDealer() {
|
|
|
+ if (!this.cityId) {
|
|
|
+ wx.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '请先选择城市'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.showDealerPicker = true;
|
|
|
+ },
|
|
|
+ confirmDealer() {
|
|
|
+ let value = this.$mp.page.selectComponent('#dealerPicker').getColumnValue(0);
|
|
|
+ this.dealerName = value.name;
|
|
|
+ this.dealerId = value.id;
|
|
|
+ this.showDealerPicker = false;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
@@ -183,6 +534,36 @@ page {
|
|
|
margin-bottom: 6px;
|
|
|
}
|
|
|
}
|
|
|
+.form-block {
|
|
|
+ background: white;
|
|
|
+ padding: 0 25px;
|
|
|
+ margin-top: 10px;
|
|
|
+ .item {
|
|
|
+ .flex();
|
|
|
+ font-size: 15px;
|
|
|
+ border-bottom: 1px solid #dedede;
|
|
|
+ height: 45px;
|
|
|
+ .label {
|
|
|
+ width: 80px;
|
|
|
+ color: @text3;
|
|
|
+ }
|
|
|
+ .value {
|
|
|
+ flex-grow: 1;
|
|
|
+ color: @text1;
|
|
|
+ .ellipsis();
|
|
|
+ }
|
|
|
+ .placeholder {
|
|
|
+ color: @text3;
|
|
|
+ }
|
|
|
+ .into {
|
|
|
+ width: 24px;
|
|
|
+ height: 24px;
|
|
|
+ }
|
|
|
+ &.noborder {
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
.tabs {
|
|
|
align-items: flex-start;
|
|
|
background: white;
|
|
|
@@ -215,9 +596,98 @@ rich-text {
|
|
|
bottom: 0;
|
|
|
left: 0;
|
|
|
right: 0;
|
|
|
- bottom: env(safe-area-inset-bottom);
|
|
|
.van-button {
|
|
|
border-radius: 0;
|
|
|
+ padding-bottom: calc(env(safe-area-inset-bottom) / 2) !important;
|
|
|
+ height: calc(52px + env(safe-area-inset-bottom) / 2) !important;
|
|
|
+ font-size: 15px;
|
|
|
+ }
|
|
|
+}
|
|
|
+.specs-container {
|
|
|
+ padding: 16px;
|
|
|
+ background: @bg;
|
|
|
+ .specs-card {
|
|
|
+ background: #ffffff;
|
|
|
+ border: 1px solid #ececec;
|
|
|
+ box-shadow: 0px 1px 6px 0 rgba(0, 0, 0, 0.08);
|
|
|
+ border-radius: 6px;
|
|
|
+ .title {
|
|
|
+ padding: 34px 0 30px 0;
|
|
|
+ text-align: center;
|
|
|
+ border-bottom: 1px solid @border5;
|
|
|
+ font-size: 21px;
|
|
|
+ color: @text1;
|
|
|
+ }
|
|
|
+ .dropdown {
|
|
|
+ .flex();
|
|
|
+ height: 34px;
|
|
|
+ border-bottom: 1px solid @border5;
|
|
|
+ padding: 0 11px 0 22px;
|
|
|
+ font-weight: bold;
|
|
|
+ img {
|
|
|
+ width: 15px;
|
|
|
+ height: 15px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .tip {
|
|
|
+ .flex();
|
|
|
+ height: 34px;
|
|
|
+ border-bottom: 1px solid @border5;
|
|
|
+ padding: 0 11px 0 22px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: @text2;
|
|
|
+ .item {
|
|
|
+ margin-right: 20px;
|
|
|
+ .sym {
|
|
|
+ margin-right: 5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .row {
|
|
|
+ .flex();
|
|
|
+ font-size: 11px;
|
|
|
+ border-bottom: 1px solid @border5;
|
|
|
+ align-items: stretch;
|
|
|
+ .col1,
|
|
|
+ .col2 {
|
|
|
+ flex-basis: 0;
|
|
|
+ flex-grow: 1;
|
|
|
+ .flex();
|
|
|
+ padding: 11px 10px;
|
|
|
+ }
|
|
|
+ .col1 {
|
|
|
+ justify-content: start;
|
|
|
+ padding-left: 22px;
|
|
|
+ border-right: 1px solid @border5;
|
|
|
+ color: @text1;
|
|
|
+ }
|
|
|
+ .col2 {
|
|
|
+ justify-content: center;
|
|
|
+ color: @text1;
|
|
|
+ padding: 11px 10px;
|
|
|
+ }
|
|
|
+ .prim {
|
|
|
+ color: @prim;
|
|
|
+ }
|
|
|
+ &.noborder {
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .head {
|
|
|
+ height: 34px;
|
|
|
+ .flex();
|
|
|
+ font-size: 11px;
|
|
|
+ border-bottom: 1px solid @border5;
|
|
|
+ padding-left: 23px;
|
|
|
+ font-size: 15px;
|
|
|
+ color: @text1;
|
|
|
+ background: #ececec;
|
|
|
+ .icon {
|
|
|
+ width: 15px;
|
|
|
+ height: 15px;
|
|
|
+ margin-right: 11px;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</style>
|