1
This commit is contained in:
235
src/pages/client/address/components/ListPageTemp.vue
Normal file
235
src/pages/client/address/components/ListPageTemp.vue
Normal file
@ -0,0 +1,235 @@
|
||||
<template>
|
||||
<scroll-view class="list-template-wrapper" :scroll-y="!disableScroll" :refresher-enabled="true"
|
||||
:refresher-triggered="refreshTriggered" @refresherrefresh="onRefresh" @scrolltolower="onLoadMore">
|
||||
<slot name="top" />
|
||||
<view class="list-content" v-if="list.length > 0">
|
||||
<view v-for="(item, index) in list" :key="item[idKey]" :class="{ left: index % 2 === 0 }"
|
||||
class="flex-column-start news-item" @click="clickCell(item)">
|
||||
<slot style="width: 100%" name="item" :data="{
|
||||
...item,
|
||||
...listExtraFields,
|
||||
deleteSelect: !!item.deleteSelect,
|
||||
}" />
|
||||
</view>
|
||||
<uni-load-more v-if="isLoading || (!isLoading && total && total === list.length)"
|
||||
:status="isLoading ? 'loading' : 'nomore'"></uni-load-more>
|
||||
</view>
|
||||
<view v-else class="empty-container">
|
||||
<image class="home-ration" mode="widthFix" :src="emptyImage || defaultEmptyImage" />
|
||||
<text v-if="emptyText" class="empty-text">{{ emptyText }}</text>
|
||||
</view>
|
||||
<slot name="bottom" />
|
||||
|
||||
</scroll-view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "ListPageTemp",
|
||||
props: {
|
||||
getDataPromise: {
|
||||
type: Function,
|
||||
},
|
||||
// 格式化请求结果的方法
|
||||
resultFormatFunc: {
|
||||
type: Function,
|
||||
},
|
||||
requestData: {
|
||||
defult: () => { },
|
||||
type: Object,
|
||||
},
|
||||
// 列表元素额外字段
|
||||
listExtraFields: {
|
||||
type: Object,
|
||||
default: () => { },
|
||||
},
|
||||
reloadFlag: {
|
||||
default: 0,
|
||||
type: Number,
|
||||
},
|
||||
// 是否分页
|
||||
isPagiantion: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
// 分页数量, 不分页时有效
|
||||
pageSize: {
|
||||
type: Number,
|
||||
default: 999,
|
||||
},
|
||||
defaultList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
disableScroll: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
idKey: {
|
||||
type: String,
|
||||
default: "id",
|
||||
},
|
||||
// 占位图片地址
|
||||
emptyImage: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
// 空状态文本(传入时才显示)
|
||||
emptyText: {
|
||||
type: String,
|
||||
default: "",
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
total: 0,
|
||||
list: [],
|
||||
refreshTriggered: false,
|
||||
p: 1,
|
||||
num: 10,
|
||||
defaultEmptyImage: 'https://activity.wagoo.live/empty.png', // 默认占位图片
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
reloadFlag: {
|
||||
handler(value) {
|
||||
if (value) {
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
requestData: {
|
||||
handler(data) {
|
||||
if (data) {
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
defaultList: {
|
||||
handler(list) {
|
||||
this.list = list;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onRefresh() {
|
||||
if (this.refreshTriggered) return;
|
||||
this.refreshTriggered = true;
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
// this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
},
|
||||
|
||||
onLoadMore() {
|
||||
if (!this.isPagiantion) {
|
||||
return;
|
||||
}
|
||||
if (!this.isLoading && this.total > this.list.length) {
|
||||
this.p++;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
clickCell(item) {
|
||||
this.$emit("clickCell", item);
|
||||
},
|
||||
getList() {
|
||||
if (this.isLoading) return;
|
||||
this.isLoading = true;
|
||||
|
||||
// TODO: 删除测试数据
|
||||
if (!this.getDataPromise) {
|
||||
this.list = [0, 1, 2, 3, 4, 5, 6].map((v, k) => {
|
||||
return {
|
||||
title: "消息名称0000sssss撒大苏打大苏打" + v,
|
||||
id: k,
|
||||
len: 10,
|
||||
};
|
||||
});
|
||||
this.total = 9;
|
||||
this.isLoading = false;
|
||||
this.refreshTriggered = false;
|
||||
uni.stopPullDownRefresh();
|
||||
return;
|
||||
}
|
||||
|
||||
const data = Object.assign(
|
||||
{},
|
||||
{ p: this.p, num: !this.isPagiantion ? this.pageSize : this.num },
|
||||
this.requestData
|
||||
);
|
||||
this.getDataPromise(data)
|
||||
.then((res) => {
|
||||
const list =
|
||||
this.p === 1
|
||||
? res?.data || []
|
||||
: [...this.list, ...(res?.data || [])];
|
||||
this.list = this.resultFormatFunc
|
||||
? this.resultFormatFunc(list)
|
||||
: list;
|
||||
this.total = res?.count || 0;
|
||||
this.$emit("getList", this.list, res);
|
||||
// console.log(this.list,'???')
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false;
|
||||
this.refreshTriggered = false;
|
||||
uni.stopPullDownRefresh();
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.list-template-wrapper {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
.list-content {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.news-item {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.empty-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 400rpx auto 0;
|
||||
padding: 0 40rpx;
|
||||
}
|
||||
|
||||
.home-ration {
|
||||
width: 160px;
|
||||
height: 174px;
|
||||
display: block;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -38,11 +38,13 @@
|
||||
<script>
|
||||
import AddressItem from "./components/AddressItem.vue";
|
||||
import PopUpModal from "../../../components/PopUpModal.vue";
|
||||
import ListPageTemp from "./components/ListPageTemp.vue";
|
||||
import { delAddress, getAddressList } from "../../../api/address";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
AddressItem,
|
||||
ListPageTemp,
|
||||
PopUpModal,
|
||||
},
|
||||
data() {
|
||||
|
||||
@ -4,10 +4,10 @@
|
||||
<image class="login-ground-img" :src="`${imgPrefix}loginGroundImg.png`" mode="widthFix" />
|
||||
<view class="btnConent">
|
||||
<button v-show="!checked" class="loginBtn" @click="unCheckAndGetPhoneNumber">
|
||||
手机快捷登录
|
||||
抖音用户信息授权登录
|
||||
</button>
|
||||
<button v-show="checked" class="loginBtn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
|
||||
手机快捷登录
|
||||
<button v-show="checked" class="loginBtn" @tap="getPhoneNumber" >
|
||||
抖音用户信息授权登录
|
||||
</button>
|
||||
<view class="notLoginBtn" @click="goBack">
|
||||
暂不登录
|
||||
@ -49,8 +49,12 @@ export default {
|
||||
imgPrefix,
|
||||
checked: false,
|
||||
uncheckMessageDialog: false,
|
||||
yaoqing_code: ''
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
this.yaoqing_code = options.yaoqing_code
|
||||
},
|
||||
mounted() { },
|
||||
methods: {
|
||||
ptfwxy() {
|
||||
@ -68,35 +72,6 @@ export default {
|
||||
});
|
||||
},
|
||||
changeChecked() {
|
||||
uni.requestSubscribeMessage({
|
||||
tmplIds: ['QoTeQwj4xw2UQMK5jI67MzAVOo6og76oqZ7BDIJW7cE', 'GPWlTkaNbi7JqvxltLKuZZMtKedSZfEKlirV7yOUu-0'],// TEMPLATE_ID替换为选用的模版id
|
||||
success(res) {
|
||||
uni.hideLoading()
|
||||
if (res['QoTeQwj4xw2UQMK5jI67MzAVOo6og76oqZ7BDIJW7cE'] === 'accept') {
|
||||
// setSubscribeStatus(true, '已订阅')
|
||||
uni.showToast({
|
||||
title: '订阅成功',
|
||||
icon: 'success',
|
||||
})
|
||||
}
|
||||
if (res['GPWlTkaNbi7JqvxltLKuZZMtKedSZfEKlirV7yOUu-0'] === 'accept') {
|
||||
// setSubscribeStatus(true, '已订阅')
|
||||
uni.showToast({
|
||||
title: '订阅成功',
|
||||
icon: 'success',
|
||||
})
|
||||
}
|
||||
},
|
||||
fail() {
|
||||
uni.showToast({
|
||||
title: '订阅失败',
|
||||
icon: 'error',
|
||||
})
|
||||
},
|
||||
complete: () => {
|
||||
// isSubscribing = false
|
||||
},
|
||||
})
|
||||
this.checked = !this.checked;
|
||||
},
|
||||
unCheckAndGetPhoneNumber() {
|
||||
@ -106,78 +81,121 @@ export default {
|
||||
duration: 2000
|
||||
});
|
||||
},
|
||||
async getPhoneNumber(e) {
|
||||
// console.log(e,'?')
|
||||
// return
|
||||
// 检查是否有 code
|
||||
if (!e.detail.code) {
|
||||
uni.showToast({
|
||||
title: "获取手机号失败,请重试",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showLoading({
|
||||
title: "获取手机号中...",
|
||||
icon: "none",
|
||||
mask: true,
|
||||
});
|
||||
|
||||
try {
|
||||
// 登录前先记录是否有邀请码(referrerID),用于登录后导航判断
|
||||
const hasReferrer =
|
||||
this.$store.state?.user && this.$store.state.user.referrerID;
|
||||
// 拿着code获取手机号
|
||||
const codeRes = await getPhone(e.detail.code);
|
||||
const phone = codeRes?.data?.phoneNumber || "";
|
||||
|
||||
if (!phone) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: "获取手机号失败,请重试",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
getmembeInfo(nickName,avatarUrl) {
|
||||
const inviteCode = this.yaoqing_code ? this.yaoqing_code : getApp().globalData.inviteCode
|
||||
uni.showLoading({
|
||||
title: "登录中...",
|
||||
icon: "none",
|
||||
mask: true,
|
||||
});
|
||||
|
||||
// 手机号登录
|
||||
login(phone)
|
||||
.then((res) => {
|
||||
uni.hideLoading();
|
||||
this.$store.dispatch("user/setToken", res?.data?.token || "");
|
||||
this.$store.dispatch("user/setUserInfo", res?.data || {});
|
||||
|
||||
// 如果是带邀请码(referrerID)的登录,统一跳转到首页
|
||||
if (hasReferrer) {
|
||||
uni.reLaunch({
|
||||
url: "/pages/client/index/index",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
var pages = getCurrentPages();
|
||||
if (pages.length === 1) {
|
||||
uni.reLaunch({
|
||||
url: "/pages/client/index/index",
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.navigateBack();
|
||||
})
|
||||
.catch((err) => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: err || "登录失败,请重试",
|
||||
icon: "none",
|
||||
login(nickName,avatarUrl).then((res) => {
|
||||
uni.hideLoading()
|
||||
this.$store.dispatch("user/setToken", res?.data?.token || "");
|
||||
this.$store.dispatch("user/setUserInfo", res?.data || {});
|
||||
var pages = getCurrentPages();
|
||||
console.log(pages,'sssss')
|
||||
if (inviteCode) {
|
||||
uni.reLaunch({
|
||||
url: "/pages/client/index/index",
|
||||
});
|
||||
return
|
||||
}
|
||||
if (pages.length === 1) {
|
||||
uni.reLaunch({
|
||||
url: "/pages/client/index/index",
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.navigateBack();
|
||||
}).catch((err) => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: err || "登录失败,请重试",
|
||||
icon: "none",
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
},
|
||||
// login( this.nickName, this.avatarUrl).then((res) => {
|
||||
// uni.hideLoading()
|
||||
// this.$store.dispatch("user/setToken", res?.data?.token || "");
|
||||
// this.$store.dispatch("user/setUserInfo", res?.data || {});
|
||||
// var pages = getCurrentPages();
|
||||
// if (inviteCode) {
|
||||
// uni.reLaunch({
|
||||
// url: "/pages/client/index/index",
|
||||
// });
|
||||
// return
|
||||
// }
|
||||
// if (pages.length === 1) {
|
||||
// uni.reLaunch({
|
||||
// url: "/pages/client/index/index",
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
// uni.navigateBack();
|
||||
// }).catch((err) => {
|
||||
// uni.hideLoading();
|
||||
// uni.showToast({
|
||||
// title: err || "登录失败,请重试",
|
||||
// icon: "none",
|
||||
// });
|
||||
// }),
|
||||
async getPhoneNumber(e) {
|
||||
// console.log(e,'?')
|
||||
// return
|
||||
// 检查是否有 code
|
||||
// if (!e.detail.code) {
|
||||
// uni.showToast({
|
||||
// title: "获取手机号失败,请重试",
|
||||
// icon: "none",
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
|
||||
// uni.showLoading({
|
||||
// title: "获取手机号中...",
|
||||
// icon: "none",
|
||||
// mask: true,
|
||||
// });
|
||||
|
||||
try {
|
||||
let that = this
|
||||
tt.getUserProfile({
|
||||
|
||||
success(res) {
|
||||
console.log(res,'???')
|
||||
// this.nickName = res.res.userInfo.nickName
|
||||
// this.avatarUrl = res.userInfo.avatarUrl
|
||||
that.getmembeInfo(res.userInfo.nickName,res.userInfo.avatarUrl)
|
||||
// console.log(res,'--=')
|
||||
},
|
||||
fail(res) {
|
||||
console.log("getUserProfile 调用失败", res);
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
|
||||
// const inviteCode = this.yaoqing_code ? this.yaoqing_code : getApp().globalData.inviteCode
|
||||
// console.log('获取到邀请码----->', inviteCode)
|
||||
// 手机号登录
|
||||
|
||||
// 拿着code获取手机号
|
||||
// const codeRes = await getPhone(e.detail.code);
|
||||
// const phone = codeRes?.data?.phoneNumber || "";
|
||||
|
||||
// if (!phone) {
|
||||
// uni.hideLoading();
|
||||
// uni.showToast({
|
||||
// title: "获取手机号失败,请重试",
|
||||
// icon: "none",
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
console.error("获取手机号失败:", error);
|
||||
@ -215,10 +233,6 @@ export default {
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 登录前先记录是否有邀请码(referrerID),用于登录后导航判断
|
||||
const hasReferrer =
|
||||
this.$store.state?.user && this.$store.state.user.referrerID;
|
||||
|
||||
uni.showLoading({
|
||||
title: "加载中...",
|
||||
icon: "none",
|
||||
@ -228,15 +242,6 @@ export default {
|
||||
.then((res) => {
|
||||
this.$store.dispatch("user/setToken", res?.data?.token || "");
|
||||
this.$store.dispatch("user/setUserInfo", res?.data || {});
|
||||
|
||||
// 如果是带邀请码(referrerID)的登录,统一跳转到首页
|
||||
if (hasReferrer) {
|
||||
uni.reLaunch({
|
||||
url: "/pages/client/index/index",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
var pages = getCurrentPages();
|
||||
if (pages.length === 1) {
|
||||
uni.reLaunch({
|
||||
|
||||
235
src/pages/client/cart/components/ListPageTemp.vue
Normal file
235
src/pages/client/cart/components/ListPageTemp.vue
Normal file
@ -0,0 +1,235 @@
|
||||
<template>
|
||||
<scroll-view class="list-template-wrapper" :scroll-y="!disableScroll" :refresher-enabled="true"
|
||||
:refresher-triggered="refreshTriggered" @refresherrefresh="onRefresh" @scrolltolower="onLoadMore">
|
||||
<slot name="top" />
|
||||
<view class="list-content" v-if="list.length > 0">
|
||||
<view v-for="(item, index) in list" :key="item[idKey]" :class="{ left: index % 2 === 0 }"
|
||||
class="flex-column-start news-item" @click="clickCell(item)">
|
||||
<slot style="width: 100%" name="item" :data="{
|
||||
...item,
|
||||
...listExtraFields,
|
||||
deleteSelect: !!item.deleteSelect,
|
||||
}" />
|
||||
</view>
|
||||
<uni-load-more v-if="isLoading || (!isLoading && total && total === list.length)"
|
||||
:status="isLoading ? 'loading' : 'nomore'"></uni-load-more>
|
||||
</view>
|
||||
<view v-else class="empty-container">
|
||||
<image class="home-ration" mode="widthFix" :src="emptyImage || defaultEmptyImage" />
|
||||
<text v-if="emptyText" class="empty-text">{{ emptyText }}</text>
|
||||
</view>
|
||||
<slot name="bottom" />
|
||||
|
||||
</scroll-view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "ListPageTemp",
|
||||
props: {
|
||||
getDataPromise: {
|
||||
type: Function,
|
||||
},
|
||||
// 格式化请求结果的方法
|
||||
resultFormatFunc: {
|
||||
type: Function,
|
||||
},
|
||||
requestData: {
|
||||
defult: () => { },
|
||||
type: Object,
|
||||
},
|
||||
// 列表元素额外字段
|
||||
listExtraFields: {
|
||||
type: Object,
|
||||
default: () => { },
|
||||
},
|
||||
reloadFlag: {
|
||||
default: 0,
|
||||
type: Number,
|
||||
},
|
||||
// 是否分页
|
||||
isPagiantion: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
// 分页数量, 不分页时有效
|
||||
pageSize: {
|
||||
type: Number,
|
||||
default: 999,
|
||||
},
|
||||
defaultList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
disableScroll: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
idKey: {
|
||||
type: String,
|
||||
default: "id",
|
||||
},
|
||||
// 占位图片地址
|
||||
emptyImage: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
// 空状态文本(传入时才显示)
|
||||
emptyText: {
|
||||
type: String,
|
||||
default: "",
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
total: 0,
|
||||
list: [],
|
||||
refreshTriggered: false,
|
||||
p: 1,
|
||||
num: 10,
|
||||
defaultEmptyImage: 'https://activity.wagoo.live/empty.png', // 默认占位图片
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
reloadFlag: {
|
||||
handler(value) {
|
||||
if (value) {
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
requestData: {
|
||||
handler(data) {
|
||||
if (data) {
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
defaultList: {
|
||||
handler(list) {
|
||||
this.list = list;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onRefresh() {
|
||||
if (this.refreshTriggered) return;
|
||||
this.refreshTriggered = true;
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
// this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
},
|
||||
|
||||
onLoadMore() {
|
||||
if (!this.isPagiantion) {
|
||||
return;
|
||||
}
|
||||
if (!this.isLoading && this.total > this.list.length) {
|
||||
this.p++;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
clickCell(item) {
|
||||
this.$emit("clickCell", item);
|
||||
},
|
||||
getList() {
|
||||
if (this.isLoading) return;
|
||||
this.isLoading = true;
|
||||
|
||||
// TODO: 删除测试数据
|
||||
if (!this.getDataPromise) {
|
||||
this.list = [0, 1, 2, 3, 4, 5, 6].map((v, k) => {
|
||||
return {
|
||||
title: "消息名称0000sssss撒大苏打大苏打" + v,
|
||||
id: k,
|
||||
len: 10,
|
||||
};
|
||||
});
|
||||
this.total = 9;
|
||||
this.isLoading = false;
|
||||
this.refreshTriggered = false;
|
||||
uni.stopPullDownRefresh();
|
||||
return;
|
||||
}
|
||||
|
||||
const data = Object.assign(
|
||||
{},
|
||||
{ p: this.p, num: !this.isPagiantion ? this.pageSize : this.num },
|
||||
this.requestData
|
||||
);
|
||||
this.getDataPromise(data)
|
||||
.then((res) => {
|
||||
const list =
|
||||
this.p === 1
|
||||
? res?.data || []
|
||||
: [...this.list, ...(res?.data || [])];
|
||||
this.list = this.resultFormatFunc
|
||||
? this.resultFormatFunc(list)
|
||||
: list;
|
||||
this.total = res?.count || 0;
|
||||
this.$emit("getList", this.list, res);
|
||||
// console.log(this.list,'???')
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false;
|
||||
this.refreshTriggered = false;
|
||||
uni.stopPullDownRefresh();
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.list-template-wrapper {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
.list-content {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.news-item {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.empty-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 400rpx auto 0;
|
||||
padding: 0 40rpx;
|
||||
}
|
||||
|
||||
.home-ration {
|
||||
width: 160px;
|
||||
height: 174px;
|
||||
display: block;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -51,7 +51,7 @@
|
||||
|
||||
<script>
|
||||
import CartItem from "./components/CartItem.vue";
|
||||
import ListPageTemp from "@/components/ListPageTemp.vue";
|
||||
import ListPageTemp from "./components/ListPageTemp.vue";
|
||||
|
||||
import {
|
||||
getCartList,
|
||||
|
||||
235
src/pages/client/coupon/ListPageTemp.vue
Normal file
235
src/pages/client/coupon/ListPageTemp.vue
Normal file
@ -0,0 +1,235 @@
|
||||
<template>
|
||||
<scroll-view class="list-template-wrapper" :scroll-y="!disableScroll" :refresher-enabled="true"
|
||||
:refresher-triggered="refreshTriggered" @refresherrefresh="onRefresh" @scrolltolower="onLoadMore">
|
||||
<slot name="top" />
|
||||
<view class="list-content" v-if="list.length > 0">
|
||||
<view v-for="(item, index) in list" :key="item[idKey]" :class="{ left: index % 2 === 0 }"
|
||||
class="flex-column-start news-item" @click="clickCell(item)">
|
||||
<slot style="width: 100%" name="item" :data="{
|
||||
...item,
|
||||
...listExtraFields,
|
||||
deleteSelect: !!item.deleteSelect,
|
||||
}" />
|
||||
</view>
|
||||
<uni-load-more v-if="isLoading || (!isLoading && total && total === list.length)"
|
||||
:status="isLoading ? 'loading' : 'nomore'"></uni-load-more>
|
||||
</view>
|
||||
<view v-else class="empty-container">
|
||||
<image class="home-ration" mode="widthFix" :src="emptyImage || defaultEmptyImage" />
|
||||
<text v-if="emptyText" class="empty-text">{{ emptyText }}</text>
|
||||
</view>
|
||||
<slot name="bottom" />
|
||||
|
||||
</scroll-view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "ListPageTemp",
|
||||
props: {
|
||||
getDataPromise: {
|
||||
type: Function,
|
||||
},
|
||||
// 格式化请求结果的方法
|
||||
resultFormatFunc: {
|
||||
type: Function,
|
||||
},
|
||||
requestData: {
|
||||
defult: () => { },
|
||||
type: Object,
|
||||
},
|
||||
// 列表元素额外字段
|
||||
listExtraFields: {
|
||||
type: Object,
|
||||
default: () => { },
|
||||
},
|
||||
reloadFlag: {
|
||||
default: 0,
|
||||
type: Number,
|
||||
},
|
||||
// 是否分页
|
||||
isPagiantion: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
// 分页数量, 不分页时有效
|
||||
pageSize: {
|
||||
type: Number,
|
||||
default: 999,
|
||||
},
|
||||
defaultList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
disableScroll: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
idKey: {
|
||||
type: String,
|
||||
default: "id",
|
||||
},
|
||||
// 占位图片地址
|
||||
emptyImage: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
// 空状态文本(传入时才显示)
|
||||
emptyText: {
|
||||
type: String,
|
||||
default: "",
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
total: 0,
|
||||
list: [],
|
||||
refreshTriggered: false,
|
||||
p: 1,
|
||||
num: 10,
|
||||
defaultEmptyImage: 'https://activity.wagoo.live/empty.png', // 默认占位图片
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
reloadFlag: {
|
||||
handler(value) {
|
||||
if (value) {
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
requestData: {
|
||||
handler(data) {
|
||||
if (data) {
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
defaultList: {
|
||||
handler(list) {
|
||||
this.list = list;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onRefresh() {
|
||||
if (this.refreshTriggered) return;
|
||||
this.refreshTriggered = true;
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
// this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
},
|
||||
|
||||
onLoadMore() {
|
||||
if (!this.isPagiantion) {
|
||||
return;
|
||||
}
|
||||
if (!this.isLoading && this.total > this.list.length) {
|
||||
this.p++;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
clickCell(item) {
|
||||
this.$emit("clickCell", item);
|
||||
},
|
||||
getList() {
|
||||
if (this.isLoading) return;
|
||||
this.isLoading = true;
|
||||
|
||||
// TODO: 删除测试数据
|
||||
if (!this.getDataPromise) {
|
||||
this.list = [0, 1, 2, 3, 4, 5, 6].map((v, k) => {
|
||||
return {
|
||||
title: "消息名称0000sssss撒大苏打大苏打" + v,
|
||||
id: k,
|
||||
len: 10,
|
||||
};
|
||||
});
|
||||
this.total = 9;
|
||||
this.isLoading = false;
|
||||
this.refreshTriggered = false;
|
||||
uni.stopPullDownRefresh();
|
||||
return;
|
||||
}
|
||||
|
||||
const data = Object.assign(
|
||||
{},
|
||||
{ p: this.p, num: !this.isPagiantion ? this.pageSize : this.num },
|
||||
this.requestData
|
||||
);
|
||||
this.getDataPromise(data)
|
||||
.then((res) => {
|
||||
const list =
|
||||
this.p === 1
|
||||
? res?.data || []
|
||||
: [...this.list, ...(res?.data || [])];
|
||||
this.list = this.resultFormatFunc
|
||||
? this.resultFormatFunc(list)
|
||||
: list;
|
||||
this.total = res?.count || 0;
|
||||
this.$emit("getList", this.list, res);
|
||||
// console.log(this.list,'???')
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false;
|
||||
this.refreshTriggered = false;
|
||||
uni.stopPullDownRefresh();
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.list-template-wrapper {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
.list-content {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.news-item {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.empty-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 400rpx auto 0;
|
||||
padding: 0 40rpx;
|
||||
}
|
||||
|
||||
.home-ration {
|
||||
width: 160px;
|
||||
height: 174px;
|
||||
display: block;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -18,7 +18,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ListPageTemp from "@/components/ListPageTemp";
|
||||
import ListPageTemp from "./ListPageTemp";
|
||||
import CouponItem from "@/components/coupon/CouponItem";
|
||||
import { getCouponData, receiveCoupon } from "@/api/coupon";
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
<script>
|
||||
import TabsList from "@/components/TabsList.vue";
|
||||
import ListPageTemp from "@/components/ListPageTemp.vue";
|
||||
import ListPageTemp from "./ListPageTemp.vue";
|
||||
import ServiceCouponItem from "@/components/coupon/ServiceCouponItem";
|
||||
|
||||
import { getMyServiceCouponList } from "@/api/coupon";
|
||||
|
||||
@ -62,21 +62,21 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="line" />
|
||||
<view class="itemWrapper" @click="toDogTraining">
|
||||
<text class="titlWrapper">狗狗训练</text>
|
||||
<view class="content">上门服务</view>
|
||||
<view class="tips">上门训犬、寄养、喂猫、遛狗</view>
|
||||
<view class="itemWrapper" @click="toPublicBenefit">
|
||||
<text class="titlWrapper">关爱宠物,传递温情</text>
|
||||
<view class="content">公益助力</view>
|
||||
<view class="tips">帮我找个家</view>
|
||||
<view class="itemImg">
|
||||
<image class="menu-img-sm" :src="`${imgPrefix}home-dogTraining.png`" mode="aspectFill" />
|
||||
<image class="menu-img-sm" :src="`${imgPrefix}h-public.png`" mode="aspectFill" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="secondMenu">
|
||||
<scroll-view class="scrollWrapper" :scroll-x="secondMenuItemList.length > 4" enable-flex
|
||||
<scroll-view class="scrollWrapper" scroll-x enable-flex
|
||||
:scroll-with-animation="false"
|
||||
@scroll="onSecondMenuScroll">
|
||||
<view class="secondMenuInner" :class="{ 'no-scroll': secondMenuItemList.length <= 4 }">
|
||||
<view class="secondMenuInner">
|
||||
<view class="itemWrapper" v-for="(item, i) in secondMenuItemList" :key="i"
|
||||
@click="handleNav(item)">
|
||||
<view class="imgWrapper">
|
||||
@ -92,19 +92,19 @@
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<view class="custom-indicator" v-if="secondMenuItemList.length > 4">
|
||||
<view class="custom-indicator">
|
||||
<view class="itemLine" :class="{ active: secondMenuIndicatorIndex === 0 }"></view>
|
||||
<view class="itemLine" :class="{ active: secondMenuIndicatorIndex === 1 }"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="thirdMenu">
|
||||
<view class="itemWrapper" @click="toPublicBenefit">
|
||||
<view class="itemWrapper" @click="toDogTraining">
|
||||
<view>
|
||||
<view class="title">公益助力</view>
|
||||
<view class="tips">帮我找个家</view>
|
||||
<view class="title">上门服务</view>
|
||||
<view class="tips">训犬寄养、喂猫遛狗</view>
|
||||
</view>
|
||||
<image class="third-icon" :src="`${imgPrefix}home-publicBenefit.png`" mode="aspectFill" />
|
||||
<image class="third-icon1" :src="`${imgPrefix}h-door.png`" mode="aspectFill" />
|
||||
</view>
|
||||
<view class="itemWrapper" @click="toJoin">
|
||||
<view>
|
||||
@ -188,6 +188,11 @@ export default {
|
||||
img: `${imgPrefix}home-openVip.png`,
|
||||
naviUrl: "/pages/richText/member-interests"
|
||||
},
|
||||
{
|
||||
title: "健康顾问",
|
||||
tips: "宠物健康智能助手",
|
||||
img: `${imgPrefix}healthConsultant.png`,
|
||||
},
|
||||
],
|
||||
walletInfo: {}, // 钱包信息
|
||||
secondMenuIndicatorIndex: 0, // 第二排菜单指示器当前页 0=第一页 1=第二页
|
||||
@ -245,9 +250,14 @@ export default {
|
||||
});
|
||||
},
|
||||
toDogTraining() {
|
||||
uni.navigateTo({
|
||||
url: '/pageHome/service/index'
|
||||
});
|
||||
uni.showToast({
|
||||
title: '敬请期待',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
// uni.navigateTo({
|
||||
// url: '/pageHome/service/index'
|
||||
// });
|
||||
},
|
||||
// 我的钱包
|
||||
buyService() {
|
||||
@ -375,8 +385,13 @@ export default {
|
||||
}
|
||||
|
||||
.menu-img-sm {
|
||||
width: 120rpx;
|
||||
height: 164rpx;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
}
|
||||
.third-icon1{
|
||||
width: 96rpx;
|
||||
height: 120rpx;
|
||||
|
||||
}
|
||||
|
||||
.second-icon,
|
||||
@ -601,13 +616,9 @@ export default {
|
||||
|
||||
.scrollWrapper {
|
||||
width: 100%;
|
||||
height: auto; /* 由内容撑开;小程序 scroll-view 横向滚动时默认可能不随内容计算高度 */
|
||||
min-height: 220rpx; /* 兜底:约等于 padding-top + 图标 + 标题 + 副标题 */
|
||||
display: flex;
|
||||
align-items: flex-start; /* 不拉伸子项,高度由内容决定 */
|
||||
white-space: nowrap;
|
||||
padding-top: 24rpx;
|
||||
padding-bottom: 24rpx;
|
||||
padding: 32rpx 0 20rpx 0;
|
||||
box-sizing: border-box;
|
||||
|
||||
.secondMenuInner {
|
||||
@ -615,16 +626,6 @@ export default {
|
||||
flex-wrap: nowrap;
|
||||
flex-shrink: 0;
|
||||
width: 937.5rpx; /* 5 * 187.5 一屏4个共5项 */
|
||||
|
||||
&.no-scroll {
|
||||
width: 100%; /* 四项时一屏排满,不滚动 */
|
||||
|
||||
.itemWrapper {
|
||||
flex: 1;
|
||||
width: 0; /* 均分宽度,避免被 menuBody padding 裁切 */
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.itemWrapper {
|
||||
@ -653,7 +654,7 @@ export default {
|
||||
|
||||
.custom-indicator {
|
||||
display: flex;
|
||||
margin-top: 12rpx;
|
||||
margin-top:-150rpx;
|
||||
justify-content: center;
|
||||
margin-bottom: 20rpx;
|
||||
gap: 12rpx;
|
||||
|
||||
235
src/pages/client/news/components/ListPageTemp.vue
Normal file
235
src/pages/client/news/components/ListPageTemp.vue
Normal file
@ -0,0 +1,235 @@
|
||||
<template>
|
||||
<scroll-view class="list-template-wrapper" :scroll-y="!disableScroll" :refresher-enabled="true"
|
||||
:refresher-triggered="refreshTriggered" @refresherrefresh="onRefresh" @scrolltolower="onLoadMore">
|
||||
<slot name="top" />
|
||||
<view class="list-content" v-if="list.length > 0">
|
||||
<view v-for="(item, index) in list" :key="item[idKey]" :class="{ left: index % 2 === 0 }"
|
||||
class="flex-column-start news-item" @click="clickCell(item)">
|
||||
<slot style="width: 100%" name="item" :data="{
|
||||
...item,
|
||||
...listExtraFields,
|
||||
deleteSelect: !!item.deleteSelect,
|
||||
}" />
|
||||
</view>
|
||||
<uni-load-more v-if="isLoading || (!isLoading && total && total === list.length)"
|
||||
:status="isLoading ? 'loading' : 'nomore'"></uni-load-more>
|
||||
</view>
|
||||
<view v-else class="empty-container">
|
||||
<image class="home-ration" mode="widthFix" :src="emptyImage || defaultEmptyImage" />
|
||||
<text v-if="emptyText" class="empty-text">{{ emptyText }}</text>
|
||||
</view>
|
||||
<slot name="bottom" />
|
||||
|
||||
</scroll-view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "ListPageTemp",
|
||||
props: {
|
||||
getDataPromise: {
|
||||
type: Function,
|
||||
},
|
||||
// 格式化请求结果的方法
|
||||
resultFormatFunc: {
|
||||
type: Function,
|
||||
},
|
||||
requestData: {
|
||||
defult: () => { },
|
||||
type: Object,
|
||||
},
|
||||
// 列表元素额外字段
|
||||
listExtraFields: {
|
||||
type: Object,
|
||||
default: () => { },
|
||||
},
|
||||
reloadFlag: {
|
||||
default: 0,
|
||||
type: Number,
|
||||
},
|
||||
// 是否分页
|
||||
isPagiantion: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
// 分页数量, 不分页时有效
|
||||
pageSize: {
|
||||
type: Number,
|
||||
default: 999,
|
||||
},
|
||||
defaultList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
disableScroll: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
idKey: {
|
||||
type: String,
|
||||
default: "id",
|
||||
},
|
||||
// 占位图片地址
|
||||
emptyImage: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
// 空状态文本(传入时才显示)
|
||||
emptyText: {
|
||||
type: String,
|
||||
default: "",
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
total: 0,
|
||||
list: [],
|
||||
refreshTriggered: false,
|
||||
p: 1,
|
||||
num: 10,
|
||||
defaultEmptyImage: 'https://activity.wagoo.live/empty.png', // 默认占位图片
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
reloadFlag: {
|
||||
handler(value) {
|
||||
if (value) {
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
requestData: {
|
||||
handler(data) {
|
||||
if (data) {
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
defaultList: {
|
||||
handler(list) {
|
||||
this.list = list;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onRefresh() {
|
||||
if (this.refreshTriggered) return;
|
||||
this.refreshTriggered = true;
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
// this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
},
|
||||
|
||||
onLoadMore() {
|
||||
if (!this.isPagiantion) {
|
||||
return;
|
||||
}
|
||||
if (!this.isLoading && this.total > this.list.length) {
|
||||
this.p++;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
clickCell(item) {
|
||||
this.$emit("clickCell", item);
|
||||
},
|
||||
getList() {
|
||||
if (this.isLoading) return;
|
||||
this.isLoading = true;
|
||||
|
||||
// TODO: 删除测试数据
|
||||
if (!this.getDataPromise) {
|
||||
this.list = [0, 1, 2, 3, 4, 5, 6].map((v, k) => {
|
||||
return {
|
||||
title: "消息名称0000sssss撒大苏打大苏打" + v,
|
||||
id: k,
|
||||
len: 10,
|
||||
};
|
||||
});
|
||||
this.total = 9;
|
||||
this.isLoading = false;
|
||||
this.refreshTriggered = false;
|
||||
uni.stopPullDownRefresh();
|
||||
return;
|
||||
}
|
||||
|
||||
const data = Object.assign(
|
||||
{},
|
||||
{ p: this.p, num: !this.isPagiantion ? this.pageSize : this.num },
|
||||
this.requestData
|
||||
);
|
||||
this.getDataPromise(data)
|
||||
.then((res) => {
|
||||
const list =
|
||||
this.p === 1
|
||||
? res?.data || []
|
||||
: [...this.list, ...(res?.data || [])];
|
||||
this.list = this.resultFormatFunc
|
||||
? this.resultFormatFunc(list)
|
||||
: list;
|
||||
this.total = res?.count || 0;
|
||||
this.$emit("getList", this.list, res);
|
||||
// console.log(this.list,'???')
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false;
|
||||
this.refreshTriggered = false;
|
||||
uni.stopPullDownRefresh();
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.list-template-wrapper {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
.list-content {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.news-item {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.empty-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 400rpx auto 0;
|
||||
padding: 0 40rpx;
|
||||
}
|
||||
|
||||
.home-ration {
|
||||
width: 160px;
|
||||
height: 174px;
|
||||
display: block;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -14,10 +14,12 @@
|
||||
getNoticeList
|
||||
} from "../../../api/notice";
|
||||
import NewsItem from "./components/NewsItem.vue";
|
||||
import ListPageTemp from "./components/ListPageTemp.vue";
|
||||
import { imgPrefix } from "@/utils/common";
|
||||
export default {
|
||||
components: {
|
||||
NewsItem,
|
||||
ListPageTemp
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
<script>
|
||||
import TabsList from "@/components/TabsList.vue";
|
||||
import ListPageTemp from "@/components/ListPageTemp.vue";
|
||||
import ListPageTemp from "./components/ListPageTemp.vue";
|
||||
import AfterSaleOrderItem from "./components/AfterSaleOrderItem.vue";
|
||||
|
||||
import { getShopOrderList } from '@/api/shop'
|
||||
|
||||
235
src/pages/client/order/components/ListPageTemp.vue
Normal file
235
src/pages/client/order/components/ListPageTemp.vue
Normal file
@ -0,0 +1,235 @@
|
||||
<template>
|
||||
<scroll-view class="list-template-wrapper" :scroll-y="!disableScroll" :refresher-enabled="true"
|
||||
:refresher-triggered="refreshTriggered" @refresherrefresh="onRefresh" @scrolltolower="onLoadMore">
|
||||
<slot name="top" />
|
||||
<view class="list-content" v-if="list.length > 0">
|
||||
<view v-for="(item, index) in list" :key="item[idKey]" :class="{ left: index % 2 === 0 }"
|
||||
class="flex-column-start news-item" @click="clickCell(item)">
|
||||
<slot style="width: 100%" name="item" :data="{
|
||||
...item,
|
||||
...listExtraFields,
|
||||
deleteSelect: !!item.deleteSelect,
|
||||
}" />
|
||||
</view>
|
||||
<uni-load-more v-if="isLoading || (!isLoading && total && total === list.length)"
|
||||
:status="isLoading ? 'loading' : 'nomore'"></uni-load-more>
|
||||
</view>
|
||||
<view v-else class="empty-container">
|
||||
<image class="home-ration" mode="widthFix" :src="emptyImage || defaultEmptyImage" />
|
||||
<text v-if="emptyText" class="empty-text">{{ emptyText }}</text>
|
||||
</view>
|
||||
<slot name="bottom" />
|
||||
|
||||
</scroll-view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "ListPageTemp",
|
||||
props: {
|
||||
getDataPromise: {
|
||||
type: Function,
|
||||
},
|
||||
// 格式化请求结果的方法
|
||||
resultFormatFunc: {
|
||||
type: Function,
|
||||
},
|
||||
requestData: {
|
||||
defult: () => { },
|
||||
type: Object,
|
||||
},
|
||||
// 列表元素额外字段
|
||||
listExtraFields: {
|
||||
type: Object,
|
||||
default: () => { },
|
||||
},
|
||||
reloadFlag: {
|
||||
default: 0,
|
||||
type: Number,
|
||||
},
|
||||
// 是否分页
|
||||
isPagiantion: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
// 分页数量, 不分页时有效
|
||||
pageSize: {
|
||||
type: Number,
|
||||
default: 999,
|
||||
},
|
||||
defaultList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
disableScroll: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
idKey: {
|
||||
type: String,
|
||||
default: "id",
|
||||
},
|
||||
// 占位图片地址
|
||||
emptyImage: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
// 空状态文本(传入时才显示)
|
||||
emptyText: {
|
||||
type: String,
|
||||
default: "",
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
total: 0,
|
||||
list: [],
|
||||
refreshTriggered: false,
|
||||
p: 1,
|
||||
num: 10,
|
||||
defaultEmptyImage: 'https://activity.wagoo.live/empty.png', // 默认占位图片
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
reloadFlag: {
|
||||
handler(value) {
|
||||
if (value) {
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
requestData: {
|
||||
handler(data) {
|
||||
if (data) {
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
defaultList: {
|
||||
handler(list) {
|
||||
this.list = list;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onRefresh() {
|
||||
if (this.refreshTriggered) return;
|
||||
this.refreshTriggered = true;
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
// this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
},
|
||||
|
||||
onLoadMore() {
|
||||
if (!this.isPagiantion) {
|
||||
return;
|
||||
}
|
||||
if (!this.isLoading && this.total > this.list.length) {
|
||||
this.p++;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
clickCell(item) {
|
||||
this.$emit("clickCell", item);
|
||||
},
|
||||
getList() {
|
||||
if (this.isLoading) return;
|
||||
this.isLoading = true;
|
||||
|
||||
// TODO: 删除测试数据
|
||||
if (!this.getDataPromise) {
|
||||
this.list = [0, 1, 2, 3, 4, 5, 6].map((v, k) => {
|
||||
return {
|
||||
title: "消息名称0000sssss撒大苏打大苏打" + v,
|
||||
id: k,
|
||||
len: 10,
|
||||
};
|
||||
});
|
||||
this.total = 9;
|
||||
this.isLoading = false;
|
||||
this.refreshTriggered = false;
|
||||
uni.stopPullDownRefresh();
|
||||
return;
|
||||
}
|
||||
|
||||
const data = Object.assign(
|
||||
{},
|
||||
{ p: this.p, num: !this.isPagiantion ? this.pageSize : this.num },
|
||||
this.requestData
|
||||
);
|
||||
this.getDataPromise(data)
|
||||
.then((res) => {
|
||||
const list =
|
||||
this.p === 1
|
||||
? res?.data || []
|
||||
: [...this.list, ...(res?.data || [])];
|
||||
this.list = this.resultFormatFunc
|
||||
? this.resultFormatFunc(list)
|
||||
: list;
|
||||
this.total = res?.count || 0;
|
||||
this.$emit("getList", this.list, res);
|
||||
// console.log(this.list,'???')
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false;
|
||||
this.refreshTriggered = false;
|
||||
uni.stopPullDownRefresh();
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.list-template-wrapper {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
.list-content {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.news-item {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.empty-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 400rpx auto 0;
|
||||
padding: 0 40rpx;
|
||||
}
|
||||
|
||||
.home-ration {
|
||||
width: 160px;
|
||||
height: 174px;
|
||||
display: block;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -93,8 +93,8 @@
|
||||
<view class="info-cell payment-method-cell">
|
||||
<view class="payment-item" @click.stop="selectOption1('1')">
|
||||
<view class="payment-left">
|
||||
<image class="payment-icon" src="@/static/images/wx.png" mode="widthFix" />
|
||||
<text class="payment-text">微信支付</text>
|
||||
<image class="payment-icon" src="@/static/images/douy.png" mode="widthFix" />
|
||||
<text class="payment-text">抖音支付</text>
|
||||
</view>
|
||||
<image class="payment-check"
|
||||
:src="selected2 ? require('@/static/images/cart_checked.png') : require('@/static/images/unchecked.png')"
|
||||
@ -573,15 +573,12 @@
|
||||
order_no:orderId.order_no
|
||||
})
|
||||
.then((res) => {
|
||||
const payData = res?.data || {};
|
||||
console.log(payData,'--=')
|
||||
uni.requestPayment({
|
||||
provider: "wxpay",
|
||||
timeStamp: payData.timeStamp,
|
||||
nonceStr: payData.nonceStr,
|
||||
package: payData.package,
|
||||
signType: payData.signType,
|
||||
paySign: payData.paySign,
|
||||
tt.pay({
|
||||
orderInfo: {
|
||||
order_id:res.data.orderInfo.order_id,
|
||||
order_token:res.data.orderInfo.order_token,
|
||||
},
|
||||
service:5,
|
||||
success: (res) => {
|
||||
console.log(res,'--==')
|
||||
uni.hideLoading();
|
||||
|
||||
@ -227,8 +227,8 @@
|
||||
<view class="info-cell payment-method-cell" v-if="orderData.status === SHOP_ORDER_UNPAY">
|
||||
<view class="payment-item" @click.stop="selectOption1('1')">
|
||||
<view class="payment-left">
|
||||
<image class="payment-icon" src="@/static/images/wx.png" mode="widthFix" />
|
||||
<text class="payment-text">微信支付</text>
|
||||
<image class="payment-icon" src="@/static/images/douy.png" mode="widthFix" />
|
||||
<text class="payment-text">抖音支付</text>
|
||||
</view>
|
||||
<image class="payment-check"
|
||||
:src="selected2 ? require('@/static/images/cart_checked.png') : require('@/static/images/unchecked.png')"
|
||||
@ -619,14 +619,12 @@
|
||||
order_id:this.orderData.order_id,
|
||||
order_no:this.orderData.order_no
|
||||
}).then((res) => {
|
||||
const payData = res?.data || {};
|
||||
uni.requestPayment({
|
||||
provider: "wxpay",
|
||||
timeStamp: payData.timeStamp,
|
||||
nonceStr: payData.nonceStr,
|
||||
package: payData.package,
|
||||
signType: payData.signType,
|
||||
paySign: payData.paySign,
|
||||
tt.pay({
|
||||
orderInfo: {
|
||||
order_id:res.data.orderInfo.order_id,
|
||||
order_token:res.data.orderInfo.order_token,
|
||||
},
|
||||
service:5,
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
|
||||
@ -61,8 +61,8 @@
|
||||
</view>
|
||||
<view class="wechat" @click.stop="selectOption1('1')">
|
||||
<view class="select">
|
||||
<image class="w" src="@/static/images/wx.png" mode="widthFix" />
|
||||
<text class="x">微信</text>
|
||||
<image class="w" src="@/static/images/douy.png" mode="widthFix" />
|
||||
<text class="x">抖音</text>
|
||||
</view>
|
||||
<image v-if="selected1" class="not-selected" src="@/static/images/w.png" mode="widthFix" />
|
||||
<image v-if="selected2" class="not-selected" src="@/static/images/y.png" mode="widthFix" />
|
||||
@ -99,7 +99,7 @@
|
||||
|
||||
<script>
|
||||
import TabsList from "@/components/TabsList.vue";
|
||||
import ListPageTemp from "@/components/ListPageTemp.vue";
|
||||
import ListPageTemp from "./components/ListPageTemp.vue";
|
||||
import OrderItem from "./components/OrderItem.vue";
|
||||
import PopUpModal from "@/components/PopUpModal.vue";
|
||||
import SuccessModal from "@/components/SuccessModal.vue";
|
||||
@ -340,14 +340,12 @@ export default {
|
||||
order_id: this.dataList.order_id,
|
||||
order_no: this.dataList.order_no
|
||||
}).then((res) => {
|
||||
const payData = res?.data || {};
|
||||
uni.requestPayment({
|
||||
provider: "wxpay",
|
||||
timeStamp: payData.timeStamp,
|
||||
nonceStr: payData.nonceStr,
|
||||
package: payData.package,
|
||||
signType: payData.signType,
|
||||
paySign: payData.paySign,
|
||||
tt.pay({
|
||||
orderInfo: {
|
||||
order_id:res.data.orderInfo.order_id,
|
||||
order_token:res.data.orderInfo.order_token,
|
||||
},
|
||||
service:5,
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
|
||||
@ -21,8 +21,8 @@
|
||||
<view class="recharge-method">
|
||||
<view class="wechat">
|
||||
<view class="select">
|
||||
<image class="w" src="@/static/images/wx.png" mode="widthFix" />
|
||||
<text class="x">微信</text>
|
||||
<image class="w" src="@/static/images/douy.png" mode="widthFix" />
|
||||
<text class="x">抖音</text>
|
||||
</view>
|
||||
<image v-if="selected1" class="not-selected" @click.stop="selectOption1('1')" src="@/static/images/w.png"
|
||||
mode="widthFix" />
|
||||
@ -212,14 +212,12 @@
|
||||
if (this.WeChat == 1) {
|
||||
payOrder(this.dataList.order_id, PRICE_DIFF_TYPE_SERVICE)
|
||||
.then((res) => {
|
||||
const payData = res?.info?.pay_data || {};
|
||||
uni.requestPayment({
|
||||
provider: "wxpay",
|
||||
timeStamp: payData.timeStamp,
|
||||
nonceStr: payData.nonceStr,
|
||||
package: payData.package,
|
||||
signType: payData.signType,
|
||||
paySign: payData.sign,
|
||||
tt.pay({
|
||||
orderInfo: {
|
||||
order_id:res.data.orderInfo.order_id,
|
||||
order_token:res.data.orderInfo.order_token,
|
||||
},
|
||||
service:5,
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
|
||||
235
src/pages/client/recharge/components/ListPageTemp.vue
Normal file
235
src/pages/client/recharge/components/ListPageTemp.vue
Normal file
@ -0,0 +1,235 @@
|
||||
<template>
|
||||
<scroll-view class="list-template-wrapper" :scroll-y="!disableScroll" :refresher-enabled="true"
|
||||
:refresher-triggered="refreshTriggered" @refresherrefresh="onRefresh" @scrolltolower="onLoadMore">
|
||||
<slot name="top" />
|
||||
<view class="list-content" v-if="list.length > 0">
|
||||
<view v-for="(item, index) in list" :key="item[idKey]" :class="{ left: index % 2 === 0 }"
|
||||
class="flex-column-start news-item" @click="clickCell(item)">
|
||||
<slot style="width: 100%" name="item" :data="{
|
||||
...item,
|
||||
...listExtraFields,
|
||||
deleteSelect: !!item.deleteSelect,
|
||||
}" />
|
||||
</view>
|
||||
<uni-load-more v-if="isLoading || (!isLoading && total && total === list.length)"
|
||||
:status="isLoading ? 'loading' : 'nomore'"></uni-load-more>
|
||||
</view>
|
||||
<view v-else class="empty-container">
|
||||
<image class="home-ration" mode="widthFix" :src="emptyImage || defaultEmptyImage" />
|
||||
<text v-if="emptyText" class="empty-text">{{ emptyText }}</text>
|
||||
</view>
|
||||
<slot name="bottom" />
|
||||
|
||||
</scroll-view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "ListPageTemp",
|
||||
props: {
|
||||
getDataPromise: {
|
||||
type: Function,
|
||||
},
|
||||
// 格式化请求结果的方法
|
||||
resultFormatFunc: {
|
||||
type: Function,
|
||||
},
|
||||
requestData: {
|
||||
defult: () => { },
|
||||
type: Object,
|
||||
},
|
||||
// 列表元素额外字段
|
||||
listExtraFields: {
|
||||
type: Object,
|
||||
default: () => { },
|
||||
},
|
||||
reloadFlag: {
|
||||
default: 0,
|
||||
type: Number,
|
||||
},
|
||||
// 是否分页
|
||||
isPagiantion: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
// 分页数量, 不分页时有效
|
||||
pageSize: {
|
||||
type: Number,
|
||||
default: 999,
|
||||
},
|
||||
defaultList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
disableScroll: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
idKey: {
|
||||
type: String,
|
||||
default: "id",
|
||||
},
|
||||
// 占位图片地址
|
||||
emptyImage: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
// 空状态文本(传入时才显示)
|
||||
emptyText: {
|
||||
type: String,
|
||||
default: "",
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
total: 0,
|
||||
list: [],
|
||||
refreshTriggered: false,
|
||||
p: 1,
|
||||
num: 10,
|
||||
defaultEmptyImage: 'https://activity.wagoo.live/empty.png', // 默认占位图片
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
reloadFlag: {
|
||||
handler(value) {
|
||||
if (value) {
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
requestData: {
|
||||
handler(data) {
|
||||
if (data) {
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
defaultList: {
|
||||
handler(list) {
|
||||
this.list = list;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onRefresh() {
|
||||
if (this.refreshTriggered) return;
|
||||
this.refreshTriggered = true;
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
// this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
},
|
||||
|
||||
onLoadMore() {
|
||||
if (!this.isPagiantion) {
|
||||
return;
|
||||
}
|
||||
if (!this.isLoading && this.total > this.list.length) {
|
||||
this.p++;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
clickCell(item) {
|
||||
this.$emit("clickCell", item);
|
||||
},
|
||||
getList() {
|
||||
if (this.isLoading) return;
|
||||
this.isLoading = true;
|
||||
|
||||
// TODO: 删除测试数据
|
||||
if (!this.getDataPromise) {
|
||||
this.list = [0, 1, 2, 3, 4, 5, 6].map((v, k) => {
|
||||
return {
|
||||
title: "消息名称0000sssss撒大苏打大苏打" + v,
|
||||
id: k,
|
||||
len: 10,
|
||||
};
|
||||
});
|
||||
this.total = 9;
|
||||
this.isLoading = false;
|
||||
this.refreshTriggered = false;
|
||||
uni.stopPullDownRefresh();
|
||||
return;
|
||||
}
|
||||
|
||||
const data = Object.assign(
|
||||
{},
|
||||
{ p: this.p, num: !this.isPagiantion ? this.pageSize : this.num },
|
||||
this.requestData
|
||||
);
|
||||
this.getDataPromise(data)
|
||||
.then((res) => {
|
||||
const list =
|
||||
this.p === 1
|
||||
? res?.data || []
|
||||
: [...this.list, ...(res?.data || [])];
|
||||
this.list = this.resultFormatFunc
|
||||
? this.resultFormatFunc(list)
|
||||
: list;
|
||||
this.total = res?.count || 0;
|
||||
this.$emit("getList", this.list, res);
|
||||
// console.log(this.list,'???')
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false;
|
||||
this.refreshTriggered = false;
|
||||
uni.stopPullDownRefresh();
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.list-template-wrapper {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
.list-content {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.news-item {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.empty-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 400rpx auto 0;
|
||||
padding: 0 40rpx;
|
||||
}
|
||||
|
||||
.home-ration {
|
||||
width: 160px;
|
||||
height: 174px;
|
||||
display: block;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -32,8 +32,8 @@
|
||||
<view class="recharge-method">
|
||||
<view class="wechat" @click.stop="selectOption1">
|
||||
<view class="select">
|
||||
<image class="w" src="@/static/images/wx.png" mode="widthFix" />
|
||||
<text class="x">微信</text>
|
||||
<image class="w" src="@/static/images/douy.png" mode="widthFix" />
|
||||
<text class="x">抖音</text>
|
||||
</view>
|
||||
<image v-if="selected1" class="not-selected"
|
||||
src="@/static/images/w.png" mode="widthFix" />
|
||||
@ -141,13 +141,12 @@
|
||||
walletWxpay(data).then((res) => {
|
||||
uni.hideLoading();
|
||||
// 使用获取的支付参数进行支付
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay',
|
||||
timeStamp: res.data.timeStamp,
|
||||
nonceStr: res.data.nonceStr,
|
||||
package: res.data.package,
|
||||
signType: res.data.signType,
|
||||
paySign: res.data.paySign,
|
||||
tt.pay({
|
||||
orderInfo: {
|
||||
order_id:res.data.orderInfo.order_id,
|
||||
order_token:res.data.orderInfo.order_token,
|
||||
},
|
||||
service:5,
|
||||
success: (payRes) => {
|
||||
uni.showToast({
|
||||
title: '支付成功',
|
||||
|
||||
@ -63,8 +63,8 @@
|
||||
<view class="recharge-method">
|
||||
<view class="wechat" @click.stop="selectOption1">
|
||||
<view class="select">
|
||||
<image class="w" src="@/static/images/wx.png" mode="widthFix" />
|
||||
<text class="x">微信</text>
|
||||
<image class="w" src="@/static/images/douy.png" mode="widthFix" />
|
||||
<text class="x">抖音</text>
|
||||
</view>
|
||||
<image v-if="selected1" class="not-selected"
|
||||
src="@/static/images/w.png" mode="widthFix" />
|
||||
@ -188,12 +188,12 @@
|
||||
};
|
||||
walletWxpay(data).then((res) => {
|
||||
// 使用获取的支付参数进行支付
|
||||
uni.requestPayment({
|
||||
timeStamp: res.data.timeStamp, // 确保这些字段都正确
|
||||
nonceStr: res.data.nonceStr,
|
||||
package: res.data.package,
|
||||
signType: res.data.signType,
|
||||
paySign: res.data.paySign,
|
||||
tt.pay({
|
||||
orderInfo: {
|
||||
order_id:res.data.orderInfo.order_id,
|
||||
order_token:res.data.orderInfo.order_token,
|
||||
},
|
||||
service:5,
|
||||
success: (res) => {
|
||||
this.buyService(this.user_id);
|
||||
// console.log('支付成功:', res);
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
|
||||
<script>
|
||||
import TabsList from "@/components/TabsList.vue";
|
||||
import ListPageTemp from "@/components/ListPageTemp.vue";
|
||||
import ListPageTemp from "./components/ListPageTemp.vue";
|
||||
import CouponItem from "@/components/coupon/CouponItem";
|
||||
import { getOwnCouponData } from "@/api/coupon";
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
</view>
|
||||
<view v-if="objNew.third_party_sn " class="rech-row">
|
||||
<text class="c">充值方式</text>
|
||||
<text v-if="objNew.payment_method == 1" class="m">微信</text>
|
||||
<text v-if="objNew.payment_method == 1" class="m">抖音</text>
|
||||
<text v-else class="m">支付宝</text>
|
||||
</view>
|
||||
<view class="rech-row">
|
||||
|
||||
235
src/pages/client/remark/ListPageTemp.vue
Normal file
235
src/pages/client/remark/ListPageTemp.vue
Normal file
@ -0,0 +1,235 @@
|
||||
<template>
|
||||
<scroll-view class="list-template-wrapper" :scroll-y="!disableScroll" :refresher-enabled="true"
|
||||
:refresher-triggered="refreshTriggered" @refresherrefresh="onRefresh" @scrolltolower="onLoadMore">
|
||||
<slot name="top" />
|
||||
<view class="list-content" v-if="list.length > 0">
|
||||
<view v-for="(item, index) in list" :key="item[idKey]" :class="{ left: index % 2 === 0 }"
|
||||
class="flex-column-start news-item" @click="clickCell(item)">
|
||||
<slot style="width: 100%" name="item" :data="{
|
||||
...item,
|
||||
...listExtraFields,
|
||||
deleteSelect: !!item.deleteSelect,
|
||||
}" />
|
||||
</view>
|
||||
<uni-load-more v-if="isLoading || (!isLoading && total && total === list.length)"
|
||||
:status="isLoading ? 'loading' : 'nomore'"></uni-load-more>
|
||||
</view>
|
||||
<view v-else class="empty-container">
|
||||
<image class="home-ration" mode="widthFix" :src="emptyImage || defaultEmptyImage" />
|
||||
<text v-if="emptyText" class="empty-text">{{ emptyText }}</text>
|
||||
</view>
|
||||
<slot name="bottom" />
|
||||
|
||||
</scroll-view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "ListPageTemp",
|
||||
props: {
|
||||
getDataPromise: {
|
||||
type: Function,
|
||||
},
|
||||
// 格式化请求结果的方法
|
||||
resultFormatFunc: {
|
||||
type: Function,
|
||||
},
|
||||
requestData: {
|
||||
defult: () => { },
|
||||
type: Object,
|
||||
},
|
||||
// 列表元素额外字段
|
||||
listExtraFields: {
|
||||
type: Object,
|
||||
default: () => { },
|
||||
},
|
||||
reloadFlag: {
|
||||
default: 0,
|
||||
type: Number,
|
||||
},
|
||||
// 是否分页
|
||||
isPagiantion: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
// 分页数量, 不分页时有效
|
||||
pageSize: {
|
||||
type: Number,
|
||||
default: 999,
|
||||
},
|
||||
defaultList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
disableScroll: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
idKey: {
|
||||
type: String,
|
||||
default: "id",
|
||||
},
|
||||
// 占位图片地址
|
||||
emptyImage: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
// 空状态文本(传入时才显示)
|
||||
emptyText: {
|
||||
type: String,
|
||||
default: "",
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
total: 0,
|
||||
list: [],
|
||||
refreshTriggered: false,
|
||||
p: 1,
|
||||
num: 10,
|
||||
defaultEmptyImage: 'https://activity.wagoo.live/empty.png', // 默认占位图片
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
reloadFlag: {
|
||||
handler(value) {
|
||||
if (value) {
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
requestData: {
|
||||
handler(data) {
|
||||
if (data) {
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
defaultList: {
|
||||
handler(list) {
|
||||
this.list = list;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onRefresh() {
|
||||
if (this.refreshTriggered) return;
|
||||
this.refreshTriggered = true;
|
||||
this.p = 1;
|
||||
this.num = 10;
|
||||
// this.list = [];
|
||||
this.total = 0;
|
||||
this.getList();
|
||||
},
|
||||
|
||||
onLoadMore() {
|
||||
if (!this.isPagiantion) {
|
||||
return;
|
||||
}
|
||||
if (!this.isLoading && this.total > this.list.length) {
|
||||
this.p++;
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
clickCell(item) {
|
||||
this.$emit("clickCell", item);
|
||||
},
|
||||
getList() {
|
||||
if (this.isLoading) return;
|
||||
this.isLoading = true;
|
||||
|
||||
// TODO: 删除测试数据
|
||||
if (!this.getDataPromise) {
|
||||
this.list = [0, 1, 2, 3, 4, 5, 6].map((v, k) => {
|
||||
return {
|
||||
title: "消息名称0000sssss撒大苏打大苏打" + v,
|
||||
id: k,
|
||||
len: 10,
|
||||
};
|
||||
});
|
||||
this.total = 9;
|
||||
this.isLoading = false;
|
||||
this.refreshTriggered = false;
|
||||
uni.stopPullDownRefresh();
|
||||
return;
|
||||
}
|
||||
|
||||
const data = Object.assign(
|
||||
{},
|
||||
{ p: this.p, num: !this.isPagiantion ? this.pageSize : this.num },
|
||||
this.requestData
|
||||
);
|
||||
this.getDataPromise(data)
|
||||
.then((res) => {
|
||||
const list =
|
||||
this.p === 1
|
||||
? res?.data || []
|
||||
: [...this.list, ...(res?.data || [])];
|
||||
this.list = this.resultFormatFunc
|
||||
? this.resultFormatFunc(list)
|
||||
: list;
|
||||
this.total = res?.count || 0;
|
||||
this.$emit("getList", this.list, res);
|
||||
// console.log(this.list,'???')
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false;
|
||||
this.refreshTriggered = false;
|
||||
uni.stopPullDownRefresh();
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.list-template-wrapper {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
.list-content {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.news-item {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.empty-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 400rpx auto 0;
|
||||
padding: 0 40rpx;
|
||||
}
|
||||
|
||||
.home-ration {
|
||||
width: 160px;
|
||||
height: 174px;
|
||||
display: block;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
<script>
|
||||
import RemarkItem from "@/components/goods/RemarkItem.vue";
|
||||
import ListPageTemp from "@/components/ListPageTemp.vue";
|
||||
import ListPageTemp from "./ListPageTemp.vue";
|
||||
import { getRemarkList } from "@/api/shop";
|
||||
|
||||
export default {
|
||||
|
||||
@ -220,14 +220,13 @@ export default {
|
||||
// 支付
|
||||
pay(orderId) {
|
||||
serviceCouponOrderPay(orderId).then((res) => {
|
||||
const payData = res?.info?.pay_data || {};
|
||||
uni.requestPayment({
|
||||
provider: "wxpay",
|
||||
timeStamp: payData.timeStamp,
|
||||
nonceStr: payData.nonceStr,
|
||||
package: payData.package,
|
||||
signType: payData.signType,
|
||||
paySign: payData.sign,
|
||||
|
||||
tt.pay({
|
||||
orderInfo: {
|
||||
order_id:res.data.orderInfo.order_id,
|
||||
order_token:res.data.orderInfo.order_token,
|
||||
},
|
||||
service:5,
|
||||
success: (res) => {
|
||||
uni.hideLoading();
|
||||
this.showSuccessModal = true;
|
||||
|
||||
Reference in New Issue
Block a user