Commit 63593c7b authored by chenwei's avatar chenwei

Merge branch 'feature' into 'release'

task [446] - 注册成功后的积分获取逻辑修改

See merge request !22
parents 30948504 6a3be44b
......@@ -906,6 +906,7 @@ export default {
textLength: "Enter up to 100 words ",
totalScore: "Selected ${value} items, total points: {total} points",
totalScore1: "Integral",
totalSumIntegral: "total Sum Integral",
addAddress: "Add shipping address",
totalScoreError: "Insufficient points",
illustrate: "Integral illustration",
......
......@@ -1168,6 +1168,7 @@ export default {
totalScore1: "积分",
addAddress: "新增收货地址",
totalScoreError: "积分不足",
totalSumIntegral: " 合计积分",
illustrate: "积分说明",
registerLabel: "注册成功即可获得{val}积分",
referralCodeLabel: "每邀请1人注册并登录获得{val}积分",
......
<template>
<div style="display: flex;justify-content: space-between;align-items: flex-end;">
<div style="display: flex;align-items: flex-end;">
<img src="@/assets/navbar/index.png" alt style="width: 26px;height: 26px;margin-top:12px">
<div
style="display: flex; justify-content: space-between; align-items: flex-end"
>
<div style="display: flex; align-items: flex-end">
<img
src="@/assets/navbar/index.png"
alt
style="width: 26px; height: 26px; margin-top: 12px"
/>
<el-breadcrumb class="app-breadcrumb" separator=">">
<transition-group name="breadcrumb">
<el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path">
<el-breadcrumb-item
v-for="(item, index) in levelList"
:key="item.path"
>
<span
v-if="item.redirect==='noRedirect'||index==levelList.length-1"
v-if="
item.redirect === 'noRedirect' || index == levelList.length - 1
"
class="no-redirect"
>{{ generateTitle(item.meta.title) }}</span>
<a v-else @click.prevent="handleLink(item)">{{ generateTitle(item.meta.title) }}</a>
>{{ generateTitle(item.meta.title) }}</span
>
<a v-else @click.prevent="handleLink(item)">{{
generateTitle(item.meta.title)
}}</a>
</el-breadcrumb-item>
</transition-group>
</el-breadcrumb>
</div>
<div>
<el-select v-model="language" size="mini" placeholder="" class="lang" @change="handleSetLanguage">
<div slot="prefix" style="padding: 4px;">
<img src="@/assets/lang.png" style="width:20px;height:20px;">
<el-select
v-model="language"
size="mini"
placeholder=""
class="lang"
@change="handleSetLanguage"
>
<div slot="prefix" style="padding: 4px">
<img src="@/assets/lang.png" style="width: 20px; height: 20px" />
</div>
<el-option
v-for="item in locale"
......@@ -28,110 +48,112 @@
</el-select>
</div>
</div>
</template>
<script>
import { generateTitle } from '@/utils/i18n'
import pathToRegexp from 'path-to-regexp'
import { locale } from '@/api/country'
import { langData } from '@/data/lang'
import { generateTitle } from "@/utils/i18n";
import pathToRegexp from "path-to-regexp";
import { locale } from "@/api/country";
import { langData } from "@/data/lang";
export default {
data() {
return {
levelList: null,
locale: [],
apiLang: '',
langData: langData
}
apiLang: "",
langData: langData,
};
},
computed: {
language: {
get() {
return this.$store.getters.language
return this.$store.getters.language;
},
set(val) {
this.handleSetLanguage(val)
}
}
this.handleSetLanguage(val);
},
},
},
watch: {
$route(route) {
// if you go to the redirect page, do not update the breadcrumbs
if (route.path.startsWith('/redirect/')) {
return
if (route.path.startsWith("/redirect/")) {
return;
}
this.getBreadcrumb()
this.getBreadcrumb();
},
language() {
this.getCode = this.$t('login.getCode')
this.apiLang = this.langData[this.language]
}
this.getCode = this.$t("login.getCode");
this.apiLang = this.langData[this.language];
},
},
created() {
this.apiLang = this.langData[this.language]
this.getBreadcrumb()
locale().then(r => {
this.locale = r.data
})
this.apiLang = this.langData[this.language];
this.getBreadcrumb();
locale().then((r) => {
this.locale = r.data;
});
},
methods: {
generateTitle,
handleSetLanguage(lang) {
this.$i18n.locale = lang
this.$store.dispatch('app/setLanguage', lang)
this.$i18n.locale = lang;
this.$store.dispatch("app/setLanguage", lang);
},
getBreadcrumb() {
// only show routes with meta.title
let matched = this.$route.matched.filter(
item => item.meta && item.meta.title
)
const first = matched[0]
(item) => item.meta && item.meta.title
);
const first = matched[0];
if (!this.isDashboard(first)) {
matched = [{ path: '/dashboard', meta: { title: 'dashboard' }}].concat(
matched = [{ path: "/dashboard", meta: { title: "dashboard" } }].concat(
matched
)
);
}
this.levelList = matched.filter(
item => item.meta && item.meta.title && item.meta.breadcrumb !== false
)
(item) => item.meta && item.meta.title && item.meta.breadcrumb !== false
);
console.log("9999", this.levelList);
},
isDashboard(route) {
const name = route && route.name
const name = route && route.name;
if (!name) {
return false
return false;
}
return name.trim().toLocaleLowerCase() === 'Dashboard'.toLocaleLowerCase()
return (
name.trim().toLocaleLowerCase() === "Dashboard".toLocaleLowerCase()
);
},
pathCompile(path) {
// To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561
const { params } = this.$route
var toPath = pathToRegexp.compile(path)
return toPath(params)
const { params } = this.$route;
var toPath = pathToRegexp.compile(path);
return toPath(params);
},
handleLink(item) {
const { redirect, path } = item
const { redirect, path } = item;
if (redirect) {
this.$router.push(redirect)
return
this.$router.push(redirect);
return;
}
if (item.meta.title == 'dashboard' && process.env.VUE_APP_HOME_API) {
window.open(process.env.VUE_APP_HOME_API)
if (item.meta.title == "dashboard" && process.env.VUE_APP_HOME_API) {
window.open(process.env.VUE_APP_HOME_API);
} else {
this.$router.push(this.pathCompile(path))
}
}
this.$router.push(this.pathCompile(path));
}
}
},
},
};
</script>
<style lang="scss" scoped>
.lang{
.lang {
width: 150px;
::v-deep .el-input__inner{
::v-deep .el-input__inner {
border-radius: 34px;
}
}
......
......@@ -15,7 +15,7 @@
src="@/assets/integral/house.png"
alt=""
srcset=""
>
/>
<i
v-else
class="el-icon-location-information adress-icon iconColor"
......@@ -51,10 +51,10 @@
isChinese ? rewardDetailsInfo.imgZh : rewardDetailsInfo.imgEn
"
alt=""
>
/>
<div class="gift-tag">
<div class="tags">
<img class="tag-image" src="@/assets/integral/score.png">
<img class="tag-image" src="@/assets/integral/score.png" />
<div class="tag-text">
{{ rewardDetailsInfo.pointsRequire }}
</div>
......@@ -84,13 +84,13 @@
</div>
<div class="activityTime">
<span class="pad-20">{{ $t("exchange.activityTime") }}</span>
<span
class="textLabel"
<span class="textLabel"
>{{ parseTime(rewardDetailsInfo.startTime, "{y}-{m}-{d}") }}
{{ $t("exchange.to") }}
{{
parseTime(rewardDetailsInfo.endTime, "{y}-{m}-{d}")
}}</span>
}}</span
>
</div>
</div>
</div>
......@@ -112,7 +112,9 @@
type="text"
:disabled="count < 60"
@click.native.prevent="getValidaCode"
>{{ getCode }}</el-button>
>{{ getCode }}</el-button
>
<span class="codeMobile">({{ info.mobile }})</span>
</div>
</div>
<div class="textDesc">
......@@ -139,132 +141,185 @@
type="primary"
round
@click="handleSubmitRedeem"
>{{ $t("exchange.submitOrder") }}</el-button>
>{{ $t("exchange.submitOrder") }}</el-button
>
</div>
</el-tab-pane>
</el-tabs>
<el-dialog
:title="$t('addressManager.prompt')"
:visible.sync="dialogVisible"
width="30%"
:before-close="handleClose"
>
<div class="title">
{{ isChinese ? rewardDetailsInfo.titleZh : rewardDetailsInfo.titleEn }}
</div>
<div class="number">
{{ $t("delivery.quantity") }}{{ paramsInfo.rewardCount }}
</div>
<div class="number">
{{ $t("integral.totalSumIntegral") }}{{ totalIntegral }}
</div>
<div class="number">
{{ $t("exchange.exchangeMethod") }}{{ getExcahngeType() }}
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">{{
$t("customer.cancel")
}}</el-button>
<el-button type="primary" @click="confirmSubmit">{{
$t("customer.submit")
}}</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { getDictData, getDictDatas } from '@/utils/dict'
import { addresslist, addressinfo } from '@/api/address'
import { getDictData, getDictDatas } from "@/utils/dict";
import { addresslist, addressinfo } from "@/api/address";
import {
rewardDetails,
exchangeSMSCode,
redeemSingleReward
} from '@/api/integral'
import { parseTime } from '@/utils/ruoyi'
redeemSingleReward,
} from "@/api/integral";
import { getInfo } from "@/api/user";
import { parseTime } from "@/utils/ruoyi";
export default {
name: 'ExchangeOperate',
name: "ExchangeOperate",
data() {
return {
dialogVisible: false,
addressInfo: {},
getCode: this.$t('login.getCode'),
getCode: this.$t("login.getCode"),
rewardDetailsInfo: {},
count: 60,
totalIntegral: 0,
pickMethodList: '',
pickMethodList: "",
info: {},
paramsInfo: {
memberId: this.$store.getters.id,
rewardId: this.$route.query.id,
redeemType: '1',
redeemType: "1",
rewardCount: 1,
entrance: '3',
remark: '',
code: ''
}
}
entrance: "3",
remark: "",
code: "",
},
};
},
computed: {
isChinese() {
this.getCode = this.$t('login.getCode')
return this.$i18n.locale === 'zh_CN'
}
this.getCode = this.$t("login.getCode");
return this.$i18n.locale === "zh_CN";
},
},
created() {
this.getAddressList()
this.getRewardsDetailsAPI()
this.getAddressList();
this.getRewardsDetailsAPI();
this.getInfo();
},
beforeRouteEnter(to, from, next) {
next((vm) => {
if (Object.prototype.hasOwnProperty.call(from.params, 'addressId')) {
vm.handleSelectAddress(from.params.addressId)
if (Object.prototype.hasOwnProperty.call(from.params, "addressId")) {
vm.handleSelectAddress(from.params.addressId);
}
})
});
},
methods: {
parseTime,
// 兑换
handleSubmitRedeem() {
const params = { ...this.paramsInfo }
if (params.redeemType != '1') {
params.recipientAddress = this.addressInfo.address
params.recipientName = this.addressInfo.name
params.recipientPhoneNum = this.addressInfo.phone
this.dialogVisible = true;
},
confirmSubmit() {
const params = { ...this.paramsInfo };
if (params.redeemType != "1") {
params.recipientAddress = this.addressInfo.address;
params.recipientName = this.addressInfo.name;
params.recipientPhoneNum = this.addressInfo.phone;
}
redeemSingleReward(params).then((res) => {
this.$message({
message: this.$t('exchange.success'),
type: 'success'
})
this.$router.push({ path: '/jiedao/jd-exchange-log' })
})
message: this.$t("exchange.success"),
type: "success",
});
this.dialogVisible = false;
this.$router.push({ path: "/jiedao/jd-exchange-log" });
});
},
getExcahngeType() {
return this.isChinese
? this.rewardDetailsInfo.pickMethodList.filter(
(res) => this.paramsInfo.redeemType === res.value
)[0].labelZh
: this.rewardDetailsInfo.pickMethodList.filter(
(res) => this.paramsInfo.redeemType === res.value
)[0].labelEn;
},
handleClose() {
this.dialogVisible = false;
},
getInfo() {
getInfo().then((r) => {
this.info = r.data;
});
},
getValidaCode() {
exchangeSMSCode({ memberId: this.$store.getters.id }).then(() => {
var countDown = window.setInterval(() => {
if (this.count < 1) {
this.count = 60
this.getCode = this.$t('login.getCode')
window.clearInterval(countDown)
this.count = 60;
this.getCode = this.$t("login.getCode");
window.clearInterval(countDown);
} else {
this.count--
this.getCode = this.count + 's'
this.count--;
this.getCode = this.count + "s";
}
}, 1000)
})
}, 1000);
});
},
handleChange() {
this.totalIntegral =
this.rewardDetailsInfo.pointsRequire * this.paramsInfo.rewardCount
this.rewardDetailsInfo.pointsRequire * this.paramsInfo.rewardCount;
},
getAddressList() {
const id = this.$store.getters.id
const id = this.$store.getters.id;
addresslist({ id }).then((r) => {
r.data.forEach((element) => {
element.isDefault === 0 ? (this.addressInfo = element) : ''
})
element.isDefault === 0 ? (this.addressInfo = element) : "";
});
if (this.addressInfo.isDefault != 0 && r.data.length > 0) {
this.addressInfo = r.data[0]
this.addressInfo = r.data[0];
}
})
});
},
getRewardsDetailsAPI() {
rewardDetails({ id: this.$route.query.id }).then((res) => {
this.rewardDetailsInfo = res.data
this.rewardDetailsInfo = res.data;
this.paramsInfo.redeemType =
this.rewardDetailsInfo.pickMethodList[0].value
this.handleChange()
})
this.rewardDetailsInfo.pickMethodList[0].value;
this.handleChange();
});
},
getPickList(label) {
return this.rewardDetailsInfo.pickMethodList
.map((item) => item[`label${label}`])
.join('/')
.join("/");
},
handleSelectAddress(id) {
addressinfo({ id }).then((res) => {
this.addressInfo = res.data
})
this.addressInfo = res.data;
});
},
goAddressManagerPage() {
if (this.paramsInfo.redeemType == '1') {
return
}
this.$router.push('/jiedao/jd-address-manager')
if (this.paramsInfo.redeemType == "1") {
return;
}
}
}
this.$router.push("/jiedao/jd-address-manager");
},
},
};
</script>
<style lang="scss" scoped>
::v-deep .headerTab .el-tabs__nav-scroll {
......@@ -313,6 +368,12 @@ export default {
width: 100%;
background: rgba(242, 242, 242, 1);
}
.codeMobile {
line-height: 40px;
padding: 0 10px;
font-size: 14px;
color: #aaaaaa;
}
::v-deep .verificationCode {
height: 40px;
display: flex;
......
......@@ -412,15 +412,15 @@
<el-select
v-if="baseEdit"
v-model="baseForm.country"
@change="getCityList"
:placeholder="$t('notices.country')"
@change="getCityList"
>
<el-option
v-for="item in countrySelectList"
:key="item.id"
:label="language == 'zh_CN' ? item.titleZh : item.titleEn"
:value="item.id"
:key="item.id"
></el-option>
/>
</el-select>
<span v-else>{{
......@@ -448,6 +448,7 @@
<el-select
v-if="baseEdit"
v-model="baseForm.city"
filterable
:placeholder="$t('notices.country')"
>
<el-option
......@@ -455,7 +456,7 @@
:key="item.id"
:label="language == 'zh_CN' ? item.titleZh : item.titleEn"
:value="item.id"
></el-option>
/>
</el-select>
<span v-else>{{
language == "zh_CN"
......@@ -521,9 +522,7 @@
>
</div>
<div v-else style="display: flex">
<div class="cancelBtn"
@click="companyHanderCancel"
>
<div class="cancelBtn" @click="companyHanderCancel">
<span
style="
font-size: 14px;
......@@ -1670,7 +1669,7 @@ export default {
countrySelectList: [],
cityList: [],
//areaCode List
// areaCode List
countryList: [],
authUserForm: {},
authUserVisible: false,
......@@ -1772,27 +1771,26 @@ export default {
this.getTradeCountryList();
},
methods: {
//获取country 接口
// 获取country 接口
getTradeCountryList() {
getTradeCountryList().then((res) => {
this.countrySelectList = res.data;
});
},
// 获取城市列表
getCityList(id, status ='edit') {
getCityList(id, status = "edit") {
getCityListByParent({ id }).then((res) => {
this.cityList = res.data;
if(status == 'edit'){
if (status == "edit") {
this.baseForm.city = "";
}
});
},
getInfo() {
getInfo().then((r) => {
this.userInfo = r.data;
this.addressForm.areaCode = this.userInfo.areaCode;
this.getCityList(r.data.country,'init');
this.getCityList(r.data.country, "init");
this.getAddressList();
});
},
......@@ -1826,7 +1824,7 @@ export default {
},
baseHanderEdit() {
this.baseEdit = true;
this.baseForm = {...this.userInfo};
this.baseForm = { ...this.userInfo };
},
baseHanderCancel() {
this.$refs.baseForm.clearValidate();
......@@ -2274,7 +2272,7 @@ export default {
</script>
<style lang="scss" scoped>
.cancelBtn{
.cancelBtn {
width: 92px;
height: 30px;
background: #5ba8dc;
......
......@@ -4,7 +4,7 @@
<img src="@/assets/login/login.png" style="width: 100%; height: 100%" />
</div>
<div class="right_back">
<div class="start-bar"></div>
<div class="start-bar" />
<el-form
ref="myInfo"
:model="params"
......@@ -50,7 +50,7 @@
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
/>
</el-select>
</el-form-item>
<el-row :gutter="20">
......@@ -82,25 +82,29 @@
<el-form-item prop="country" :label="$t('myInfo.country')">
<el-select
v-model="params.country"
@change="getCityList"
:placeholder="$t('notices.country')"
@change="getCityList"
>
<el-option
v-for="item in countryList"
:label="language == 'zh_CN' ? item.titleZh : item.titleEn"
:key="item.id"
:label="language == 'zh_CN' ? item.titleZh : item.titleEn"
:value="item.id"
></el-option>
/>
</el-select>
</el-form-item>
<el-form-item prop="city" :label="$t('myInfo.city')">
<el-select v-model="params.city" :placeholder="$t('notices.city')">
<el-select
v-model="params.city"
filterable
:placeholder="$t('notices.city')"
>
<el-option
v-for="item in cityList"
:key="item.id"
:label="language == 'zh_CN' ? item.titleZh : item.titleEn"
:value="item.id"
></el-option>
/>
</el-select>
</el-form-item>
<!-- 地址 -->
......@@ -257,9 +261,10 @@ export default {
if (!res.gender) {
this.params.gender = "2";
}
this.params.nickname = "";
});
},
//获取城市接口
// 获取城市接口
getTradeCountryList() {
getTradeCountryList().then((res) => {
this.countryList = res.data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment