Commit 8aa495e2 authored by 张娇(东信)'s avatar 张娇(东信)

Merge remote-tracking branch 'origin/master'

parents 6176d44f 1ba84420
...@@ -64,3 +64,12 @@ export function getCommentList(data) { ...@@ -64,3 +64,12 @@ export function getCommentList(data) {
data, data,
}); });
} }
// 评论列表数量统计和相同好评最多的评语
export function getEvalStatis(data) {
return request({
url: `/sgyrdd/evaluation/getEvalStatis`,
method: 'GET',
data,
});
}
...@@ -151,7 +151,7 @@ import { ...@@ -151,7 +151,7 @@ import {
previewOrderBasketUpdate, previewOrderBasketUpdate,
sgyOrderOrderInfo, sgyOrderOrderInfo,
} from '@/api/assistingAgriculture/shop'; } from '@/api/assistingAgriculture/shop';
import { groupBuyConfirm } from '@/api/confirmOrder'; import { groupBuyConfirm, groupBuyUpdate, groupBuyCreate } from '@/api/confirmOrder';
const imgUrl = import.meta.env.VITE_APP_IMG_URL; const imgUrl = import.meta.env.VITE_APP_IMG_URL;
const textInputs = ref(''); const textInputs = ref('');
const basketIds = ref([]); const basketIds = ref([]);
...@@ -171,10 +171,14 @@ onLoad((options) => { ...@@ -171,10 +171,14 @@ onLoad((options) => {
prodIds.value = prodId; prodIds.value = prodId;
skuIds.value = skuId; skuIds.value = skuId;
types.value = type; types.value = type;
basketIds.value = ids.split(',');
if (type === 'qg') { if (type === 'qg') {
groupBuyConfirmFn(prodId, skuId); groupBuyConfirmFn(prodId, skuId).then((res) => {
useraddrDefaultUserAddrFn().then(() => {
groupBuyUpdateFnQg();
});
});
} else { } else {
basketIds.value = ids.split(',');
sgyrddBasketConfirmFn(basketIds.value).then(() => { sgyrddBasketConfirmFn(basketIds.value).then(() => {
useraddrDefaultUserAddrFn().then(() => { useraddrDefaultUserAddrFn().then(() => {
groupBuyUpdateFn(); groupBuyUpdateFn();
...@@ -182,13 +186,35 @@ onLoad((options) => { ...@@ -182,13 +186,35 @@ onLoad((options) => {
}); });
} }
}); });
function groupBuyUpdateFnQg(couponUserId = '') {
const { receiverName, receiverMobile, receiverAddress } = addressParams.value;
groupBuyUpdate({
key: orderInfo.value.key,
couponUserId,
receiverName,
receiverMobile,
receiverAddress,
}).then((res) => {
if (res.code === 0) {
orderInfo.value = res.data;
}
});
}
onShow(() => { onShow(() => {
if (changeAddress.value) { if (changeAddress.value) {
sgyrddBasketConfirmFn(basketIds.value).then(() => { if (types.value === 'qg') {
useraddrDefaultUserAddrFn().then(() => { groupBuyConfirmFn(prodIds.value, skuIds.value).then((res) => {
groupBuyUpdateFn(); useraddrDefaultUserAddrFn().then(() => {
groupBuyUpdateFnQg();
});
}); });
}); } else {
sgyrddBasketConfirmFn(basketIds.value).then(() => {
useraddrDefaultUserAddrFn().then(() => {
groupBuyUpdateFn();
});
});
}
} }
if (outTradeNos.value) { if (outTradeNos.value) {
...@@ -226,7 +252,6 @@ function groupBuyConfirmFn(prodId, skuId) { ...@@ -226,7 +252,6 @@ function groupBuyConfirmFn(prodId, skuId) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
groupBuyConfirm({ prodId, skuId }).then((res) => { groupBuyConfirm({ prodId, skuId }).then((res) => {
if (res.code === 0) { if (res.code === 0) {
res.data.orderItems[0].pic = imgUrl + res.data.orderItems[0].pic;
orderInfo.value = res.data; orderInfo.value = res.data;
resolve(res.data.shopId); resolve(res.data.shopId);
} else { } else {
...@@ -257,7 +282,11 @@ function selectShopCoupon(item) { ...@@ -257,7 +282,11 @@ function selectShopCoupon(item) {
activeCouponId.value = item.couponId; activeCouponId.value = item.couponId;
activeCouponInfo.value = item; activeCouponInfo.value = item;
showpopup.value = false; showpopup.value = false;
groupBuyUpdateFn(item.couponUserId); if (types.value === 'qg') {
groupBuyUpdateFnQg(item.couponUserId);
} else {
groupBuyUpdateFn(item.couponUserId);
}
} else { } else {
xma.showToast({ xma.showToast({
title: '不满足优惠券使用条件', title: '不满足优惠券使用条件',
...@@ -268,18 +297,11 @@ function selectShopCoupon(item) { ...@@ -268,18 +297,11 @@ function selectShopCoupon(item) {
const jumpToAddressList = () => { const jumpToAddressList = () => {
changeAddress.value = true; changeAddress.value = true;
wx.navigateTo({ wx.navigateTo({
url: '/pages/address/list', url: '/pages/address/addressList',
}); });
}; };
function groupBuyUpdateFn(couponUserId) { function groupBuyUpdateFn(couponUserId) {
const { receiverName, receiverMobile, receiverAddress } = addressParams.value; const { receiverName, receiverMobile, receiverAddress } = addressParams.value;
console.log(
'receiverName, receiverMobile, receiverAddress',
receiverName,
receiverMobile,
receiverAddress,
);
previewOrderBasketUpdate({ previewOrderBasketUpdate({
receiverName, receiverName,
receiverMobile, receiverMobile,
...@@ -328,6 +350,7 @@ const params = ref({ ...@@ -328,6 +350,7 @@ const params = ref({
basketIds: [], basketIds: [],
remark: '', remark: '',
}); });
const PaymentRef = ref(null); const PaymentRef = ref(null);
const openZfType = () => { const openZfType = () => {
PaymentRef.value.open(); PaymentRef.value.open();
...@@ -336,28 +359,47 @@ const payNow = async (data) => { ...@@ -336,28 +359,47 @@ const payNow = async (data) => {
params.value.id = orderInfo.value.key; params.value.id = orderInfo.value.key;
params.value.tradeType = data.selectType; params.value.tradeType = data.selectType;
params.value.basketIds = basketIds.value; params.value.basketIds = basketIds.value;
znsgyOrderCreate(params.value).then((res) => { if (types.value === 'qg') {
if (res.code === 0) { const qgParams = {
const { paymentUrl, outTradeNo } = res.data.result; id: orderInfo.value.key,
outTradeNos.value = outTradeNo; placeOrderWay: 'sgy',
window.location.href = paymentUrl; payWayCode: 5,
// 设置一个延时器 tradeType: data.selectType,
const start = Date.now(); };
setTimeout(() => { groupBuyCreate(qgParams).then((res) => {
const end = Date.now(); if (res.code === 0) {
if (end - start < 1200) { openUrl(res.data.result);
// 如果 iframe 加载时间小于 1.2 秒,说明应用没有安装 } else {
xma.showToast({ groupBuyConfirmFn(prodIds.value, skuIds.value);
title: '未安装App', }
icon: 'error', });
}); } else {
// 这里可以跳转到应用下载页面 znsgyOrderCreate(params.value).then((res) => {
} if (res.code === 0) {
}, 1600); openUrl(res.data.result);
} else { } else {
groupBuyConfirmFn(prodIds.value, skuIds.value); groupBuyConfirmFn(prodIds.value, skuIds.value);
}
});
}
};
const openUrl = (result) => {
const { paymentUrl, outTradeNo } = result;
outTradeNos.value = outTradeNo;
window.location.href = paymentUrl;
// 设置一个延时器
const start = Date.now();
setTimeout(() => {
const end = Date.now();
if (end - start < 1200) {
// 如果 iframe 加载时间小于 1.2 秒,说明应用没有安装
xma.showToast({
title: '未安装App',
icon: 'error',
});
// 这里可以跳转到应用下载页面
} }
}); }, 1600);
}; };
</script> </script>
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
<script setup> <script setup>
import { ref } from 'vue'; import { ref } from 'vue';
import card from './card.vue'; import card from './card.vue';
import { getCommentList } from '../../../api/packageDetail';
const commentTypeList = [ const commentTypeList = [
{ {
text: '图/视频', text: '图/视频',
...@@ -114,7 +115,20 @@ const tagList = [ ...@@ -114,7 +115,20 @@ const tagList = [
value: 514, value: 514,
}, },
]; ];
const commentParameters = {
shopId: '1818876196597334017',
current: 1,
size: 10,
};
onLoad((options) => {
getCommentListFn();
});
const showMoreTag = ref(false); const showMoreTag = ref(false);
const getCommentListFn = () => {
getCommentList(commentParameters).then((res) => {
console.log('打印评论', res);
});
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -35,37 +35,30 @@ ...@@ -35,37 +35,30 @@
</view> </view>
<view class="comment-list"> <view class="comment-list">
<view class="comment-item" v-for="item in 3" :key="item"> <view class="comment-item" v-for="(item, index) in commentData" :key="index">
<view class="top"> <view class="top">
<view class="row"> <view class="row">
<image <image class="headPortrait" mode="aspectFill" :src="fileDomain + item.avatar"></image>
class="headPortrait"
mode="aspectFill"
src="@/static/assistingAgriculture/detail/detail-img.png"
></image>
<view class="right"> <view class="right">
<text class="name">略略略</text> <text class="name">{{ item.nickName }}</text>
<view class="ratebox"> <view class="ratebox">
<image <image class="rate-img" :src="rateList[item.merchantServices].url"></image>
class="rate-img" <text>{{ item.merchantServices }}.0分</text>
src="@/static/assistingAgriculture/detail/fiveStars.png" <text>{{ rateList[item.merchantServices].text }}</text>
></image>
<text>5.0分</text>
<text>好评</text>
</view> </view>
</view> </view>
</view> </view>
<text class="detail">2024-08-03 筑农散养虫子土鸡(未下蛋小母鸡)x2</text> <text class="detail">{{ item.createTime.slice(0, 10) }} {{ item.prodName }}x2</text>
</view> </view>
<view class="info"> <view class="info">
<text class="text">味道鲜美,煲出来的汤非常好喝,值得购买!</text> <text class="text">{{ item.evaluation }}</text>
<view class="imgbox"> <view class="imgbox" v-if="item.images.length > 0">
<image <image
class="img" class="img"
mode="aspectFill" mode="aspectFill"
src="@/static/assistingAgriculture/detail/detail-img.png" :src="fileDomain + img"
v-for="item in 6" v-for="img in item.images"
:key="item" :key="img"
></image> ></image>
</view> </view>
</view> </view>
...@@ -104,54 +97,44 @@ const tabs = ref([ ...@@ -104,54 +97,44 @@ const tabs = ref([
}, },
]); ]);
const rateList = ref([ const rateList = ref({
{ 1: {
value: 1, url: './../../static/assistingAgriculture/detail/oneStar.png',
url: '@/static/assistingAgriculture/index/oneStar.png',
text: '很糟', text: '很糟',
}, },
{ 2: {
value: 2, url: './../../static/assistingAgriculture/detail/twoStars.png',
url: '@/static/assistingAgriculture/index/twoStars.png',
text: '较差', text: '较差',
}, },
{ 3: {
value: 3, url: './../../static/assistingAgriculture/detail/threeStars.png',
url: '@/static/assistingAgriculture/index/threeStars.png',
text: '一般', text: '一般',
}, },
{ 4: {
value: 4, url: './../../static/assistingAgriculture/detail/fourStars.png',
url: '@/static/assistingAgriculture/index/fourStars.png',
text: '还行', text: '还行',
}, },
{ 5: {
value: 5, url: '../../../static/assistingAgriculture/detail/fiveStars.png',
url: '@/static/assistingAgriculture/index/fiveStars.png', text: '还行',
text: '超赞',
}, },
]); });
/** /**
* 获取用户优惠券列表 * 获取用户优惠券列表
*/ */
const isEnd = ref(false); const isEnd = ref(false);
const state = ref('loading');
const total = ref(0); const total = ref(0);
const couponData = ref([]); const commentData = ref([]);
const catalog = reactive({ const catalog = reactive({
current: 0, current: 0,
size: 10, size: 10,
statuMain: 0, shopId: '1818876196597334017',
statuSon: 0, evaluation: '', // 关键字搜索
type: '', // img-图片,append-追评,diff-中差评,good-好评
}); });
const getCouponList = async () => { const getList = async () => {
// if (isEnd.value) return;
catalog.current++; catalog.current++;
state.value = 'loading';
catalog.statuMain = currentTab.value;
catalog.statuSon = currenStatus.value;
console.log(catalog);
xma.showLoading({ xma.showLoading({
title: '加载中...', title: '加载中...',
mask: true, mask: true,
...@@ -162,12 +145,16 @@ const getCouponList = async () => { ...@@ -162,12 +145,16 @@ const getCouponList = async () => {
} }
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; if (item.images === '') {
item.images = [];
} else {
item.images = item.images.split(',');
}
}); });
couponData.value.push(...res.data.records); commentData.value.push(...res.data.records);
total.value = res.data.total; total.value = res.data.total;
console.log(commentData.value);
} }
// state.value = 'finished';
xma.hideLoading(); xma.hideLoading();
}; };
getList(); getList();
......
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