Commit 88382beb authored by 陈宗胤(贵阳日报)'s avatar 陈宗胤(贵阳日报)
parents c1cf916e d3e58237
...@@ -79,7 +79,14 @@ export function applyForARefundApi(data) { ...@@ -79,7 +79,14 @@ export function applyForARefundApi(data) {
data, data,
}); });
} }
// 新增订单评价
export function evaluation(data) {
return request({
url: '/sgyrdd/evaluation/eval',
method: 'post',
data,
});
}
export function afterSale(data) { export function afterSale(data) {
return request({ return request({
url: '/sgyrdd/sgyOrder/afterSales/getInfo', url: '/sgyrdd/sgyOrder/afterSales/getInfo',
......
...@@ -30,13 +30,15 @@ ...@@ -30,13 +30,15 @@
{ {
"path": "pages/index/foodClassification", "path": "pages/index/foodClassification",
"style": { "style": {
"navigationBarTitleText": "" "navigationBarTitleText": "",
"enablePullDownRefresh": true
} }
}, },
{ {
"path": "pages/order/order", "path": "pages/order/order",
"style": { "style": {
"navigationBarTitleText": "订单列表" "navigationBarTitleText": "订单列表",
"enablePullDownRefresh": true
} }
}, },
{ {
...@@ -66,7 +68,8 @@ ...@@ -66,7 +68,8 @@
{ {
"path": "pages/ticket/ticket", "path": "pages/ticket/ticket",
"style": { "style": {
"navigationBarTitleText": "我的券" "navigationBarTitleText": "我的券",
"enablePullDownRefresh": true
} }
}, },
{ {
...@@ -92,37 +95,32 @@ ...@@ -92,37 +95,32 @@
"style": { "style": {
"navigationBarTitleText": "美食评论" "navigationBarTitleText": "美食评论"
} }
} },
,
{ {
"path": "pages/order/refund", "path": "pages/order/refund",
"style": { "style": {
"navigationBarTitleText": "申请退款" "navigationBarTitleText": "申请退款"
} }
} },
,
{ {
"path": "pages/index/coupon", "path": "pages/index/coupon",
"style": { "style": {
"navigationBarTitleText": "优惠券详情", "navigationBarTitleText": "优惠券详情",
"enablePullDownRefresh": true "enablePullDownRefresh": true
} }
} },
,
{ {
"path": "pages/storeEntry/index", "path": "pages/storeEntry/index",
"style": { "style": {
"navigationBarTitleText": "我的店铺" "navigationBarTitleText": "我的店铺"
} }
} },
,
{ {
"path": "pages/storeEntry/detail", "path": "pages/storeEntry/detail",
"style": { "style": {
"navigationBarTitleText": "商家入驻" "navigationBarTitleText": "商家入驻"
} }
} },
,
{ {
"path": "pages/order/afterSales", "path": "pages/order/afterSales",
"style": { "style": {
......
...@@ -129,8 +129,8 @@ const params = ref({ ...@@ -129,8 +129,8 @@ const params = ref({
size: 15, size: 15,
// lon, // lon,
// lat, // lat,
lon: 106.68650025025502, lon: '',
lat: 26.567192352601154, lat: '',
isEnd: false, isEnd: false,
}); });
const pics = ref(null); const pics = ref(null);
...@@ -221,6 +221,13 @@ function refresh() { ...@@ -221,6 +221,13 @@ function refresh() {
resolve(); resolve();
}); });
} }
onPullDownRefresh(() => {
refresh().then(() => {
getMerchantList().then(() => {
xma.stopPullDownRefresh();
});
});
});
// 根据父级分类id查询子分类列表 // 根据父级分类id查询子分类列表
const query = (parentId) => { const query = (parentId) => {
getByParentId(parentId).then((res) => { getByParentId(parentId).then((res) => {
...@@ -237,6 +244,7 @@ function jumpProductDetails(prodId) { ...@@ -237,6 +244,7 @@ function jumpProductDetails(prodId) {
} }
const prodSpecialFn = () => { const prodSpecialFn = () => {
prodSpecial({ categoryId: categoryId.value }).then((res) => { prodSpecial({ categoryId: categoryId.value }).then((res) => {
if (res.data.data) {
res.data.data = res.data.data.map((el) => { res.data.data = res.data.data.map((el) => {
if (el.labels && el.labels !== '') { if (el.labels && el.labels !== '') {
el.labels = el.labels.split(','); el.labels = el.labels.split(',');
...@@ -244,6 +252,7 @@ const prodSpecialFn = () => { ...@@ -244,6 +252,7 @@ const prodSpecialFn = () => {
return el; return el;
}); });
topDiscountedProducts.value = res.data.data; topDiscountedProducts.value = res.data.data;
}
}); });
}; };
const choice = (index) => { const choice = (index) => {
...@@ -295,13 +304,8 @@ const getMerchantList = () => { ...@@ -295,13 +304,8 @@ const getMerchantList = () => {
item.labels = item.labels.split(','); item.labels = item.labels.split(',');
} }
}); });
return new Promise((resolve) => {
cardData.value = cardData.value.concat(res.data.content); cardData.value = cardData.value.concat(res.data.content);
xma.hideLoading(); xma.hideLoading();
setTimeout(() => {
resolve();
}, 500);
});
}); });
}; };
function getLocationFn() { function getLocationFn() {
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
></wd-icon> ></wd-icon>
<view class="status-text">{{ statusList[orderDetail.orderStore.status] }}</view> <view class="status-text">{{ statusList[orderDetail.orderStore.status] }}</view>
</view> </view>
<view class="detail" v-if="orderDetail.orderStore.subStatus == 3"> <view class="detail" v-if="orderDetail.orderStore.status == 3">
请在{{ orderDetail.orderStore.receiverTime.slice(0, 4) }}{{ 请在{{ orderDetail.orderStore.receiverTime.slice(0, 4) }}{{
orderDetail.orderStore.receiverTime.slice(5, 7) orderDetail.orderStore.receiverTime.slice(5, 7)
}}{{ orderDetail.orderStore.receiverTime.slice(8, 10) }}前到店消费 }}{{ orderDetail.orderStore.receiverTime.slice(8, 10) }}前到店消费
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
<view class="info-box"> <view class="info-box">
<view <view
class="between" class="between"
v-if="orderDetail.orderStore.subStatus == 2 || orderDetail.orderStore.subStatus == 3" v-if="orderDetail.orderStore.status == 2 || orderDetail.orderStore.status == 3"
> >
<view class="column"> <view class="column">
<text class="title">券码信息(1张可用)</text> <text class="title">券码信息(1张可用)</text>
...@@ -68,17 +68,15 @@ ...@@ -68,17 +68,15 @@
<view class="column"> <view class="column">
<text <text
class="title1" class="title1"
v-if=" v-if="orderDetail.orderStore.status != 2 || orderDetail.orderStore.status != 3"
orderDetail.orderStore.subStatus != 2 || orderDetail.orderStore.subStatus != 3
"
> >
券码信息 券码信息
</text> </text>
<text <text
:class=" :class="
orderDetail.orderStore.subStatus == 5 || orderDetail.orderStore.status == 5 ||
orderDetail.orderStore.subStatus == 6 || orderDetail.orderStore.status == 6 ||
orderDetail.orderStore.subStatus == 7 orderDetail.orderStore.status == 7
? 'linethrough' ? 'linethrough'
: 'phone' : 'phone'
" "
...@@ -235,8 +233,8 @@ import { getOrderDetail, getShopDetail, getProdDetail } from '@/api/order'; ...@@ -235,8 +233,8 @@ import { getOrderDetail, getShopDetail, getProdDetail } from '@/api/order';
import { getDistance } from '@/utils/common'; import { getDistance } from '@/utils/common';
onShow(() => { onShow(() => {
// 获取位置 // 获取位置并计算距离
getLocationFn(); calculateDistance();
}); });
// 当前位置的经纬度 // 当前位置的经纬度
...@@ -313,6 +311,8 @@ const shopDetail = ref(); ...@@ -313,6 +311,8 @@ const shopDetail = ref();
const getShopMailDetail = async (id) => { const getShopMailDetail = async (id) => {
const res = await getShopDetail({ shopId: id }); const res = await getShopDetail({ shopId: id });
shopDetail.value = res.data.shop; shopDetail.value = res.data.shop;
// 获取位置并计算距离
calculateDistance();
}; };
const maskPhoneNumber = (phone) => { const maskPhoneNumber = (phone) => {
...@@ -320,18 +320,38 @@ const maskPhoneNumber = (phone) => { ...@@ -320,18 +320,38 @@ const maskPhoneNumber = (phone) => {
}; };
function getLocationFn() { function getLocationFn() {
return new Promise((resolve, reject) => {
xma.getLocation({ xma.getLocation({
type: 'wgs84', type: 'wgs84',
isHighAccuracy: true,
success: function (res) { success: function (res) {
const myLatitude = currentLatitudeAndLongitude.value.latitude; // 经纬度
const myLongitude = currentLatitudeAndLongitude.value.longitude; console.log('res.latitude, res.longitude', res.latitude, res.longitude);
const distance = getDistance(res.latitude, res.longitude, myLatitude, myLongitude, 1); resolve({ lat: res.latitude, lon: res.longitude });
shopDetail.value.distance = distance;
}, },
fail: function (err) { fail: function (err) {
return err; return err;
}, },
}); });
});
}
// 计算距离的函数封装
async function calculateDistance() {
try {
const res = await getLocationFn();
const distance = getDistance(
res.lat,
res.lon,
shopDetail.value.shopLat,
shopDetail.value.shopLng,
1,
);
shopDetail.value.distance = distance;
console.log('distance', distance, shopDetail.value.shopLat, shopDetail.value.shopLng);
} catch (error) {
console.error('Error calculating distance:', error);
}
} }
/** /**
......
...@@ -98,7 +98,19 @@ ...@@ -98,7 +98,19 @@
</view> </view>
</view> </view>
<wd-loadmore :state="state" @reload="getList" /> <!-- <wd-loadmore :state="state" @reload="getList" /> -->
<view
style="
width: 100%;
text-align: center;
font-size: 24rpx;
margin-top: 10rpx;
color: #888989;
"
v-if="isEnd"
>
没有更多啦~
</view>
</view> </view>
<wd-status-tip image="content" tip="暂无内容" v-else /> <wd-status-tip image="content" tip="暂无内容" v-else />
</wd-tab> </wd-tab>
...@@ -194,10 +206,18 @@ onShow(() => { ...@@ -194,10 +206,18 @@ onShow(() => {
} }
}); });
onPullDownRefresh(() => {
initDataList().then(() => {
getList();
xma.stopPullDownRefresh();
});
});
// 触底函数 // 触底函数
onReachBottom(() => { onReachBottom(() => {
if (dataList.value.length >= total.value) { if (dataList.value.length >= total.value) {
state.value = 'finished'; isEnd.value = true;
// state.value = 'finished';
} else { } else {
getList(); getList();
} }
...@@ -208,7 +228,8 @@ onReachBottom(() => { ...@@ -208,7 +228,8 @@ onReachBottom(() => {
*/ */
const total = ref(0); const total = ref(0);
const dataList = ref([]); const dataList = ref([]);
const state = ref('loading'); // const state = ref('loading');
const isEnd = ref(false);
const catalog = reactive({ const catalog = reactive({
current: 0, current: 0,
size: 10, size: 10,
...@@ -219,13 +240,21 @@ const catalog = reactive({ ...@@ -219,13 +240,21 @@ const catalog = reactive({
orderType: 'store', // 团购到店-store,外卖订单-takeaway,筑农物流logistics orderType: 'store', // 团购到店-store,外卖订单-takeaway,筑农物流logistics
}); });
const getList = async () => { const getList = async () => {
if (isEnd.value) return;
catalog.status = tab.value; catalog.status = tab.value;
if (tab.value === 'all') { if (tab.value === 'all') {
catalog.status = ''; catalog.status = '';
} }
catalog.current++; catalog.current++;
state.value = 'loading'; // state.value = 'loading';
xma.showLoading({
title: '加载中...',
mask: true,
});
const res = await getOrderList(catalog); const res = await getOrderList(catalog);
if (res.data.records.length < catalog.size) {
isEnd.value = true;
}
if (res.data.records.length > 0) { if (res.data.records.length > 0) {
res.data.records.forEach((item) => { res.data.records.forEach((item) => {
// 待付款倒计时计算 // 待付款倒计时计算
...@@ -236,7 +265,8 @@ const getList = async () => { ...@@ -236,7 +265,8 @@ const getList = async () => {
dataList.value.push(...res.data.records); dataList.value.push(...res.data.records);
total.value = res.data.total; total.value = res.data.total;
} }
state.value = 'finished'; // state.value = 'finished';
xma.hideLoading();
}; };
/** /**
...@@ -244,17 +274,22 @@ const getList = async () => { ...@@ -244,17 +274,22 @@ const getList = async () => {
*/ */
const handleChange = (e) => { const handleChange = (e) => {
tab.value = e.name; tab.value = e.name;
initDataList(); initDataList().then(() => {
getList();
});
}; };
/** /**
* 刷新订单列表 * 刷新订单列表
*/ */
const initDataList = () => { const initDataList = () => {
return new Promise((resolve, reject) => {
dataList.value = []; dataList.value = [];
total.value = 0; total.value = 0;
catalog.current = 0; catalog.current = 0;
getList(); isEnd.value = false;
resolve();
});
}; };
/** /**
...@@ -262,17 +297,24 @@ const initDataList = () => { ...@@ -262,17 +297,24 @@ const initDataList = () => {
* @param {*} orderNumber * @param {*} orderNumber
*/ */
const handleDelete = (orderNumber) => { const handleDelete = (orderNumber) => {
uni.showModal({ xma.showModal({
title: '提示', title: '提示',
content: '确定要删除订单吗?', content: '确定要删除订单吗?',
success: async (res) => { success: async (res) => {
if (res.confirm) { if (res.confirm) {
const res = await deleteOrderApi(orderNumber); xma.showLoading({
uni.showToast({ title: '删除中...',
mask: true,
});
await deleteOrderApi(orderNumber);
xma.hideLoading();
xma.showToast({
title: '删除成功', title: '删除成功',
icon: 'success', icon: 'success',
}); });
initDataList(); initDataList().then(() => {
getList();
});
} }
}, },
}); });
...@@ -283,17 +325,24 @@ const handleDelete = (orderNumber) => { ...@@ -283,17 +325,24 @@ const handleDelete = (orderNumber) => {
* @param {*} orderNumber * @param {*} orderNumber
*/ */
const handleCancel = (orderNumber) => { const handleCancel = (orderNumber) => {
uni.showModal({ xma.showModal({
title: '提示', title: '提示',
content: '确定要取消订单吗?', content: '确定要取消订单吗?',
success: async (res) => { success: async (res) => {
if (res.confirm) { if (res.confirm) {
const res = await cancelOrderApi({ orderNumber }); xma.showLoading({
uni.showToast({ title: '取消中...',
mask: true,
});
await cancelOrderApi({ orderNumber });
xma.hideLoading();
xma.showToast({
title: '取消成功', title: '取消成功',
icon: 'success', icon: 'success',
}); });
initDataList(); initDataList().then(() => {
getList();
});
} }
}, },
}); });
...@@ -348,7 +397,9 @@ const calculateCountdown = (item) => { ...@@ -348,7 +397,9 @@ const calculateCountdown = (item) => {
*/ */
const onFinish = async (orderNumber) => { const onFinish = async (orderNumber) => {
await cancelOrderApi({ orderNumber }); await cancelOrderApi({ orderNumber });
initDataList(); initDataList().then(() => {
getList();
});
}; };
const handleDetail = (id) => { const handleDetail = (id) => {
......
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
image-mode="aspectFill" image-mode="aspectFill"
:action="action" :action="action"
@change="handleChange" @change="handleChange"
:header="headers"
accept="image"
></wd-upload> ></wd-upload>
</view> </view>
<view class="content-between" @tap="showPop = true"> <view class="content-between" @tap="showPop = true">
...@@ -97,11 +99,18 @@ ...@@ -97,11 +99,18 @@
<script setup> <script setup>
import Header from '@/pages/order/components/Header/index.vue'; import Header from '@/pages/order/components/Header/index.vue';
import { applyForARefundApi, getOrderDetail } from '@/api/order'; import { applyForARefundApi, getOrderDetail } from '@/api/order';
import { getToken } from '@/utils/auth';
const fileDomain = import.meta.env.VITE_APP_IMG_URL; const fileDomain = import.meta.env.VITE_APP_IMG_URL;
const token = getToken();
// 上传图片地址
const action = ref(import.meta.env.VITE_APP_BASE_URL + '/sgyrdd/file/update');
const headers = ref('');
// 订单号
const orderNumber = ref(''); const orderNumber = ref('');
onLoad((options) => { onLoad((options) => {
orderNumber.value = options.orderNumber; orderNumber.value = options.orderNumber;
headers.value = { Authorization: 'Bearer ' + token };
getDetail(); getDetail();
}); });
...@@ -114,11 +123,14 @@ const getDetail = async () => { ...@@ -114,11 +123,14 @@ const getDetail = async () => {
orderDetail.value = res.data; orderDetail.value = res.data;
}; };
/**
* 获取图片列表
*/
// 上传文件地址
const fileList = ref([]); const fileList = ref([]);
const action = ref('');
function handleChange({ fileList: files }) { function handleChange({ fileList: files }) {
console.log(files);
fileList.value = files; fileList.value = files;
console.log(fileList.value);
} }
const showPop = ref(false); const showPop = ref(false);
...@@ -151,6 +163,9 @@ function radioChange(evt) { ...@@ -151,6 +163,9 @@ function radioChange(evt) {
selectType.value = value; selectType.value = value;
} }
/**
* 提交申请
*/
const submit = async () => { const submit = async () => {
if (!selectType.value) { if (!selectType.value) {
return xma.showToast({ return xma.showToast({
...@@ -171,8 +186,8 @@ const submit = async () => { ...@@ -171,8 +186,8 @@ const submit = async () => {
await applyForARefundApi({ await applyForARefundApi({
orderNumber: orderNumber.value, orderNumber: orderNumber.value,
refundMemo: refundMemo:
selectType.value === 4 ? otherReason.value : reasonList.value[selectType.value].name, selectType.value === '4' ? otherReason.value : reasonList.value[selectType.value].name,
imgs: fileList.value.map((item) => item.url), imgs: processingImageAddresses(),
}); });
setTimeout(() => { setTimeout(() => {
xma.hideLoading(); xma.hideLoading();
...@@ -188,6 +203,19 @@ const submit = async () => { ...@@ -188,6 +203,19 @@ const submit = async () => {
}, 1500); }, 1500);
}; };
/**
* 图片地址处理
*/
const processingImageAddresses = () => {
const data = fileList.value.map((item) => {
return JSON.parse(item.response).data.url;
});
return data.join(',');
};
/**
* 提交申请
*/
const chooseReason = () => { const chooseReason = () => {
if (!selectType.value) { if (!selectType.value) {
return xma.showToast({ return xma.showToast({
......
...@@ -2,76 +2,132 @@ ...@@ -2,76 +2,132 @@
<view class="container"> <view class="container">
<Header title="评论"></Header> <Header title="评论"></Header>
<view class="content"> <view class="content">
<wd-form ref="form" :model="model" :rules="rules" class="remake"> <wd-form ref="form" :model="formdata" :rules="rules" class="remake">
<text class="textarea">老凯里酸汤鱼</text> <text class="textarea">{{ shopname }}</text>
<view class="itemPicker"> <view class="itemPicker">
<view class="item01"> <view class="item01">
<text class="label">评分</text> <text class="label">评分</text>
<wd-rate v-model="pinfen" active-color="#ff0000" size="50rpx" space="10px" /> <wd-rate
prop="merchantServices"
v-model="formdata.merchantServices"
active-color="#ff0000"
size="50rpx"
space="10px"
@change="handlemerchant"
/>
</view> </view>
<view class="item02"> <view class="item02">
<text>非常满意</text> <text>{{ merList[formdata.merchantServices] }}</text>
</view> </view>
</view> </view>
<wd-textarea v-model="pingjia" placeholder="亲,分享您的看法,给其他人一个参考哦!" /> <wd-textarea
prop="evaluation"
v-model="formdata.evaluation"
placeholder="亲,分享您的看法,给其他人一个参考哦!"
:rules="[{ required: true, message: '请填写你的评价' }]"
/>
<text class="textarea">上传图片/视频</text> <text class="textarea">上传图片/视频</text>
<wd-upload <wd-upload
class="wdUpload" class="wdUpload"
accept="media" accept="media"
multiple multiple
:file-list="fileList" :action="fileUPload"
:action="action" @change="handleFile"
@change="handleChange"
></wd-upload> ></wd-upload>
<view class="tuijian">
<!-- <view class="tuijian" v-if="show">
<view class="tjTitle"> <view class="tjTitle">
<text class="textarea">我要推荐菜</text> <text class="textarea">我要推荐菜</text>
<text class="textRight"> <text class="textRight">
查看全部(30) 查看全部(30)
<i></i> <wd-icon name="arrow-right"></wd-icon>
</text> </text>
</view> </view>
<view class="itemtuijianList"> <view class="itemtuijianList">
<wd-button type="success" plain classPrefix="fish" icon="kehuishouwu"> <wd-checkbox-group shape="button">
主要按钮 <wd-checkbox modelValue="jingmai" checked-color="#f00" shape="button"></wd-checkbox>
</wd-button> <wd-checkbox modelValue="asd" shape="button">沃特</wd-checkbox>
</view> </wd-checkbox-group>
</view>
<wd-cell title="开启折扣" title-width="100px" prop="switchVal" center>
<view style="text-align: left">
<wd-switch v-model="mode.switchVal" />
</view> </view>
</view> -->
<wd-cell title="匿名评价" prop="isAnonymous" class="itemSwichval">
<wd-switch
size="48rpx"
active-color="#EC1B1B"
v-model="formdata.isAnonymous"
active-value="1"
inactive-value="0"
/>
</wd-cell> </wd-cell>
</wd-form> </wd-form>
<wd-button type="error" block>发布</wd-button> <wd-button type="error" block @click="handleSubmit">发布</wd-button>
</view> </view>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Header from './components/Header/index.vue'; import Header from './components/Header/index.vue';
import { evaluation } from '@/api/order';
const form = ref();
/**
* options
*/
const shopname = ref<string>('');
onLoad((options) => {
shopname.value = options?.shopName;
formdata.orderNumber = options?.orderNumber;
});
const pinfen = ref<number>(0); const formdata = reactive<{
function changeValue({ pinfen }) { orderNumber: string;
console.log(pinfen); evaluation: string;
} images: string[];
const pingjia = ref<string>(''); isAnonymous: number;
descriptionMatches: number;
merchantServices: number;
}>({
orderNumber: '',
evaluation: '',
images: [],
isAnonymous: 0,
descriptionMatches: 0,
merchantServices: 0,
});
const action = ref<string>('/zhTuw2P8c29bc981a741931bdd86eb04dc1e8fd64865cb5/upload'); const rules = {};
/**
* 显示推荐菜
*/
const show = ref<boolean>(false);
/**
* 评分
*/
const merchantServices = ref<number>(0);
const merList = ref({
1: '非常差',
2: '差',
3: '一般',
4: '好',
5: '非常好',
});
const handlemerchant = (e) => {
merchantServices.value = e.value;
};
const fileList = ref([]); /**
* 图片上传
*/
const fileUPload = ref<string>('/');
function handleChange({ files }) { function handleFile({ files }) {}
fileList.value = files;
} const handleSubmit = async () => {
const mode = reactive<{ const res = await evaluation();
switchVal: boolean; console.log(formdata);
}>({ };
switchVal: true,
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.container { .container {
...@@ -141,15 +197,32 @@ const mode = reactive<{ ...@@ -141,15 +197,32 @@ const mode = reactive<{
.tuijian { .tuijian {
margin-top: 72rpx; margin-top: 72rpx;
.tjTitle { .tjTitle {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 40rpx; margin-bottom: 40rpx;
.textRight { .textRight {
font-size: 24rpx; font-size: 24rpx;
} }
} }
} }
.itemSwichval {
width: auto;
padding: 0;
margin-top: 72rpx;
:deep(.wd-cell__wrapper) {
padding: 0;
align-items: center;
}
}
}
.wd-cel {
--wot-size-side-padding: 0px;
} }
</style> </style>
...@@ -96,17 +96,61 @@ ...@@ -96,17 +96,61 @@
class="img1" class="img1"
></wd-upload> ></wd-upload>
</view> </view>
<view class="flex">
<view class="logo">店铺分类</view>
<view class="text" @click="showclass">请选择</view>
</view>
<wd-textarea <wd-textarea
placeholder="请填写评价" placeholder="请填写评价"
label="店铺介绍" label="店铺介绍"
label-width="100px" label-width="100px"
v-model="formData.szdq" v-model="formData.szdq"
prop="szdq" prop="szdq"
:no-border="false"
/> />
<button type="primary" style="width: 80%">提交</button> <button type="primary" style="width: 80%">提交</button>
</wd-cell-group> </wd-cell-group>
<wd-popup
v-model="show"
position="bottom"
custom-style="height:300px;overflow:auto;"
@close="handleClose"
>
<view class="hcontent">
<view class="flex1">
<view class="text">取消</view>
<view class="text">请选择</view>
<view class="text">确定</view>
</view>
<view class="nr">
<view class="left">
<view class="name">周边美食</view>
<view class="name">周边美食</view>
<view class="name">周边美食</view>
<view class="name">周边美食</view>
<view class="name">周边美食</view>
<view class="name">周边美食</view>
<view class="name">周边美食</view>
<view class="name">周边美食</view>
<view class="name">周边美食</view>
<view class="name">周边美食</view>
<view class="name">周边美食</view>
<view class="name">周边美食</view>
</view>
<view class="right">
<view class="item">
<view class="hname">生活用品</view>
<view class="hnr">
<wd-tag round>标签</wd-tag>
<wd-tag round>标签</wd-tag>
<wd-tag round>标签</wd-tag>
<wd-tag round>标签</wd-tag>
</view>
</view>
</view>
</view>
</view>
</wd-popup>
</wd-form> </wd-form>
</view> </view>
</view> </view>
...@@ -125,11 +169,15 @@ const promotionlist = ref([ ...@@ -125,11 +169,15 @@ const promotionlist = ref([
label: '连锁加盟', label: '连锁加盟',
}, },
]); ]);
const show = ref(false);
const fileList = ref([ const fileList = ref([
{ {
url: '1', url: '1',
}, },
]); ]);
const showclass = () => {
show.value = true;
};
function chooseImage({ fileList: files }) { function chooseImage({ fileList: files }) {
xma.chooseImage({ xma.chooseImage({
...@@ -175,8 +223,59 @@ const getLocationFn = () => { ...@@ -175,8 +223,59 @@ const getLocationFn = () => {
<style lang="scss" scoped> <style lang="scss" scoped>
page { page {
background: #f3f3f3; background: #fff;
}
.uni-textarea-placeholder,
.uni-textarea-line,
.uni-textarea-compute,
.uni-textarea-textarea {
width: 400rpx;
height: 220rpx;
border: 1px solid #d5d1d1;
}
.wd-tag {
margin-left: 15rpx;
} }
.hcontent {
height: 100%;
.flex1 {
padding: 10px;
display: flex;
position: fixed;
width: 100%;
justify-content: space-between;
box-sizing: border-box;
border-bottom: 1px solid #ccc;
background: #fff;
z-index: 6;
}
.nr {
padding-top: 42px;
display: flex;
.left {
background: #ebe7e7;
width: 33%;
height: 100%;
overflow-y: auto;
.name {
text-align: center;
height: 40px;
line-height: 40px;
}
}
.right {
background: #fff;
width: 67%;
.hname {
font-size: 14px;
margin: 15rpx;
padding-bottom: 10px;
border-bottom: 1px solid #ccc;
}
}
}
}
.container { .container {
width: 375 * 2rpx; width: 375 * 2rpx;
margin: 0 auto; margin: 0 auto;
...@@ -196,6 +295,12 @@ page { ...@@ -196,6 +295,12 @@ page {
padding: var(--wot-input-cell-padding, 10px) padding: var(--wot-input-cell-padding, 10px)
var(--wot-input-padding, var(--wot-size-side-padding, 15px)); var(--wot-input-padding, var(--wot-size-side-padding, 15px));
background-color: var(--wot-input-cell-bg, var(--wot-color-white, rgb(255, 255, 255))); background-color: var(--wot-input-cell-bg, var(--wot-color-white, rgb(255, 255, 255)));
.text {
margin-left: 16px;
width: 60%;
font-size: var(--wot-input-fs, var(--wot-cell-title-fs, 14px));
color: var(--wot-input-placeholder-color, #bfbfbf);
}
.logo { .logo {
position: relative; position: relative;
padding-left: 12px; padding-left: 12px;
......
...@@ -138,8 +138,8 @@ import Header from '@/pages/order/components/Header/index.vue'; ...@@ -138,8 +138,8 @@ import Header from '@/pages/order/components/Header/index.vue';
const fileDomain = import.meta.env.VITE_APP_IMG_URL; const fileDomain = import.meta.env.VITE_APP_IMG_URL;
onShow(() => { onShow(() => {
// 获取位置 // 获取位置并计算距离
getLocationFn(); calculateDistance();
}); });
const shopId = ref(); const shopId = ref();
...@@ -224,6 +224,8 @@ const getShopMailDetail = async () => { ...@@ -224,6 +224,8 @@ const getShopMailDetail = async () => {
const res = await getShopDetail({ shopId: shopId.value }); const res = await getShopDetail({ shopId: shopId.value });
if (res.code === 0) { if (res.code === 0) {
shopDetail.value = res.data.shop; shopDetail.value = res.data.shop;
// 获取位置并计算距离
calculateDistance();
} }
}; };
...@@ -248,22 +250,40 @@ function callShopPhone(phoneNumber) { ...@@ -248,22 +250,40 @@ function callShopPhone(phoneNumber) {
}); });
} }
/** // 获取定位
* 获取定位
*/
function getLocationFn() { function getLocationFn() {
return new Promise((resolve, reject) => {
xma.getLocation({ xma.getLocation({
type: 'wgs84', type: 'wgs84',
isHighAccuracy: true,
success: function (res) { success: function (res) {
const myLatitude = shopDetail.value.shopLat; // 经纬度
const myLongitude = shopDetail.value.shopLng; console.log('res.latitude, res.longitude', res.latitude, res.longitude);
const distance = getDistance(res.latitude, res.longitude, myLatitude, myLongitude, 1); resolve({ lat: res.latitude, lon: res.longitude });
shopDetail.value.distance = distance;
}, },
fail: function (err) { fail: function (err) {
return err; return err;
}, },
}); });
});
}
// 计算距离的函数封装
async function calculateDistance() {
try {
const res = await getLocationFn();
const distance = getDistance(
res.lat,
res.lon,
shopDetail.value.shopLat,
shopDetail.value.shopLng,
1,
);
shopDetail.value.distance = distance;
console.log('distance', distance, shopDetail.value.shopLat, shopDetail.value.shopLng);
} catch (error) {
console.error('Error calculating distance:', error);
}
} }
/** /**
......
...@@ -99,7 +99,19 @@ ...@@ -99,7 +99,19 @@
</view> </view>
</view> </view>
</view> </view>
<wd-loadmore :state="state" @reload="getCouponList" /> <!-- <wd-loadmore :state="state" @reload="getCouponList" /> -->
<view
style="
width: 100%;
text-align: center;
font-size: 24rpx;
margin-top: 10rpx;
color: #888989;
"
v-if="isEnd"
>
没有更多啦~
</view>
</view> </view>
<wd-status-tip image="content" tip="暂无优惠券" v-else /> <wd-status-tip image="content" tip="暂无优惠券" v-else />
</view> </view>
...@@ -125,8 +137,10 @@ const currentTab = ref(0); ...@@ -125,8 +137,10 @@ const currentTab = ref(0);
const changeTab = (index) => { const changeTab = (index) => {
if (currentTab.value !== index) { if (currentTab.value !== index) {
currentTab.value = parseInt(index); currentTab.value = parseInt(index);
initCouponList().then(() => {
getStatistics(); getStatistics();
initCouponList(); getCouponList();
});
} }
}; };
...@@ -137,8 +151,10 @@ const currenStatus = ref(0); ...@@ -137,8 +151,10 @@ const currenStatus = ref(0);
const changeStatus = (index) => { const changeStatus = (index) => {
if (currenStatus.value !== index) { if (currenStatus.value !== index) {
currenStatus.value = index; currenStatus.value = index;
initCouponList().then(() => {
getStatistics(); getStatistics();
initCouponList(); getCouponList();
});
} }
}; };
...@@ -161,6 +177,7 @@ getStatistics(); ...@@ -161,6 +177,7 @@ getStatistics();
/** /**
* 获取用户优惠券列表 * 获取用户优惠券列表
*/ */
const isEnd = ref(false);
const state = ref('loading'); const state = ref('loading');
const total = ref(0); const total = ref(0);
const couponData = ref([]); const couponData = ref([]);
...@@ -171,12 +188,20 @@ const catalog = reactive({ ...@@ -171,12 +188,20 @@ const catalog = reactive({
statuSon: 0, statuSon: 0,
}); });
const getCouponList = async () => { const getCouponList = async () => {
// if (isEnd.value) return;
catalog.current++; catalog.current++;
state.value = 'loading'; state.value = 'loading';
catalog.statuMain = currentTab.value; catalog.statuMain = currentTab.value;
catalog.statuSon = currenStatus.value; catalog.statuSon = currenStatus.value;
console.log(catalog);
xma.showLoading({
title: '加载中...',
mask: true,
});
const res = await myCouponListApi(catalog); const res = await myCouponListApi(catalog);
if (res.data.records.length < catalog.size) {
isEnd.value = true;
}
if (res.data.records.length > 0) { if (res.data.records.length > 0) {
res.data.records.forEach((item) => { res.data.records.forEach((item) => {
item.showDetail = false; item.showDetail = false;
...@@ -184,24 +209,37 @@ const getCouponList = async () => { ...@@ -184,24 +209,37 @@ const getCouponList = async () => {
couponData.value.push(...res.data.records); couponData.value.push(...res.data.records);
total.value = res.data.total; total.value = res.data.total;
} }
state.value = 'finished'; // state.value = 'finished';
xma.hideLoading();
}; };
getCouponList(); getCouponList();
// 下拉刷新
onPullDownRefresh(() => {
getStatistics();
initCouponList().then(() => {
getCouponList();
xma.stopPullDownRefresh();
});
});
// 触底函数 // 触底函数
onReachBottom(() => { onReachBottom(() => {
if (couponData.value.length >= total.value) { if (couponData.value.length >= total.value) {
state.value = 'finished'; isEnd.value = true;
// state.value = 'finished';
} else { } else {
getCouponList(); getCouponList();
} }
}); });
const initCouponList = () => { const initCouponList = () => {
return new Promise((resolve, reject) => {
couponData.value = []; couponData.value = [];
total.value = 0; total.value = 0;
catalog.current = 0; catalog.current = 0;
getCouponList(); resolve();
});
}; };
/** /**
......
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