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

Merge remote-tracking branch 'origin/master'

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