This commit is contained in:
zmj 2024-06-12 10:04:00 +08:00
parent e053e6f593
commit 35fc21e14e
5 changed files with 39 additions and 34 deletions

View File

@ -70,8 +70,7 @@
cart_num: '' cart_num: ''
}); });
const setData = (e) => { const setData = (e) => {
console.log(datas.value) console.log(e)
datas.value = e; datas.value = e;
} }

View File

@ -123,7 +123,7 @@
"path": "order/order", "path": "order/order",
"style": { "style": {
"navigationBarTitleText": "我的订单", "navigationBarTitleText": "我的订单",
"enablePullDownRefresh": true, "enablePullDownRefresh": false,
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },

View File

@ -61,7 +61,7 @@
<view v-if="frequentlyList.length>0" class="list"> <view v-if="frequentlyList.length>0" class="list">
<view class="shop-item" v-for="(item, index) in frequentlyList" :key="index" <view class="shop-item" v-for="(item, index) in frequentlyList" :key="index"
@click="openGoodPopup(item)"> @click="openGoodPopup(item)">
<image class="shop-img" :src="item.imgs"></image> <image class="shop-img" :src="item.image"></image>
<view class="shop-content" style="width: 490rpx;"> <view class="shop-content" style="width: 490rpx;">
<view class="title"> <view class="title">
<view class="name u-line-2">{{item.name}}</view> <view class="name u-line-2">{{item.name}}</view>
@ -69,7 +69,7 @@
<view class="tip u-line-1">{{item.unit_name}}</view> <view class="tip u-line-1">{{item.unit_name}}</view>
</view> </view>
<view class="price-btn"> <view class="price-btn">
<view class="price">{{item.sell}}</view> <view class="price">{{item.price}}</view>
<view class="btn"> <view class="btn">
<up-button size="small" plain color="#20b128" <up-button size="small" plain color="#20b128"
shape="circle">加入购物车</up-button> shape="circle">加入购物车</up-button>
@ -187,7 +187,6 @@
title: '请选择商品', title: '请选择商品',
icon: 'none' icon: 'none'
}); });
console.log(cartList.value)
cartList.value.forEach(item => { cartList.value.forEach(item => {
if (item.check) list.push(item.id); if (item.check) list.push(item.id);
}) })
@ -223,7 +222,7 @@
}; };
const changeGood = (data) => { // const changeGood = (data) => { //
showGoodPopup.value = false; showGoodPopup.value = false;
addCart(data.product_id, data.cart_num); addCart(data.product_id || data.id, data.cart_num);
} }
const cartList = ref([]); const cartList = ref([]);

View File

@ -2,9 +2,6 @@
<view class="content"> <view class="content">
<up-navbar placeholder style="z-index: 10080;"> <up-navbar placeholder style="z-index: 10080;">
<template #left> <template #left>
<view style="font-size: 30rpx;font-weight: bold;" @click="test">惠农批发 </view>
</template>
</up-navbar>
<view class="store-info" @click="navgo('/multipleShop/index/index')"> <view class="store-info" @click="navgo('/multipleShop/index/index')">
<view style="display: flex;font-size: 30rpx;font-weight: bold;"> <view style="display: flex;font-size: 30rpx;font-weight: bold;">
{{STORE_INFO.name}} {{STORE_INFO.name}}
@ -14,6 +11,8 @@
{{STORE_INFO.detailed_address}} {{STORE_INFO.detailed_address}}
</view> </view>
</view> </view>
</template>
</up-navbar>
<view class="navbar"> <view class="navbar">
<view style="width: 400rpx;"> <view style="width: 400rpx;">
<up-search placeholder="请输入商品" @search="searchKeyword" @clear="searchKeyword" v-model="keyword" <up-search placeholder="请输入商品" @search="searchKeyword" @clear="searchKeyword" v-model="keyword"
@ -547,6 +546,7 @@
justify-content: space-between; justify-content: space-between;
font-size: 22rpx; font-size: 22rpx;
color: #777; color: #777;
margin-top: 40rpx;
.nav-item { .nav-item {
display: flex; display: flex;
@ -946,5 +946,6 @@
.store-info { .store-info {
margin: 0 0 20rpx 20rpx; margin: 0 0 20rpx 20rpx;
margin-top: 80rpx;
} }
</style> </style>

View File

@ -16,7 +16,9 @@
<swiper class="swiper-box" :current="swiperCurrent" @animationfinish="animationfinish"> <swiper class="swiper-box" :current="swiperCurrent" @animationfinish="animationfinish">
<swiper-item class="swiper-item" v-for="(list, k) in orderList" :key="k"> <swiper-item class="swiper-item" v-for="(list, k) in orderList" :key="k">
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="loadMoreGood"> <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="loadMoreGood"
@refresherrefresh="refresherrefresh(1)" :refresher-triggered="triggered" refresher-enabled
refresher-background="#F6F6F6">
<view class="page-box"> <view class="page-box">
<view v-if="list.length>0" class="list"> <view v-if="list.length>0" class="list">
<good v-for="(item, index) in list" :datas="item" :key="index" :type="k" <good v-for="(item, index) in list" :datas="item" :key="index" :type="k"
@ -105,14 +107,12 @@
<script setup> <script setup>
import { import {
onLoad, onLoad,
onUnload onUnload,
onPullDownRefresh
} from "@dcloudio/uni-app" } from "@dcloudio/uni-app"
import { import {
ref ref
} from 'vue'; } from 'vue';
import {
onPullDownRefresh
} from "@dcloudio/uni-app"
import good from "./component/good.vue"; import good from "./component/good.vue";
import orderCanclePopup from "@/components/orderCanclePopup.vue" import orderCanclePopup from "@/components/orderCanclePopup.vue"
import modal from "@/components/modal.vue" import modal from "@/components/modal.vue"
@ -149,7 +149,6 @@
current current
} }
}) => { }) => {
console.log('current', current)
swiperCurrent.value = current; swiperCurrent.value = current;
tabsActive.value = current; tabsActive.value = current;
@ -338,7 +337,7 @@
[], [],
[] []
]) ])
const getOrderList = (type = 0, status = '', paid = 1) => { const getOrderList = (type = 0, status = '', paid = 1, ifPullReFresh = false) => {
if (where.value[type].loadend) return; if (where.value[type].loadend) return;
where.value[type].loading = true; where.value[type].loading = true;
orderListApi({ orderListApi({
@ -353,6 +352,8 @@
if (res.data.lists.length < where.value[type].page_size) where.value[type].loadend = true; if (res.data.lists.length < where.value[type].page_size) where.value[type].loadend = true;
where.value[type].page_no++; where.value[type].page_no++;
where.value[type].loading = false; where.value[type].loading = false;
if (ifPullReFresh) uni.stopPullDownRefresh();
}).catch(err => { }).catch(err => {
where.value[type].loading = false; where.value[type].loading = false;
}) })
@ -367,15 +368,17 @@
} }
// //
const searchOn = () => { const searchOn = (ifPullReFresh = false) => {
orderList.value[+swiperCurrent.value] = []; orderList.value[+swiperCurrent.value] = [];
where.value[+swiperCurrent.value].page_no = 1; where.value[+swiperCurrent.value].page_no = 1;
where.value[+swiperCurrent.value].loadend = false; where.value[+swiperCurrent.value].loadend = false;
if (swiperCurrent.value == 0) getOrderList(0, '', ''); // if (swiperCurrent.value == 0) getOrderList(0, '', '', ifPullReFresh); //
if (swiperCurrent.value == 1) getOrderList(1, '', 0); // if (swiperCurrent.value == 1) getOrderList(1, '', 0, ifPullReFresh); //
if (swiperCurrent.value == 2) getOrderList(2, 1, 1); // if (swiperCurrent.value == 2) getOrderList(2, 1, 1, ifPullReFresh); //
if (swiperCurrent.value == 3) getOrderList(3, 2, 1); // if (swiperCurrent.value == 3) getOrderList(3, 2, 1, ifPullReFresh); //
if (swiperCurrent.value == 4) getOrderList(4, -1, 1); //退 if (swiperCurrent.value == 4) getOrderList(4, -1, 1, ifPullReFresh); //退
} }
let back = 0; let back = 0;
@ -413,11 +416,14 @@
uni.$off('reLoadOrderList', reloadAll) uni.$off('reLoadOrderList', reloadAll)
}) })
onPullDownRefresh(() => { const triggered = ref(false);
const refresherrefresh = (type = 1) => {
triggered.value = true;
searchOn() searchOn()
console.log(454) setTimeout(() => {
uni.stopPullDownRefresh() triggered.value = false;
}) }, 500)
}
</script> </script>
<style lang="scss"> <style lang="scss">