Commit 89025b19 authored by 张娇(东信)'s avatar 张娇(东信)

Merge remote-tracking branch 'origin/master'

parents 649dea1b dadb792e
import { request } from '../utils/request';
export function groupBuyList() {
return request({
url: '/sgyrdd/category/groupBuyList',
method: 'GET',
});
}
// 新增收货地址
export async function addAddress() {
return request({
url: '/sgyrdd/useraddr/add',
method: 'GET',
});
}
// 修改收货地址
export async function updateAddress() {
return request({
url: '/sgyrdd/useraddr/update',
method: 'GET',
});
}
// 删除收货地址
export async function deleteAddress(addrId) {
return request({
url: `/sgyrdd/useraddr/delete/${addrId}`,
method: 'GET',
});
}
// 查询收货地址列表
export async function getAddressList() {
return request({
url: '/sgyrdd/useraddr/list',
method: 'GET',
});
}
...@@ -7,7 +7,22 @@ export function getProdDetail(data) { ...@@ -7,7 +7,22 @@ export function getProdDetail(data) {
method: 'GET', method: 'GET',
}); });
} }
// 商品详情评论数量和好评率
export function getEvalNumber(data) {
return request({
url: `/sgyrdd/evaluation/getEvalNumber`,
method: 'GET',
data,
});
}
// 加入购物车
export function addOrder(data) {
return request({
url: `/sgyrdd/sgyBasket/add`,
method: 'POST',
data,
});
}
// 套餐详情 // 套餐详情
export function getCollect(data) { export function getCollect(data) {
return request({ return request({
......
...@@ -16,3 +16,4 @@ export function applyShop(data) { ...@@ -16,3 +16,4 @@ export function applyShop(data) {
data, data,
}); });
} }
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
"path": "pages/index/loading", "path": "pages/index/loading",
"style": { "style": {
"navigationBarTitleText": "加载", "navigationBarTitleText": "加载",
"navigationStyle":"custom", "navigationStyle":"custom"
} }
}, },
{ {
......
<template> <template>
<view class="container"> <view class="container">
<template v-if="newAddressFlag"> <Header :title="newAddressFlag ? '新增收货地址' : '编辑收货地址'"></Header>
<Header title="新增收货地址"></Header>
</template>
<template v-else>
<Header title="编辑收货地址"></Header>
</template>
<view class="content"> <view class="content">
<wd-form ref="form" :model="model" id="form"> <wd-form ref="form" :model="model" id="form">
<wd-cell-group border> <wd-cell-group>
<wd-input <wd-input
label="联系人" label="联系人"
label-width="80px" label-width="80px"
prop="name" prop="receiver"
v-model="model.name" v-model="model.receiver"
placeholder="请输入联系人姓名" placeholder="请输入联系人姓名"
:rules="[{ required: false, validator: fieldNotEmpty, message: '姓名不能为空' }]" :rules="[{ required: false, validator: fieldNotEmpty, message: '姓名不能为空' }]"
/> />
<wd-input <wd-input
label="手机号" label="手机号"
label-width="80px" label-width="80px"
prop="phone" prop="mobile"
v-model="model.phone" v-model="model.mobile"
placeholder="请输入联系人手机号" placeholder="请输入联系人手机号"
:rules="[{ required: false, pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号' }]" :rules="[{ required: false, pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号' }]"
/> />
<wd-input <wd-input
label="详细地址" label="详细地址"
label-width="80px" label-width="80px"
prop="detailAddress" prop="addr"
v-model="model.detailAddress" v-model="model.addr"
placeholder="请输入详细地址" placeholder="请输入详细地址"
:rules="[{ required: false, validator: fieldNotEmpty, message: '详细地址不能为空' }]" :rules="[{ required: false, validator: fieldNotEmpty, message: '详细地址不能为空' }]"
/> />
...@@ -46,11 +42,11 @@ ...@@ -46,11 +42,11 @@
</view> </view>
</wd-cell> </wd-cell>
</wd-checkbox-group> </wd-checkbox-group>
<wd-checkbox-group v-model="model.isDefaultAddress" size="large"> <wd-checkbox-group v-model="model.commonAddr" size="large">
<wd-cell title="设置为默认地址" center clickable @click="setDefaultAddress"> <wd-cell title="设置为默认地址" center clickable @tap="setDefaultAddress">
<view> <view>
<wd-checkbox <wd-checkbox
model-value="1" modelValuee="1"
ref="checkBoxAdress" ref="checkBoxAdress"
checked-color="#fa5151" checked-color="#fa5151"
custom-style="margin-right:-18rpx" custom-style="margin-right:-18rpx"
...@@ -61,7 +57,7 @@ ...@@ -61,7 +57,7 @@
</wd-cell-group> </wd-cell-group>
<view class="footer"> <view class="footer">
<wd-button type="error" block class="addBtn" @click="handleSubmit">保存</wd-button> <wd-button type="error" block class="addBtn" @tap="handleSubmit">保存</wd-button>
</view> </view>
</wd-form> </wd-form>
</view> </view>
...@@ -70,8 +66,9 @@ ...@@ -70,8 +66,9 @@
<script setup> <script setup>
import Header from '@/pages/order/components/Header/index.vue'; import Header from '@/pages/order/components/Header/index.vue';
import { addAddress, updateAddress, deleteAddress } from '@/api/address';
const fileDomain = import.meta.env.VITE_APP_IMG_URL; const fileDomain = import.meta.env.VITE_APP_IMG_URL;
const newAddressFlag = ref(false); const newAddressFlag = ref(false);
const form = ref(); const form = ref();
const checkBoxAdress = ref(); const checkBoxAdress = ref();
...@@ -92,9 +89,9 @@ onLoad((options) => { ...@@ -92,9 +89,9 @@ onLoad((options) => {
isDefaultAddress: [], isDefaultAddress: [],
}); });
} else { } else {
model.value.name = '这是名字'; model.value.name = '';
model.value.phone = '13655844265'; model.value.phone = '';
model.value.detailAddress = '贵州省贵阳市南明区'; model.value.detailAddress = '';
model.value.isDefaultAddress = ['1']; model.value.isDefaultAddress = ['1'];
} }
}); });
...@@ -111,6 +108,10 @@ function fieldNotEmpty(val) { ...@@ -111,6 +108,10 @@ function fieldNotEmpty(val) {
return false; return false;
} }
} }
const submit = async () => {
const res = await addAddress(model.value);
console.log(res);
};
function handleSubmit() { function handleSubmit() {
form.value form.value
.validate() .validate()
...@@ -146,15 +147,19 @@ page { ...@@ -146,15 +147,19 @@ page {
font-family: Source Han Sans; font-family: Source Han Sans;
font-variation-settings: 'opsz' auto; font-variation-settings: 'opsz' auto;
font-feature-settings: 'kern' on; font-feature-settings: 'kern' on;
.content { .content {
padding-top: 88rpx; padding-top: 88rpx;
#form { #form {
width: 710rpx; width: 710rpx;
margin: 20rpx auto; margin: 20rpx auto;
} }
.wd-input__label.is-required::after { .wd-input__label.is-required::after {
display: none !important; display: none !important;
} }
.addBtn { .addBtn {
width: 630rpx; width: 630rpx;
height: 72rpx; height: 72rpx;
...@@ -171,10 +176,12 @@ page { ...@@ -171,10 +176,12 @@ page {
display: flex; display: flex;
width: 100%; width: 100%;
align-items: center; align-items: center;
.area_l { .area_l {
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.area_lt { .area_lt {
font-size: 24rpx; font-size: 24rpx;
font-weight: 500; font-weight: 500;
...@@ -183,6 +190,7 @@ page { ...@@ -183,6 +190,7 @@ page {
text-align: left; text-align: left;
margin-bottom: 10rpx; margin-bottom: 10rpx;
} }
.area_lb { .area_lb {
font-size: 24rpx; font-size: 24rpx;
font-weight: normal; font-weight: normal;
...@@ -191,6 +199,7 @@ page { ...@@ -191,6 +199,7 @@ page {
text-align: left; text-align: left;
} }
} }
.area_r { .area_r {
width: 40rpx; width: 40rpx;
} }
......
...@@ -7,41 +7,21 @@ ...@@ -7,41 +7,21 @@
<img src="@/static/address/address.png" /> <img src="@/static/address/address.png" />
<wd-button type="error" block class="addBtn" @tap="addNewAddress">新增地址</wd-button> <wd-button type="error" block class="addBtn" @tap="addNewAddress">新增地址</wd-button>
</view> </view>
<view class="full_list" v-else> <view class="full_list" v-else>
<view class="additem"> <view class="additem" v-for="(item, index) in addressList" :key="index">
<view class="additem_l">
<view class="address">这是地址这是地址这是地址这是地址这是地 址这是地址这是地址</view>
<view class="info">
<view class="name">这是姓名</view>
<view class="phone">123456789258</view>
</view>
<view class="address_status">
<view v-if="mainAddFlag" class="box active">
<wd-icon name="check-circle-filled" size="12px"></wd-icon>
<view class="txt">默认</view>
</view>
<view v-else class="box">
<wd-icon name="circle1" size="12px"></wd-icon>
<view class="txt">默认</view>
</view>
</view>
</view>
<view class="additem_r">
<wd-icon name="edit-outline" size="14px" @tap="editAddress"></wd-icon>
</view>
</view>
<view class="additem">
<view class="additem_l"> <view class="additem_l">
<view class="address">这是地址这是地址这是地址这是地址这是地 址这是地址这是地址</view> <view class="address">{{ item.addr }}</view>
<view class="info"> <view class="info">
<view class="name">这是姓名</view> <view class="name">{{ item.receiver }}</view>
<view class="phone">123456789258</view> <view class="phone">{{ item.mobile }}</view>
</view> </view>
<view class="address_status"> <view class="address_status">
<view v-if="mainAddFlag" class="box active"> <view v-if="item.commonAddr === 1" class="box active">
<wd-icon name="check-circle-filled" size="12px"></wd-icon> <wd-icon name="check-circle-filled" size="12px"></wd-icon>
<view class="txt">默认</view> <view class="txt">默认</view>
</view> </view>
<view v-else class="box"> <view v-else class="box">
<wd-icon name="circle1" size="12px"></wd-icon> <wd-icon name="circle1" size="12px"></wd-icon>
<view class="txt">默认</view> <view class="txt">默认</view>
...@@ -52,6 +32,7 @@ ...@@ -52,6 +32,7 @@
<wd-icon name="edit-outline" size="14px" @tap="editAddress"></wd-icon> <wd-icon name="edit-outline" size="14px" @tap="editAddress"></wd-icon>
</view> </view>
</view> </view>
<wd-button type="error" block class="addBtn" @tap="addNewAddress">新增地址</wd-button> <wd-button type="error" block class="addBtn" @tap="addNewAddress">新增地址</wd-button>
</view> </view>
</view> </view>
...@@ -60,9 +41,23 @@ ...@@ -60,9 +41,23 @@
<script setup> <script setup>
import Header from '@/pages/order/components/Header/index.vue'; import Header from '@/pages/order/components/Header/index.vue';
const fileDomain = import.meta.env.VITE_APP_IMG_URL;
import { getAddressList, deleteAddress } from '@/api/address';
const isAdressEmpty = ref(false); const isAdressEmpty = ref(false);
const mainAddFlag = ref(false); const mainAddFlag = ref(false);
const addressList = ref([]);
const getAddressListData = async () => {
const { data: res } = await getAddressList();
console.log(res);
if (res) {
addressList.value = res;
res.length === 0 ? (isAdressEmpty.value = true) : (isAdressEmpty.value = false);
}
};
getAddressListData();
const addNewAddress = () => { const addNewAddress = () => {
xma.navigateTo({ url: '/pages/address/addressEdit?new=true' }); xma.navigateTo({ url: '/pages/address/addressEdit?new=true' });
...@@ -97,6 +92,7 @@ page { ...@@ -97,6 +92,7 @@ page {
.full_list { .full_list {
margin-top: 20rpx; margin-top: 20rpx;
.additem { .additem {
width: 710rpx; width: 710rpx;
padding: 20rpx; padding: 20rpx;
...@@ -109,17 +105,20 @@ page { ...@@ -109,17 +105,20 @@ page {
font-family: Source Han Sans; font-family: Source Han Sans;
font-variation-settings: 'opsz' auto; font-variation-settings: 'opsz' auto;
font-feature-settings: 'kern' on; font-feature-settings: 'kern' on;
.additem_l { .additem_l {
width: 600rpx; width: 600rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.additem_r { .additem_r {
flex: 1; flex: 1;
padding-top: 30rpx; padding-top: 30rpx;
box-sizing: border-box; box-sizing: border-box;
text-align: right; text-align: right;
} }
.address { .address {
font-size: 24rpx; font-size: 24rpx;
font-weight: 500; font-weight: 500;
...@@ -136,6 +135,7 @@ page { ...@@ -136,6 +135,7 @@ page {
color: #abaaaa; color: #abaaaa;
display: flex; display: flex;
margin-bottom: 30rpx; margin-bottom: 30rpx;
.phone { .phone {
margin-left: 10rpx; margin-left: 10rpx;
} }
...@@ -146,11 +146,13 @@ page { ...@@ -146,11 +146,13 @@ page {
display: flex; display: flex;
font-size: 18rpx; font-size: 18rpx;
align-items: center; align-items: center;
.txt { .txt {
margin-left: 5rpx; margin-left: 5rpx;
color: #abaaaa; color: #abaaaa;
} }
} }
.box.active { .box.active {
color: #fa5151; color: #fa5151;
} }
...@@ -172,12 +174,13 @@ page { ...@@ -172,12 +174,13 @@ page {
.empty_list { .empty_list {
margin-top: 20rpx; margin-top: 20rpx;
img { img {
width: 566rpx; width: 566rpx;
height: 566rpx; height: 566rpx;
margin: 40rpx auto 60rpx; margin: 40rpx auto 60rpx;
display: block; display: block;
border: 1px dashed rgb(182, 182, 182); // border: 1px dashed rgb(182, 182, 182);
} }
.addBtn { .addBtn {
......
...@@ -13,51 +13,42 @@ ...@@ -13,51 +13,42 @@
</view> </view>
<!-- 图片--> <!-- 图片-->
<view class="nav"> <view class="nav">
<img <wd-swiper
class="main-img" :list="dataDetails.prod.imgs"
src="/static/assistingAgriculture/detail/img2.png" autoplay
style="width: 750rpx; height: 668rpx" :indicator="{ type: 'fraction' }"
/> indicatorPosition="bottom-right"
<view class="pre-icon"> @click="handleClick"
<img @change="onChange"
class="left-icon" height="512rpx"
src="/static/assistingAgriculture/detail/img4.png" ></wd-swiper>
style="width: 248rpx; height: 100rpx; position: relative"
/>
<img
class="right-icon"
src="/static/assistingAgriculture/detail/img3.png"
style="width: 546rpx; height: 62rpx"
/>
</view>
<view class="pre-text">
<text class="left-text">预售</text>
<text class="right-text">预计9月15日发货</text>
</view>
</view> </view>
<!--详情--> <!--详情-->
<view class="detail"> <view class="detail">
<view class="detail-title">筑农散养虫子土鸡(未下蛋小母鸡)1.5kg</view> <view class="detail-title">{{ dataDetails.prod.prodName }}</view>
<view class="detail-int"> <view class="detail-int">
这是商品简介这是商品简介这是商品简介这是商品简介这是商品 简介这是商品简介这是商品简介 {{ dataDetails.prodPresale.memo }}
</view> </view>
<view> <!-- <view>
<img class="share-img" src="/static/assistingAgriculture/detail/share.png" /> <img class="share-img" src="/static/assistingAgriculture/detail/share.png" />
<text class="share-text" @click="share">分享</text> <text class="share-text" @click="share">分享</text>
</view> </view> -->
</view> </view>
<view class="evaluate"> <view class="evaluate">
<view class="evaluate-num"> <view class="evaluate-num">
<text class="env">评价(0</text> <text class="env">评价({{ commentData.count }}</text>
<text class="num">好评率(100%)</text> <text class="num">好评率({{ commentData.high }} %)</text>
<wd-icon name="arrow-right" size="32rpx" style="margin-top: 2rpx"></wd-icon> <wd-icon name="arrow-right" size="32rpx" style="margin-top: 2rpx"></wd-icon>
</view> </view>
</view> </view>
<!-- 详情图--> <!-- 详情图-->
<view class="detail-info"> <view class="detail-info">
<text class="info-title">详情</text> <text class="info-title">详情</text>
<img class="info-img" src="/static/assistingAgriculture/detail/detail-img.png" /> <!-- <img class="info-img" src="/static/assistingAgriculture/detail/detail-img.png" />
<img class="info-img" src="/static/assistingAgriculture/detail/detail-img.png" /> <img class="info-img" src="/static/assistingAgriculture/detail/detail-img.png" /> -->
<view class="content">
<rich-text class="desc" :nodes="dataDetails.prod.content"></rich-text>
</view>
</view> </view>
<!-- 底部--> <!-- 底部-->
<view class="detail-bottom"> <view class="detail-bottom">
...@@ -70,13 +61,13 @@ ...@@ -70,13 +61,13 @@
/> />
<view class="sort-text">店铺</view> <view class="sort-text">店铺</view>
</view> </view>
<view class="borderClass"> <!-- <view class="borderClass">
<img <img
src="/static/assistingAgriculture/detail/img8.png" src="/static/assistingAgriculture/detail/img8.png"
style="width: 40rpx; height: 40rpx" style="width: 40rpx; height: 40rpx"
/> />
<view class="sort-text">客服</view> <view class="sort-text">客服</view>
</view> </view> -->
<view class="borderClass" @tap="toCart"> <view class="borderClass" @tap="toCart">
<wd-badge modelValue="4"> <wd-badge modelValue="4">
<img <img
...@@ -95,7 +86,9 @@ ...@@ -95,7 +86,9 @@
<!-- </view>--> <!-- </view>-->
<!-- </view>--> <!-- </view>-->
<view class="btn"> <view class="btn">
<wd-button type="warning" size="small" style="margin-right: 10rpx">加入购物车</wd-button> <wd-button @tap="addOrderFn" type="warning" size="small" style="margin-right: 10rpx">
加入购物车
</wd-button>
<wd-button type="error" size="small" @tap="toSettle">立即购买</wd-button> <wd-button type="error" size="small" @tap="toSettle">立即购买</wd-button>
</view> </view>
</view> </view>
...@@ -107,19 +100,86 @@ ...@@ -107,19 +100,86 @@
import Search from '../../../components/assistingAgriculture/index/Search.vue'; import Search from '../../../components/assistingAgriculture/index/Search.vue';
import { ref } from 'vue'; import { ref } from 'vue';
import { onShow } from '@dcloudio/uni-app'; import { onShow } from '@dcloudio/uni-app';
import {
getProdDetail,
getEvalNumber,
addOrder,
getCollect,
getCouponShopList,
receiveCoupon,
} from '@/api/packageDetail';
const imgUrl = import.meta.env.VITE_APP_IMG_URL;
// 图片 // 图片
const swiperList = ref([ const swiperList = ref([
'../../static/assistingAgriculture/detail/img2.png', '../../static/assistingAgriculture/detail/img2.png',
'../../static/assistingAgriculture/detail/img2.png', '../../static/assistingAgriculture/detail/img2.png',
'../../static/assistingAgriculture/detail/img2.png', '../../static/assistingAgriculture/detail/img2.png',
]); ]);
const swiperList2 = ref([
'https://registry.npmmirror.com/wot-design-uni-assets/*/files/redpanda.jpg',
'https://registry.npmmirror.com/wot-design-uni-assets/*/files/capybara.jpg',
'https://registry.npmmirror.com/wot-design-uni-assets/*/files/panda.jpg',
'https://registry.npmmirror.com/wot-design-uni-assets/*/files/moon.jpg',
'https://registry.npmmirror.com/wot-design-uni-assets/*/files/meng.jpg',
]);
// 底部 // 底部
const storeList = ref([ const storeList = ref([
{ img: '/static/assistingAgriculture/detail/img7.png', text: '店铺' }, { img: '/static/assistingAgriculture/detail/img7.png', text: '店铺' },
{ img: '/static/assistingAgriculture/detail/img8.png', text: '客服' }, { img: '/static/assistingAgriculture/detail/img8.png', text: '客服' },
{ img: '/static/assistingAgriculture/detail/img6.png', text: '购物车' }, { img: '/static/assistingAgriculture/detail/img6.png', text: '购物车' },
]); ]);
let prodId;
const dataDetails = ref({});
const commentData = ref({});
onLoad((options) => {
prodId = '43834';
getProdDetailFn();
getEvalNumberFn();
});
function handleClick(e) {
console.log(e);
}
function onChange(e) {
console.log(e);
}
// 获取商品详情
const getProdDetailFn = () => {
getProdDetail(prodId).then((res) => {
res.data.data.prod.imgs = res.data.data.prod.imgs
.split(',')
.map((item) => {
if (item !== '') {
item = imgUrl + item;
}
return item;
})
.filter((item) => {
return item !== '';
});
dataDetails.value = res.data.data;
console.log('打印', dataDetails.value);
});
};
// 获取商品评价数量
const getEvalNumberFn = () => {
getEvalNumber({ prodId }).then((res) => {
console.log('评价数量', res);
commentData.value = res.data;
});
};
// 加入购物车
const addOrderFn = () => {
const orderParams = {
shopId: dataDetails.value.prod.prodId,
prodId: dataDetails.value.prodParameters.prodId,
skuId: dataDetails.value.skus[0].skuId,
shopType: 3,
basketCount: 1,
};
addOrder(orderParams).then((res) => {
console.log('加入购物车', res);
});
};
// 进入页面回到顶部 // 进入页面回到顶部
onShow(() => { onShow(() => {
uni.pageScrollTo({ uni.pageScrollTo({
...@@ -322,6 +382,13 @@ page { ...@@ -322,6 +382,13 @@ page {
z-index: 9; z-index: 9;
top: -8rpx; top: -8rpx;
padding-bottom: 120rpx; padding-bottom: 120rpx;
.content {
.desc {
img {
width: 100%;
}
}
}
} }
.info-title { .info-title {
width: 64rpx; width: 64rpx;
......
...@@ -10,8 +10,8 @@ import { getTokenUser } from '../../api/index'; ...@@ -10,8 +10,8 @@ import { getTokenUser } from '../../api/index';
import { getToken } from '../../utils/auth'; import { getToken } from '../../utils/auth';
onMounted(async () => { onMounted(async () => {
// await signIn(); await signIn();
if (!getToken()) await signIn2(); // if (!getToken()) await signIn2();
xma.reLaunch({ url: '/pages/index/index' }); xma.reLaunch({ url: '/pages/index/index' });
}); });
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
class="pubList" class="pubList"
v-for="item in list" v-for="item in list"
:key="item.shopId" :key="item.shopId"
@click="item.shopStatus != [1, 2, 3] ? shopGto(item.shopId) : ''" @click="item.shopStatus != [1, 2, 3] ? shopGto(item) : ''"
> >
<!-- 列表头部 --> <!-- 列表头部 -->
<view class="titlecon"> <view class="titlecon">
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
</view> </view>
</view> </view>
<view class="shbox" v-if="list.length > 0">审核被拒可点击修改重新提交</view> <view class="shbox" v-if="list.length > 0">审核被拒可点击修改重新提交</view>
<wd-status-tip image="content" tip="暂无内容" v-else />
</view> </view>
<view class="butCon"><button class="butXz" @click="shopGto()">申请入驻</button></view> <view class="butCon"><button class="butXz" @click="shopGto()">申请入驻</button></view>
</view> </view>
...@@ -70,8 +71,12 @@ const getList = async () => { ...@@ -70,8 +71,12 @@ const getList = async () => {
} }
}; };
const shopGto = (item) => { const shopGto = (item) => {
xma.redirectTo({ xma.navigateTo({
url: `/pages/storeEntry/detail${item ? `?id=${item}` : ''}`, url: `/pages/storeEntry/detail${item ? `?content=0` : ''}`,
success: function (res) {
// 通过eventChannel向被打开页面传送数据
res.eventChannel.emit('acceptDataFromOpenerPage', { data: item });
},
}); });
}; };
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