Commit 02ca041d authored by chenwei's avatar chenwei

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

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