Commit 6a7ffb58 authored by chenwei's avatar chenwei

Merge branch 'feature' into 'dev'

fixed defect | 501 |  APP确认兑换提交成功后,应返回兑换礼品页面,不是返回首页

See merge request !19
parents 89974f54 02ca041d
...@@ -132,7 +132,7 @@ export default { ...@@ -132,7 +132,7 @@ export default {
this.$emit('reLoad', this.form) this.$emit('reLoad', this.form)
}, },
// 搜索查询 // 搜索查询
async searchChange(e) { searchChange(e) {
this.reset() this.reset()
}, },
reset() { reset() {
......
...@@ -9,11 +9,8 @@ ...@@ -9,11 +9,8 @@
v-for="item in menu" v-for="item in menu"
:key="item.value" :key="item.value"
> >
<text <text class="header-text" :class="{ 'header-active': item.value == current }">
class="header-text" {{ locale === 'zh' ? item.labelZh : item.labelEn }}
:class="{ 'header-active': item.value == current }"
>
{{ locale === "zh" ? item.labelZh : item.labelEn }}
</text> </text>
</view> </view>
</view> </view>
...@@ -27,7 +24,7 @@ ...@@ -27,7 +24,7 @@
</view> </view>
<view class="content-info"> <view class="content-info">
<view class="info-name">{{ showAddress.name }}</view> <view class="info-name">{{ showAddress.name }}</view>
<view class="info-phone" <view class="info-phone" v-if="showAddress.areaCode"
>+{{ showAddress.areaCode }}&ensp;{{ showAddress.phone }}</view >+{{ showAddress.areaCode }}&ensp;{{ showAddress.phone }}</view
> >
</view> </view>
...@@ -42,7 +39,7 @@ ...@@ -42,7 +39,7 @@
</view> </view>
<view class="address-content address-content2"> <view class="address-content address-content2">
<view class="content-text"> <view class="content-text">
{{ locale === "zh" ? orderInfo.nodeZh : orderInfo.nodeEn }} {{ locale === 'zh' ? orderInfo.nodeZh : orderInfo.nodeEn }}
</view> </view>
</view> </view>
</view> </view>
...@@ -50,39 +47,28 @@ ...@@ -50,39 +47,28 @@
<view class="main-gift"> <view class="main-gift">
<view class="gift"> <view class="gift">
<view class="gift-image"> <view class="gift-image">
<image <image class="img" :src="locale === 'zh' ? orderInfo.imgZh : orderInfo.imgEn"></image>
class="img"
:src="locale === 'zh' ? orderInfo.imgZh : orderInfo.imgEn"
></image>
<view class="gift-tag"> <view class="gift-tag">
<view class="tags"> <view class="tags">
<image <image class="tag-image" src="../../static/img/score.png"></image>
class="tag-image"
src="../../static/img/score.png"
></image>
<view class="tag-text">{{ orderInfo.pointsRequire }}</view> <view class="tag-text">{{ orderInfo.pointsRequire }}</view>
</view> </view>
</view> </view>
<view class="foot-tag">{{ <view class="foot-tag">{{ integral.remainder(orderInfo.quantityRemain) }}</view>
integral.remainder(orderInfo.quantityRemain)
}}</view>
</view> </view>
<view class="gift-content"> <view class="gift-content">
<view class="gift-content-text">{{ <view class="gift-content-text">{{
locale === "zh" ? orderInfo.titleZh : orderInfo.titleEn locale === 'zh' ? orderInfo.titleZh : orderInfo.titleEn
}}</view> }}</view>
<view class="gift-cell"> <view class="gift-cell">
<view class="cell-label">{{ integral.redeemType }}</view> <view class="cell-label">{{ integral.redeemType }}</view>
<view class="cell-text">{{ <view class="cell-text">{{ handExchangeText(orderInfo.pickMethodList) }}</view>
handExchangeText(orderInfo.pickMethodList)
}}</view>
</view> </view>
<view class="gift-cell"> <view class="gift-cell">
<view class="cell-label">{{ integral.activityTime }}</view> <view class="cell-label">{{ integral.activityTime }}</view>
<view class="cell-text" <view class="cell-text"
>{{ orderInfo.startTime | $parseTime("{y}-{m}-{d}") >{{ orderInfo.startTime | $parseTime('{y}-{m}-{d}') }}{{ integral.to
}}{{ integral.to }}{{ orderInfo.endTime | $parseTime('{y}-{m}-{d}') }}</view
}}{{ orderInfo.endTime | $parseTime("{y}-{m}-{d}") }}</view
> >
</view> </view>
</view> </view>
...@@ -92,11 +78,8 @@ ...@@ -92,11 +78,8 @@
</view> </view>
</view> </view>
<view class="main-footer"> <view class="main-footer">
<input <view class="mobile">{{ $store.state.userInfo.mobile }}</view>
class="inp" <input class="inp" :placeholder="integral.codePlaceloader" v-model="code" />
:placeholder="integral.codePlaceloader"
v-model="code"
/>
<view class="btn" @click="handleCode">{{ <view class="btn" @click="handleCode">{{
codeTime == 0 ? integral.code : integral.codeTimeText(codeTime) codeTime == 0 ? integral.code : integral.codeTimeText(codeTime)
}}</view> }}</view>
...@@ -118,19 +101,11 @@ ...@@ -118,19 +101,11 @@
<view class="placeholder">{{ integral.textLength }}</view> <view class="placeholder">{{ integral.textLength }}</view>
</view> </view>
<view class="container-text"> <view class="container-text">
{{ integral.totalScore(num) {{ integral.totalScore(num) }}<view class="container-num">{{ total }}</view
}}<view class="container-num">{{ total }}</view
>{{ integral.totalScore1 }} >{{ integral.totalScore1 }}
</view> </view>
<view class="container-btn" @click="bindSubmitOrder">{{ <view class="container-btn" @click="bindSubmitOrder">{{ integral.orderMail }}</view>
integral.orderMail <uni-popup ref="popup" type="bottom" border-radius="10px 10px 0 0" background-color="#fff">
}}</view>
<uni-popup
ref="popup"
type="bottom"
border-radius="10px 10px 0 0"
background-color="#fff"
>
<view class="popup-list"> <view class="popup-list">
<view <view
class="popup-list-item" class="popup-list-item"
...@@ -159,16 +134,55 @@ ...@@ -159,16 +134,55 @@
<view class="text">{{ integral.addAddress }}</view> <view class="text">{{ integral.addAddress }}</view>
</view> </view>
</uni-popup> </uni-popup>
<!-- 确认提交弹窗信息 -->
<uni-popup ref="alertDialog" type="dialog">
<uni-popup-dialog
type="success"
:cancelText="$lang.lang.myInfo.cancel"
:confirmText="$lang.lang.myInfo.confirm"
:title="$lang.lang.notices.notice"
@confirm="dialogConfirm"
@close="dialogClose"
>
<view class="content">
<view
>{{ $lang.lang.integral.gift }}
{{ locale === 'zh' ? orderInfo.titleZh : orderInfo.titleEn }}
</view>
<view
>{{ $lang.lang.integral.Num }}
{{ num }}
</view>
<view
>{{ $lang.lang.integral.total }}
{{ total }}
</view>
<view
>{{ $lang.lang.integral.exchangeType }}
{{
locale === 'zh'
? orderInfo.pickMethodList[current ? current - 1 : 0].labelZh
: orderInfo.pickMethodList[current ? current - 1 : 0].labelEn
}}
</view>
<view v-if="current != 1 && addressId"
>{{ $lang.lang.integral.deliveryAddress }}
{{ showAddress.address }}
</view>
</view>
</uni-popup-dialog>
</uni-popup>
</view> </view>
</template> </template>
<script> <script>
import dHeader from "../../components/dHeader/index.vue"; import dHeader from '../../components/dHeader/index.vue'
import count from "./components/count.vue"; import count from './components/count.vue'
export default { export default {
components: { components: {
dHeader, dHeader,
count, count
}, },
data() { data() {
return { return {
...@@ -178,7 +192,7 @@ export default { ...@@ -178,7 +192,7 @@ export default {
// 数量 // 数量
num: 1, num: 1,
// 备注 // 备注
remark: "", remark: '',
// 礼品详细信息 // 礼品详细信息
orderInfo: {}, orderInfo: {},
// 礼品id // 礼品id
...@@ -193,178 +207,174 @@ export default { ...@@ -193,178 +207,174 @@ export default {
// 地址id // 地址id
addressId: null, addressId: null,
// 验证码 // 验证码
code: "", code: '',
// 验证码倒计时 // 验证码倒计时
codeTime: 0, codeTime: 0
}; }
}, },
onLoad(route) { onLoad(route) {
this.id = route.id; this.id = route.id
uni.$on("refreshPreviousPage", (params) => { uni.$on('refreshPreviousPage', (params) => {
this.bindPopup(); this.bindPopup()
}); })
this.getOrder(); this.getOrder()
}, },
onShow() { onShow() {
this.getAddress(); this.getAddress()
}, },
computed: { computed: {
locale() { locale() {
return this.$lang.locale; return this.$lang.locale
}, },
integral() { integral() {
return this.$lang.lang.integral; return this.$lang.lang.integral
}, },
// 计算总积分 // 计算总积分
total() { total() {
if (this.orderInfo.pointsRequire) { if (this.orderInfo.pointsRequire) {
return this.num * this.orderInfo.pointsRequire; return this.num * this.orderInfo.pointsRequire
} }
return 0; return 0
}, }
}, },
methods: { methods: {
// 送货类型切换 // 送货类型切换
menuChange(i) { menuChange(i) {
this.current = i; this.current = i
}, },
// 获取订单信息 礼品详情 // 获取订单信息 礼品详情
async getOrder() { async getOrder() {
try { try {
const { code, data, msg } = await this.$request.get( const { code, data, msg } = await this.$request.get('/app-api/ecw/reward/get', {
"/app-api/ecw/reward/get", id: this.id
{ })
id: this.id,
}
);
if (code === 0 && data) { if (code === 0 && data) {
console.log(data); console.log(data)
this.orderInfo = data; this.orderInfo = data
this.menu = data.pickMethodList; this.menu = data.pickMethodList
this.current = data.pickMethodList[0].value; this.current = data.pickMethodList[0].value
} else { } else {
uni.showToast({ uni.showToast({
title: msg, title: msg,
icon: "none", icon: 'none'
}); })
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error)
} }
}, },
// 获取验证码 // 获取验证码
async handleCode() { async handleCode() {
if (this.codeTime > 0) return; if (this.codeTime > 0) return
this.codeTime = 60; this.codeTime = 60
this.timer = setInterval(() => { this.timer = setInterval(() => {
this.codeTime--; this.codeTime--
if (this.codeTime <= 0) { if (this.codeTime <= 0) {
clearInterval(this.timer); clearInterval(this.timer)
} }
}, 1000); }, 1000)
try { try {
const memberId = this.$store.getters.id; const memberId = this.$store.getters.id
await this.$request.post("/app-api/reward/redeem/send-sms-code", { await this.$request.post('/app-api/reward/redeem/send-sms-code', {
memberId, memberId
}); })
} catch (error) {} } catch (error) {}
}, },
// 打开弹出层 // 打开弹出层
bindPopup() { bindPopup() {
this.$refs.popup.open(); this.$refs.popup.open()
}, },
// 获取地址列表 // 获取地址列表
async getAddress() { async getAddress() {
try { try {
const id = this.$store.getters.id; const id = this.$store.getters.id
const { code, data } = await this.$request.get( const { code, data } = await this.$request.get('/app-api/member/user-address/member/list', {
"/app-api/member/user-address/member/list", id
{ })
id, if (code !== 0) return
} this.addressList = data
);
if (code !== 0) return;
this.addressList = data;
if (this.first) { if (this.first) {
this.first = false; this.first = false
const defaultAddress = this.addressList.find( const defaultAddress = this.addressList.find((item) => item.isDefault === 0)
(item) => item.isDefault === 0
);
if (defaultAddress) { if (defaultAddress) {
this.check = defaultAddress.id; this.check = defaultAddress.id
this.addressId = defaultAddress.id; this.addressId = defaultAddress.id
this.showAddress = defaultAddress; this.showAddress = defaultAddress
} else if (this.addressList.length > 0) { } else if (this.addressList.length > 0) {
this.showAddress = this.addressList[0]; this.showAddress = this.addressList[0]
this.addressId = this.addressList[0].id; this.addressId = this.addressList[0].id
} }
} }
// this.addressChange(); // this.addressChange();
} catch (error) { } catch (error) {
console.error(error); console.error(error)
} }
}, },
// 切换默认地址 // 切换默认地址
async bindCheck(e, item) { async bindCheck(e, item) {
let that = this; let that = this
that.check = item.id; that.check = item.id
try { try {
await that.$request.post("/app-api/member/user-address/update", { await that.$request.post('/app-api/member/user-address/update', {
...item, ...item,
isDefault: 0, isDefault: 0
}); })
} catch (err) {} } catch (err) {}
}, },
// 切换地址 // 切换地址
bindAddress(id) { bindAddress(id) {
this.addressId = id; this.addressId = id
this.addressChange(); this.addressChange()
}, },
// 地址信息更改 // 地址信息更改
addressChange() { addressChange() {
const i = this.addressList.findIndex( const i = this.addressList.findIndex((item) => item.id === this.addressId)
(item) => item.id === this.addressId if (i >= 0) this.showAddress = this.addressList[i]
); this.$refs.popup.close()
if (i >= 0) this.showAddress = this.addressList[i];
this.$refs.popup.close();
}, },
// 新增地址 // 新增地址
toAddressAdd() { toAddressAdd() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/address_add/address_add", url: '/pages/address_add/address_add'
}); })
this.$refs.popup.close(); this.$refs.popup.close()
}, },
toEditAddress(id) { toEditAddress(id) {
uni.navigateTo({ uni.navigateTo({
url: "/pages/address_edit/address_edit?id=" + id, url: '/pages/address_edit/address_edit?id=' + id
}); })
this.$refs.popup.close(); this.$refs.popup.close()
}, },
// 兑换类型返回 // 兑换类型返回
handExchangeText(list) { handExchangeText(list) {
if (!list) return ""; if (!list) return ''
let str = this.locale === "zh" ? "Zh" : "En"; let str = this.locale === 'zh' ? 'Zh' : 'En'
return list.map((item) => item[`label${str}`]).join("/"); return list.map((item) => item[`label${str}`]).join('/')
}, },
// 提交订单 // 提交订单
bindSubmitOrder() { bindSubmitOrder() {
if (!this.code) { if (!this.code) {
uni.showToast({ uni.showToast({
title: this.integral.codePlaceloader, title: this.integral.codePlaceloader,
icon: "none", icon: 'none'
}); })
return; return
} }
this.$refs.alertDialog.open()
},
dialogConfirm() {
uni.showLoading({ uni.showLoading({
title: this.$lang.lang.notices.loading, title: this.$lang.lang.notices.loading
}); })
this.submitOrder(); this.submitOrder()
},
dialogClose() {
this.$refs.alertDialog.close()
}, },
// 提交订单 // 提交订单
async submitOrder() { async submitOrder() {
try { try {
const memberId = this.$store.getters.id; const memberId = this.$store.getters.id
const params = { const params = {
memberId, memberId,
code: this.code, code: this.code,
...@@ -375,29 +385,26 @@ export default { ...@@ -375,29 +385,26 @@ export default {
redeemType: this.current, redeemType: this.current,
rewardCount: this.num, rewardCount: this.num,
rewardId: this.orderInfo.id, rewardId: this.orderInfo.id,
remark: this.remark, remark: this.remark
}; }
const { code, msg } = await this.$request.post( const { code, msg } = await this.$request.post('/app-api/reward/redeem/single', params)
"/app-api/reward/redeem/single",
params
);
if (code === 0) { if (code === 0) {
uni.reLaunch({ uni.reLaunch({
url: "/pages/index/index", url: '/pages/integral/integral'
}); })
} else { } else {
uni.showToast({ uni.showToast({
title: msg, title: msg,
icon: "none", icon: 'none'
}); })
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error)
} }
uni.hideLoading(); uni.hideLoading()
}, }
}, }
}; }
</script> </script>
<style lang="scss"> <style lang="scss">
page { page {
...@@ -552,7 +559,7 @@ page { ...@@ -552,7 +559,7 @@ page {
.main-footer { .main-footer {
box-sizing: border-box; box-sizing: border-box;
font-size: 24upx; font-size: 24upx;
padding: 0 64upx; padding: 0 28upx;
width: 100%; width: 100%;
display: flex; display: flex;
height: 84upx; height: 84upx;
...@@ -654,6 +661,9 @@ page { ...@@ -654,6 +661,9 @@ page {
margin-right: 10upx; margin-right: 10upx;
} }
} }
.mobile {
color: #4f4848;
}
.popup-list-item-text { .popup-list-item-text {
min-height: 80upx; min-height: 80upx;
flex: 1; flex: 1;
......
...@@ -10,14 +10,14 @@ export default { ...@@ -10,14 +10,14 @@ export default {
pointsCampaign: 'points campaign', pointsCampaign: 'points campaign',
pointsRemark: 'Redemption points are different at different pick-up points', pointsRemark: 'Redemption points are different at different pick-up points',
outlets: 'Please select the pick-up point', outlets: 'Please select the pick-up point',
remainder: val => { remainder: (val) => {
return `剩余${val}份` return `剩余${val}份`
}, },
orderMail: 'Confirm the order', orderMail: 'Confirm the order',
code: 'Get a verification code', code: 'Get a verification code',
codePlaceloader: 'Please enter a verification code', codePlaceloader: 'Please enter a verification code',
codeError: 'The verification code is incorrect', codeError: 'The verification code is incorrect',
codeTimeText: val => { codeTimeText: (val) => {
return `${val}秒后重新获取` return `${val}秒后重新获取`
}, },
remark: 'Please enter a comment', remark: 'Please enter a comment',
...@@ -25,11 +25,16 @@ export default { ...@@ -25,11 +25,16 @@ export default {
redeemType: 'Redemption Method', redeemType: 'Redemption Method',
activityTime: 'Event time', activityTime: 'Event time',
textLength: 'Enter up to 100 words', textLength: 'Enter up to 100 words',
totalScore: num => { totalScore: (num) => {
return `已选${num}件,合计积分:` return `已选${num}件,合计积分:`
}, },
totalScore1: 'integral', totalScore1: 'integral',
addAddress: 'new address for additional shipments', addAddress: 'new address for additional shipments',
totalScoreError: 'Insufficient points', totalScoreError: 'Insufficient points',
to: 'to', to: 'to',
gift: 'gift:',
Num: 'Quantity:',
total: 'Total Score:',
exchangeType: 'Exchange Method:',
deliveryAddress: 'Delivery Address:'
} }
...@@ -10,14 +10,14 @@ export default { ...@@ -10,14 +10,14 @@ export default {
pointsCampaign: '积分活动', pointsCampaign: '积分活动',
pointsRemark: '不同提货点兑换积分不同', pointsRemark: '不同提货点兑换积分不同',
outlets: '请选择提货点', outlets: '请选择提货点',
remainder: val => { remainder: (val) => {
return `剩余${val}份` return `剩余${val}份`
}, },
orderMail: '确定订单', orderMail: '确定订单',
code: '获取验证码', code: '获取验证码',
codePlaceloader: '请输入验证码', codePlaceloader: '请输入验证码',
codeError: '验证码错误', codeError: '验证码错误',
codeTimeText: val => { codeTimeText: (val) => {
return `${val}秒后重新获取` return `${val}秒后重新获取`
}, },
remark: '请输入备注', remark: '请输入备注',
...@@ -25,11 +25,16 @@ export default { ...@@ -25,11 +25,16 @@ export default {
redeemType: '兑换方式', redeemType: '兑换方式',
activityTime: '活动时间', activityTime: '活动时间',
textLength: '最多输入100字', textLength: '最多输入100字',
totalScore: num => { totalScore: (num) => {
return `已选${num}件,合计积分:` return `已选${num}件,合计积分:`
}, },
totalScore1: '积分', totalScore1: '积分',
addAddress: '新增收货地址', addAddress: '新增收货地址',
totalScoreError: '积分不足', totalScoreError: '积分不足',
to: '', to: '',
gift: '礼品:',
Num: '数量:',
total: '合计积分:',
exchangeType: '兑换方式:',
deliveryAddress: '邮寄地址:'
} }
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