chore:在线留言提交后,再次打开在线留言,输入框会清空上次内容
This commit is contained in:
@@ -98,8 +98,7 @@ export default {
|
|||||||
markers: [],
|
markers: [],
|
||||||
Form: {
|
Form: {
|
||||||
realname: "",
|
realname: "",
|
||||||
mobile: "",
|
mobile: ""
|
||||||
remark: ""
|
|
||||||
},
|
},
|
||||||
ismessage: 0,
|
ismessage: 0,
|
||||||
video_url: ""
|
video_url: ""
|
||||||
@@ -264,7 +263,6 @@ export default {
|
|||||||
success: (res) => {
|
success: (res) => {
|
||||||
this.$refs.informationPopup.close();
|
this.$refs.informationPopup.close();
|
||||||
this.$util.showToast({ title: res.message });
|
this.$util.showToast({ title: res.message });
|
||||||
this.resetForm();
|
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
@@ -282,15 +280,7 @@ export default {
|
|||||||
closeinformationPopup() {
|
closeinformationPopup() {
|
||||||
this.ismessage = 0;
|
this.ismessage = 0;
|
||||||
this.$refs.informationPopup.close();
|
this.$refs.informationPopup.close();
|
||||||
this.resetForm();
|
|
||||||
},
|
},
|
||||||
resetForm() {
|
|
||||||
this.Form = {
|
|
||||||
realname: "",
|
|
||||||
mobile: "",
|
|
||||||
remark: ""
|
|
||||||
};
|
|
||||||
},
|
|
||||||
Tel(phone) {
|
Tel(phone) {
|
||||||
uni.makePhoneCall({
|
uni.makePhoneCall({
|
||||||
phoneNumber: phone + "",
|
phoneNumber: phone + "",
|
||||||
|
|||||||
@@ -113,20 +113,20 @@
|
|||||||
<view class="fui-cell ">
|
<view class="fui-cell ">
|
||||||
<view class="fui-cell-label ">{{ $lang('name') }}</view>
|
<view class="fui-cell-label ">{{ $lang('name') }}</view>
|
||||||
<view class="fui-cell-info">
|
<view class="fui-cell-info">
|
||||||
<input v-model="Form.realname" class="fui-input" :placeholder="$lang('pleaseEnterName')" value=""></input>
|
<input v-model="Form.realname" class="fui-input" :placeholder="$lang('pleaseEnterName')":key="formKey" value=""></input>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="fui-cell ">
|
<view class="fui-cell ">
|
||||||
<view class="fui-cell-label">{{ $lang('contactInfo') }}</view>
|
<view class="fui-cell-label">{{ $lang('contactInfo') }}</view>
|
||||||
<view class="fui-cell-info">
|
<view class="fui-cell-info">
|
||||||
<input v-model="Form.mobile" class="fui-input" maxlength="11" :placeholder="$lang('pleaseEnterMobile')" type="number"></input>
|
<input v-model="Form.mobile" class="fui-input" maxlength="11" :placeholder="$lang('pleaseEnterMobile')" type="number":key="formKey"></input>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="fui-cell ">
|
<view class="fui-cell ">
|
||||||
<view class="fui-cell-label" style="position: absolute;top:10px">{{ $lang('messageContent') }}</view>
|
<view class="fui-cell-label" style="position: absolute;top:10px">{{ $lang('messageContent') }}</view>
|
||||||
<view class="fui-cell-info" style="margin-left: 160rpx;border: solid 2rpx #eee;">
|
<view class="fui-cell-info" style="margin-left: 160rpx;border: solid 2rpx #eee;">
|
||||||
<!-- <input v-model="Form.mailbox" class="fui-input" placeholder="请输入您的邮箱" type="text" ></input> -->
|
<!-- <input v-model="Form.mailbox" class="fui-input" placeholder="请输入您的邮箱" type="text" ></input> -->
|
||||||
<textarea class="textarea" v-model="Form.remark" :placeholder="$lang('pleaseEnterMessage')" style="font-size: 28rpx;padding: 10rpx;"></textarea>
|
<textarea class="textarea" v-model="Form.remark" :placeholder="$lang('pleaseEnterMessage')" style="font-size: 28rpx;padding: 10rpx;":key="formKey"></textarea>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -158,6 +158,7 @@ export default {
|
|||||||
remark: ''
|
remark: ''
|
||||||
|
|
||||||
},
|
},
|
||||||
|
formKey: Date.now(),
|
||||||
markers: [
|
markers: [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
@@ -222,18 +223,30 @@ export default {
|
|||||||
// window.open('https://xcx10.5g-quickapp.com/test.php')
|
// window.open('https://xcx10.5g-quickapp.com/test.php')
|
||||||
},
|
},
|
||||||
save() {
|
save() {
|
||||||
this.$api.sendRequest({
|
if (!this.Form.realname.trim()) {
|
||||||
url: '/api/member/message',
|
uni.showToast({ title: '请填写姓名', icon: 'none' });
|
||||||
data: this.Form,
|
return;
|
||||||
success: res => {
|
}
|
||||||
this.$refs.informationPopup.close();
|
if (!this.Form.mobile || !/^1[3-9]\d{9}$/.test(this.Form.mobile)) {
|
||||||
this.$util.showToast({
|
uni.showToast({ title: '手机号格式不正确', icon: 'none' });
|
||||||
title: res.message
|
return;
|
||||||
});
|
}
|
||||||
},
|
if (!this.Form.remark.trim()) {
|
||||||
fail: res => {
|
uni.showToast({ title: '请填写留言内容', icon: 'none' });
|
||||||
}
|
return;
|
||||||
});
|
}
|
||||||
|
|
||||||
|
this.$api.sendRequest({
|
||||||
|
url: '/api/member/message',
|
||||||
|
data: this.Form,
|
||||||
|
success: res => {
|
||||||
|
this.$refs.informationPopup.close();
|
||||||
|
uni.showToast({ title: res.message || '提交成功', icon: 'success' });
|
||||||
|
|
||||||
|
this.Form = { realname: '', mobile: '', remark: '' };
|
||||||
|
this.formKey = Date.now();
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
change(e) {
|
change(e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
@@ -241,8 +254,17 @@ export default {
|
|||||||
},
|
},
|
||||||
//留言打开
|
//留言打开
|
||||||
tapMessage() {
|
tapMessage() {
|
||||||
this.ismessage = 1
|
// 清空表单数据
|
||||||
this.$refs.informationPopup.open();
|
this.Form = {
|
||||||
|
realname: '',
|
||||||
|
mobile: '',
|
||||||
|
remark: ''
|
||||||
|
};
|
||||||
|
// 关键:更新 key,强制重建输入框
|
||||||
|
this.formKey = Date.now();
|
||||||
|
|
||||||
|
this.ismessage = 1;
|
||||||
|
this.$refs.informationPopup.open();
|
||||||
},
|
},
|
||||||
//留言关闭
|
//留言关闭
|
||||||
closeinformationPopup() {
|
closeinformationPopup() {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<template>
|
<template>
|
||||||
<<<<<<< HEAD
|
|
||||||
<view :style="themeColor">
|
<view :style="themeColor">
|
||||||
<mescroll-uni ref="mescroll" @getData="getData" class="member-point" :size="8" @listenRefresh="listenRefresh"
|
<mescroll-uni ref="mescroll" @getData="getData" class="member-point" :size="8" @listenRefresh="listenRefresh"
|
||||||
v-if="storeToken">
|
v-if="storeToken">
|
||||||
@@ -75,78 +74,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
=======
|
|
||||||
<view :style="themeColor">
|
|
||||||
<mescroll-uni ref="mescroll" @getData="getData" class="member-point" :size="8" @listenRefresh="listenRefresh">
|
|
||||||
<block class="goods_list" slot="list">
|
|
||||||
<block v-if="collectionList.length > 0">
|
|
||||||
<view class="goods_li margin-top" v-for="(item, index) in collectionList" :key="index"
|
|
||||||
@click.stop="toDetail(item)">
|
|
||||||
<view class="pic">
|
|
||||||
<image :src="$util.img(item.goods_image.split(',')[0], { size: 'mid' })" mode="aspectFill"
|
|
||||||
@error="goodsImageError(index)"></image>
|
|
||||||
</view>
|
|
||||||
<view class="goods_info">
|
|
||||||
<view class="goods_name font-size-base">{{ item.sku_name }}</view>
|
|
||||||
<view class="goods_opection">
|
|
||||||
<view class="left lineheight-clear ">
|
|
||||||
<text class="symbol price-style small">¥</text>
|
|
||||||
<text class="price price-style large">{{
|
|
||||||
parseFloat(item.discount_price).toFixed(2).split('.')[0] }}</text>
|
|
||||||
<text class="symbol price-style small">.{{
|
|
||||||
parseFloat(item.discount_price).toFixed(2).split('.')[1] }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="right">
|
|
||||||
<view class="cars" @click.stop="deleteItem(item.goods_id)">
|
|
||||||
<view class="icon iconfont icon-icon7"></view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</block>
|
|
||||||
<!-- 第一个列表为空时 -->
|
|
||||||
<view class="collection-empty" v-else>
|
|
||||||
<ns-empty v-if="collectionList.length == 0 && isShowEmpty" text="暂无关注的商品"
|
|
||||||
:isIndex="Boolean(storeToken)" :emptyBtn="{ text: $lang('toGoodsCategoryPage'), url: '/pages_goods/category' }"></ns-empty>
|
|
||||||
<button type="primary" size="mini" class="button mini" v-if="!storeToken"
|
|
||||||
@click="toLogin">{{ $lang('toLogin') }}</button>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<ns-goods-recommend ref="goodsRecommend"></ns-goods-recommend>
|
|
||||||
</block>
|
|
||||||
</mescroll-uni>
|
|
||||||
<ns-login ref="login"></ns-login>
|
|
||||||
<loading-cover ref="loadingCover"></loading-cover>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import common from './public/js/common.js';
|
|
||||||
import collection from './public/js/collection.js';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
mixins: [common, collection],
|
|
||||||
data() {
|
|
||||||
return {};
|
|
||||||
},
|
|
||||||
onShow() {
|
|
||||||
if (this.storeToken) {
|
|
||||||
if (this.$refs.mescroll) this.$refs.mescroll.refresh();
|
|
||||||
} else {
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.$refs.loadingCover.hide();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
storeToken: function (nVal, oVal) {
|
|
||||||
if (nVal) {
|
|
||||||
this.$refs.mescroll.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
>>>>>>> remotes/origin/dev/1.0
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user