Merge pull request 'dev' (#2) from dev into master

Reviewed-on: #2
This commit is contained in:
mkm 2024-07-28 18:52:36 +08:00
commit 969ee92fd3
8 changed files with 325 additions and 24 deletions

View File

@ -6,4 +6,8 @@ export const goodListApi = (data) => {
export const goodClassListApi = (data) => {
return request.get('/cate/cate/lists', data);
}
export const storeProductListApi = (data) => {
return request.get('/product/product/store_lists', data);
}

View File

@ -318,6 +318,11 @@
{{ popPhone }}
</view>
</up-modal>
<!-- 加载中 -->
<!-- <view style="position: absolute; top: 34%; left: 42%;">
<up-loading-icon text="加载中" textSize="14" show="true" :vertical="true"></up-loading-icon>
</view> -->
</template>
<script setup>
@ -417,7 +422,7 @@
//
const setPhoneOneDay = () => {
if (uni.getStorageSync('VIP_PHONE')) return;
// if (uni.getStorageSync('VIP_PHONE')) return;
const currentDate = new Date();
const nextDay = new Date(currentDate);
nextDay.setDate(currentDate.getDate() + 1);
@ -568,7 +573,7 @@
} catch (error) {
uni.hideLoading()
uni.$u.toast('查询失败');
uni.$u.toast(error.msg ?? '查询失败');
}
}
}

View File

@ -92,6 +92,14 @@
"navigationBarTitleText": "购买礼包",
"enablePullDownRefresh": true
}
},
{
"path" : "pages/product/product",
"style" :
{
"navigationBarTitleText" : "商品列表",
"enablePullDownRefresh": true
}
}
],
"subPackages": [{

View File

@ -121,6 +121,7 @@
<up-cell title="预约记录" :isLink="true" url="/pageQuota/asset/lists"></up-cell> -->
<up-cell title="我的地址" :isLink="true" url="/pagesOrder/addressList/addressList"></up-cell>
<up-cell title="支付密码" :isLink="true" url="/pagesOrder/setPayPassword/index"></up-cell>
<!-- <up-cell title="商品列表" :isLink="true" url="pages/product/product"></up-cell> -->
</up-cell-group>
</view>

199
pages/product/product.vue Normal file
View File

@ -0,0 +1,199 @@
<template>
<view class="page-box1">
<up-sticky offset-top="5">
<up-subsection :list="list1" :current="where.type" @change="sectionChange"></up-subsection>
<view style="margin: 0 20rpx; background-color: white;">
<up-search placeholder="请输入商品" @search="searchKeyword" @clear="searchKeyword" v-model="keyword"
:showAction="false"></up-search>
</view>
</up-sticky>
<up-list @scrolltolower="loadMoreGood">
<view v-if="frequentlyList.length>0" class="list">
<up-list-item class="shop-item" v-for="(item, index) in frequentlyList" :key="index">
<image class="shop-img" :src="item.image"></image>
<view class="shop-content" style="width: 490rpx;">
<view class="title">
<view class="name u-line-2">{{item.store_name}}</view>
<view class="name u-line-2" style="color: red;">价格:{{item.price}}</view>
<!-- <view class="tip u-line-1">{{item.spec}}</view> -->
<view class="tip u-line-1">单位:{{item.unit_name}}</view>
<view class="tip u-line-1">规格:{{item.store_info}}</view>
<view class="tip u-line-1" style="justify-content: space-between;" v-if="item.batch">
<view style="display: flex;">
<view class="shop-content-li-l">起批量</view>
<view class="shop-content-li-r">{{ item.batch }}{{ item.unit_name }}起卖</view>
</view>
</view>
</view>
</view>
</up-list-item>
<up-loadmore :status="status" />
</view>
<view v-else style="margin-top: 100rpx;">
<up-empty :text="text"
icon="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/29955202404260944367594.png">
</up-empty>
</view>
</up-list>
</view>
</template>
<script setup>
import {
computed,
ref,
watch
} from 'vue';
import {
storeProductListApi
} from "@/api/good.js"
const frequentlyList = ref([]);
let text = '没有商品'
let status = ref('loadmore')
let list1 = ['零售', '商户', '会员']
let keyword = ref('');
const where = ref({
page_no: 1,
page_size: 15,
type: 0,
name: '',
store_name: '',
})
const getProductList = (loadmore = false) => {
if (loadmore) where.value.page_no++;
else where.value.page_no = 1;
storeProductListApi(where.value).then(res => {
if (res.data.lists.length == 0) {
status.value = 'nomore'
} else {
status.value = 'loadmore'
}
if (loadmore) {
frequentlyList.value.push(...res.data.lists);
} else {
frequentlyList.value = res.data.lists;
}
})
}
const sectionChange = (item) => {
where.value.type = item
getProductList()
}
const searchKeyword = () => {
where.value.name = keyword.value;
where.value.store_name = keyword.value;
getProductList();
}
//
const loadMoreGood = () => {
status.value = 'loading'
getProductList(true)
}
getProductList()
</script>
<style lang="scss">
.page-box1 {
position: relative;
.total {
// margin-top: 10rpx;
padding: 0 40rpx;
display: flex;
justify-content: space-between;
// position: sticky;
// top: var(--window-top);
// left: 0;
// right: 0;
z-index: 100000 !important;
height: 60rpx;
line-height: 60rpx;
font-size: 26rpx;
color: #444;
}
.list {
margin: 20rpx;
border-radius: 20rpx;
overflow: hidden;
// height: calc(100vh - var(--window-top) - 400rpx);
// /* #ifdef H5 */
// height: calc(100vh - 44px - 200rpx);
// /* #endif */
.shop-item {
padding: 20rpx;
border-bottom: 1rpx solid #f6f6f6;
background-color: #fff;
display: flex;
.shop-check {
width: 60rpx;
height: 120rpx;
display: flex;
align-items: center;
image {
width: 40rpx;
height: 40rpx;
}
}
.shop-img {
height: 164rpx;
width: 164rpx;
margin-right: 20rpx;
border-radius: 14rpx;
}
.shop-content {
width: 430rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.title {
.name {
font-size: 28rpx;
}
.tip {
color: #999;
font-size: 24rpx;
margin: 12rpx 0;
}
}
.price {
font-size: 30rpx;
font-weight: bold;
color: #F55726;
}
.price-btn {
display: flex;
justify-content: space-between;
.btn {
display: flex;
align-items: center;
.num {
margin: 0 20rpx;
text-align: center;
}
}
}
}
}
}
}
</style>

View File

@ -105,7 +105,7 @@
</view>
<view class="qr_code" v-if="datas.paid == 1 && datas.status == 1">
<up-image :src="datas.verify_img" width="404rpx" height="60rpx"></up-image>
<up-image :src="datas.verify_base64" width="404rpx" height="60rpx"></up-image>
<view style="font-weight: bold;color: #333;font-size: 26;margin-top: 20rpx;">
核销码 {{datas.verify_code}}
</view>

View File

@ -107,7 +107,7 @@
<view class="mask" v-if='showVerifyPop' @click="showVerifyPop=false">
<view
style="position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);background-color: white;padding: 20rpx;">
<up-image :src="orderData.verify_img" width="710rpx" height="105rpx"></up-image>
<up-image :src="orderData.verify_base64" width="710rpx" height="105rpx"></up-image>
<view style="font-weight: bold;color: #333;font-size: 26;text-align: center;margin-top: 20rpx;">
核销码 {{orderData.verify_code}}
</view>

View File

@ -98,7 +98,7 @@
<view class="row" v-if="[4,5,6].includes(userInfo.user_ship)" style="color: red;">
<view>优惠减免</view>
<view>
<text>-¥</text>{{ c_price(orderInfo.frozen_money, 0) }}<text>.{{ c_price(orderInfo.frozen_money, 1) }}</text>
<text>¥</text>{{ c_price(orderInfo.frozen_money, 0) }}<text>.{{ c_price(orderInfo.frozen_money, 1) }}</text>
</view>
</view>
<view class="row" v-if="userInfo.user_ship==1 ">
@ -209,6 +209,20 @@
<up-modal :show="showModal" title="您还没设置密码" :closeOnClickOverlay="true" zoom confirmText='去设置' showCancelButton
@close='showModal=false' @cancel='showModal=false' @confirm="navgo('/pagesOrder/setPayPassword/index')"
confirmColor='#27B52F' cancelText='取消'></up-modal>
<up-popup :show="LocationShow" mode="bottom" @open="LocationShowOpen()">
<view style="margin: 40rpx 10rpx;">
<up-row customStyle="margin-bottom: 10px" gutter="10">
<up-col span="6">
<up-button text="取消" @click="userLocationfalse()"></up-button>
</up-col>
<up-col span="6">
<up-button type="primary" text="设置授权" color="#20B128" @click="opensettings()"></up-button>
</up-col>
</up-row>
</view>
</up-popup>
</view>
</template>
@ -249,6 +263,7 @@
const cartStore = useCartStore();
const reservation_time = ref('')
const is_storage = ref(0)
const LocationShow = ref(false)
const formData = ref({
remark: ""
@ -547,26 +562,95 @@
}
onLoad(options => {
if (uni.getStorageSync('location')) {
location = JSON.parse(uni.getStorageSync('location'))
checkOrder();
} else {
uni.getLocation({
type: "gcj02",
success(res) {
location.lat = res.latitude;
location.long = res.longitude;
uni.setStorageSync('location', JSON.stringify(location))
checkOrder();
},
fail() {
uni.$u.toast('获取位置当前失败,为你推荐当前门店')
checkOrder(STORE_INFO.id);
},
complete() {}
})
}
// if (uni.getStorageSync('location')) {
// try {
// location = JSON.parse(uni.getStorageSync('location'))
// checkOrder();
// } catch (e) {
// getLocation()
// }
// } else {
getLocation()
// }
})
const getLocation = () => {
// #ifdef H5
userLocationfalse()
// #endif
// #ifdef MP-WEIXIN
uni.getSetting({
success(res) {
if (res.authSetting["scope.userLocation"] == false) {
LocationShowOpen()
} else {
opensettings(true)
}
}
})
// #endif
}
const LocationShowOpen = () => {
LocationShow.value = true;
}
const userLocationfalse = () => {
LocationShow.value = false;
uni.$u.toast('获取位置当前失败,为你推荐当前门店')
checkOrder(STORE_INFO.id);
}
const opensettings = (a = false) => {
if (a == false) {
uni.openSetting({
success(res) {
LocationShow.value = false;
if (res.authSetting["scope.userLocation"] == true) {
uni.authorize({
scope: 'scope.userLocation',
success() {
uni.getLocation({
type: "gcj02",
success(res) {
location.lat = res.latitude;
location.long = res.longitude;
uni.setStorageSync('location', JSON.stringify(
location))
checkOrder();
},
})
},
fail(e) {
userLocationfalse()
},
})
}
},
fail(e) {
userLocationfalse()
}
});
} else {
uni.authorize({
scope: 'scope.userLocation',
success() {
uni.getLocation({
type: "gcj02",
success(res) {
location.lat = res.latitude;
location.long = res.longitude;
uni.setStorageSync('location', JSON.stringify(location))
checkOrder();
},
})
},
fail(e) {
userLocationfalse()
},
})
}
}
onShow(() => {
getAddressList();
})