完成团购模块

This commit is contained in:
赵毅 2025-08-23 11:54:58 +08:00
parent 0b302c5bbe
commit 4d1dcb72cb
16 changed files with 1606 additions and 1151 deletions

View File

@ -12,5 +12,7 @@ export const apiArr = {
payOrder: "/api/v2/wechat/commodity/order/pay",//支付订单 payOrder: "/api/v2/wechat/commodity/order/pay",//支付订单
settingDefaultAddress: '/api/v2/wechat/commodity/receiving_address/default', // 收货地址设置默认 settingDefaultAddress: '/api/v2/wechat/commodity/receiving_address/default', // 收货地址设置默认
updateAddress: '/api/v2/wechat/commodity/receiving_address/update', // 收货地址修改 updateAddress: '/api/v2/wechat/commodity/receiving_address/update', // 收货地址修改
addAddress: '/api/v2/wechat/commodity/receiving_address/add', // 收货地址添加
addAddressList: '/api/v2/wechat/commodity/receiving_address', // 收货地址列表
queryOrder: '/api/v2/wechat/commodity/order/trade_query', // 查询订单 queryOrder: '/api/v2/wechat/commodity/order/trade_query', // 查询订单
} }

View File

@ -1,167 +1,209 @@
[ [
{ {
"id": 1001, "id": 1001,
"user_id": 2001, "user_id": 20001,
"supplier_id": 3001, "supplier_id": 3001,
"supplier_name": "生鲜优选", "supplier_name": "鲜丰水果供应链有限公司",
"order_group_id": 5001, "order_group_id": 40001,
"order_no": "DD202508131001", "order_no": "SH20240823001001",
"total_amount": 88.50, "total_amount": 156.80,
"total_count": 3, "total_count": 3,
"order_status": 1, "order_status": 3,
"cancelled_by": "",
"cancel_time": "",
"cancel_reason": "",
"evauate_status": 2, "evauate_status": 2,
"after_sales_status": 2, "after_sales_status": 2,
"receiving_name": "张三", "receiving_name": "李佳",
"receiving_phone": "13800138001", "receiving_phone": "15901518415",
"receiving_address": "北京市朝阳区科技园A座101", "receiving_address": "北京市朝阳区珠江绿洲文化广场3号楼2单元1002室",
"pay_method": "微信支付", "pay_method": "微信支付",
"payment_amount": 0, "payment_amount": 156.80,
"payment_status": "未支付", "payment_status": "已支付",
"payment_serial": "", "payment_time": "2024-08-23 10:15:30",
"payer_name": "", "payment_serial": "WX202408231015300012345678",
"order_time": "2025-08-13T10:30:00Z", "payer_name": "李佳",
"is_same_day": 1, "completed_at": "",
"estimated_delivery_time": "今日14:00-16:00", "order_time": "2024-08-23 10:10:22",
"remark": "请尽快配送", "is_same_day": 2,
"shiliu_score": 88.5, "estimated_delivery_time": "2024-08-24 09:00-18:00",
"shiliu_seed": 22.1, "remark": "请放在小区丰巢柜,谢谢",
"timeout_time_stamp": 1755086400, "shiliu_score": 156.8,
"shiliu_seed": 28.5,
"timeout_time_stamp": 1724413822,
"order_cate": 1,
"create_time": "2024-08-23 10:10:22",
"update_time": "2024-08-23 10:15:30",
"after_sales_count": 0,
"commodity_order_item_list": [ "commodity_order_item_list": [
{ {
"id": 7001, "id": 50001,
"order_id": 1001, "order_id": 1001,
"goods_id": 8001, "goods_id": 6001,
"goods_name": "澳洲牛排", "goods_name": "泰国金枕榴莲2-2.5斤/个)",
"commodity_pic": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", "commodity_pic": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
"goods_unit": "", "goods_unit": "",
"goods_spec": "200g/盒", "goods_spec": "2-2.5斤",
"cost_price": 45.0, "cost_price": 45.00,
"sales_price": 68.0, "sales_price": 69.90,
"count": 1, "count": 1,
"after_sales_status": 2,
"is_support_same_day": 1, "is_support_same_day": 1,
"is_same_day": true "is_same_day": false
}, },
{ {
"id": 7002, "id": 50002,
"goods_id": 8002, "order_id": 1001,
"goods_name": "有机西兰花", "goods_id": 6002,
"goods_name": "阳光玫瑰葡萄1斤装",
"commodity_pic": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", "commodity_pic": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
"goods_unit": "", "goods_unit": "",
"goods_spec": "500g/份", "goods_spec": "1斤",
"cost_price": 8.0, "cost_price": 12.00,
"sales_price": 10.5, "sales_price": 25.90,
"count": 2, "count": 2,
"after_sales_status": 2,
"is_support_same_day": 1, "is_support_same_day": 1,
"is_same_day": true "is_same_day": false
} }
] ]
}, },
{ {
"id": 1002, "id": 1002,
"order_no": "DD202508131002", "user_id": 20002,
"total_amount": 152.0, "supplier_id": 3002,
"total_count": 5, "supplier_name": "优选生鲜超市供应链",
"order_status": 2, "order_group_id": 40002,
"payment_status": "支付中", "order_no": "SH20240823001002",
"payment_time": "2025-08-13T10:35:22Z", "total_amount": 89.50,
"payer_name": "李四", "total_count": 2,
"order_time": "2025-08-13T10:32:15Z", "order_status": 6,
"cancelled_by": "用户",
"cancel_time": "2024-08-23 09:45:10",
"cancel_reason": "临时改变需求,不需要该商品",
"evauate_status": 2,
"after_sales_status": 2,
"receiving_name": "张伟",
"receiving_phone": "13812345678",
"receiving_address": "上海市浦东新区张江高科技园区博云路2号",
"pay_method": "支付宝支付",
"payment_amount": 0.00,
"payment_status": "未支付",
"payment_time": "",
"payment_serial": "",
"payer_name": "",
"completed_at": "",
"order_time": "2024-08-23 09:30:05",
"is_same_day": 1,
"estimated_delivery_time": "2024-08-23 12:00-14:00",
"remark": "无",
"shiliu_score": 0.0,
"shiliu_seed": 0.0,
"timeout_time_stamp": 1724399405,
"order_cate": 2,
"create_time": "2024-08-23 09:30:05",
"update_time": "2024-08-23 09:45:10",
"after_sales_count": 0,
"commodity_order_item_list": [ "commodity_order_item_list": [
{ {
"id": 7003, "id": 50003,
"goods_id": 8003, "order_id": 1002,
"goods_name": "精品榴莲", "goods_id": 6003,
"goods_name": "精品富士苹果5斤装",
"commodity_pic": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", "commodity_pic": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
"sales_price": 152.0, "goods_unit": "斤",
"goods_spec": "5斤",
"cost_price": 3.50,
"sales_price": 9.90,
"count": 1, "count": 1,
"after_sales_status": 2,
"is_support_same_day": 1, "is_support_same_day": 1,
"is_same_day": false "is_same_day": true
},
{
"id": 50004,
"order_id": 1002,
"goods_id": 6004,
"goods_name": "蒙牛纯牛奶200ml*16盒",
"commodity_pic": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
"goods_unit": "箱",
"goods_spec": "200ml*16盒",
"cost_price": 35.00,
"sales_price": 79.60,
"count": 1,
"after_sales_status": 2,
"is_support_same_day": 1,
"is_same_day": true
} }
] ]
}, },
{ {
"id": 1003, "id": 1003,
"order_no": "DD202508131003", "user_id": 20003,
"total_amount": 45.8, "supplier_id": 3003,
"order_status": 3, "supplier_name": "美菜网餐饮供应链",
"payment_status": "已支付", "order_group_id": 40003,
"payment_amount": 45.8, "order_no": "SH20240822001003",
"payment_serial": "PY20250813100003", "total_amount": 328.00,
"order_time": "2025-08-13T09:15:30Z", "total_count": 5,
"is_same_day": 2,
"commodity_order_item_list": [
{
"id": 7004,
"goods_name": "东北大米",
"count": 2,
"sales_price": 22.9
}
]
},
{
"id": 1004,
"order_no": "DD202508131004",
"order_status": 4,
"receiving_name": "王五",
"receiving_phone": "13900139000",
"payment_serial": "PY20250813090001",
"order_time": "2025-08-13T08:45:00Z",
"is_same_day": 1,
"commodity_order_item_list": [
{
"id": 7005,
"goods_name": "酸奶套装",
"count": 1,
"sales_price": 39.9
}
]
},
{
"id": 1005,
"order_no": "DD202508131005",
"order_status": 5, "order_status": 5,
"evauate_status": 2, "cancelled_by": "",
"cancel_time": "",
"cancel_reason": "",
"evauate_status": 1,
"after_sales_status": 1,
"receiving_name": "王芳",
"receiving_phone": "13987654321",
"receiving_address": "广州市天河区天河路385号天俊阁15楼",
"pay_method": "企业对公转账",
"payment_amount": 328.00,
"payment_status": "已支付", "payment_status": "已支付",
"completed_at": "2025-08-13T15:20:18Z", "payment_time": "2024-08-22 15:20:40",
"order_time": "2025-08-13T11:20:18Z", "payment_serial": "BANK202408221520400098765",
"payer_name": "王芳(企业代付)",
"completed_at": "2024-08-22 18:30:15",
"order_time": "2024-08-22 14:50:33",
"is_same_day": 2,
"estimated_delivery_time": "2024-08-23 08:00-10:00",
"remark": "餐饮用食材,请优先配送,包装需防震",
"shiliu_score": 328.0,
"shiliu_seed": 45.2,
"timeout_time_stamp": 1724319033,
"order_cate": 1,
"create_time": "2024-08-22 14:50:33",
"update_time": "2024-08-22 18:30:15",
"after_sales_count": 1,
"commodity_order_item_list": [ "commodity_order_item_list": [
{ {
"id": 7003, "id": 50005,
"goods_id": 8003, "order_id": 1003,
"goods_name": "冷冻虾仁", "goods_id": 6005,
"goods_name": "新鲜生菜1斤装",
"commodity_pic": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", "commodity_pic": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
"sales_price": 152.0, "goods_unit": "斤",
"count": 3, "goods_spec": "1斤",
"is_support_same_day": 1, "cost_price": 1.80,
"sales_price": 3.50,
"count": 2,
"after_sales_status": 1,
"is_support_same_day": 2,
"is_same_day": false "is_same_day": false
}, },
{ {
"id": 7004, "id": 50006,
"goods_id": 8004, "order_id": 1003,
"goods_name": "精品榴莲", "goods_id": 6006,
"goods_name": "冷冻鸡胸肉1kg装",
"commodity_pic": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", "commodity_pic": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
"sales_price": 152.0, "goods_unit": "袋",
"count": 1, "goods_spec": "1kg",
"cost_price": 12.00,
"sales_price": 22.80,
"count": 3,
"after_sales_status": 2,
"is_support_same_day": 2, "is_support_same_day": 2,
"is_same_day": false "is_same_day": false
} }
] ]
},
{
"id": 1006,
"order_no": "DD202508131006",
"order_status": 6,
"cancelled_by": "user",
"cancel_time": "2025-08-13T10:40:05Z",
"cancel_reason": "选错商品",
"order_time": "2025-08-13T10:38:12Z",
"commodity_order_item_list": [
{
"id": 7007,
"goods_name": "进口橙子",
"count": 2,
"sales_price": 32.0
}
]
} }
] ]

View File

@ -8,12 +8,12 @@
</view> </view>
<view class="status-bar" v-if="status === '3'"> <view class="status-bar" v-if="status === '3'">
<view class="status">待发货</view> <view class="status">待发货</view>
<view class="countdown">预计到货时间: 2025-09-09 9:59:59</view> <view class="countdown">预计到货时间: {{ orderInfo.estimated_delivery_time }}</view>
<view class="tips">商家正在加急打包中了请耐心等候</view> <view class="tips">商家正在加急打包中了请耐心等候</view>
</view> </view>
<view class="status-bar" v-if="status === '4'"> <view class="status-bar" v-if="status === '4'">
<view class="status">待配送</view> <view class="status">待配送</view>
<view class="countdown">预计到货时间: 2025-09-09 9:59:59</view> <view class="countdown">预计到货时间: {{ orderInfo.estimated_delivery_time }}</view>
<view class="tips"> <view class="tips">
配送司机15901518415 配送司机15901518415
<img class="phone" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/myOrder/phone.png" /> <img class="phone" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/myOrder/phone.png" />
@ -21,7 +21,7 @@
</view> </view>
<view class="status-bar" v-if="status === '5' || status === '退款中'"> <view class="status-bar" v-if="status === '5' || status === '退款中'">
<view class="status">已完成</view> <view class="status">已完成</view>
<view class="countdown">预计到货时间: 2025-09-09 9:59:59</view> <view class="countdown">预计到货时间: {{ orderInfo.estimated_delivery_time }}</view>
<view class="tips">感谢对我们的信任期待下次光临</view> <view class="tips">感谢对我们的信任期待下次光临</view>
</view> </view>
<view class="status-bar" v-if="status === '6'"> <view class="status-bar" v-if="status === '6'">
@ -39,9 +39,9 @@
<!-- 订单金额 --> <!-- 订单金额 -->
<view class="amount-section"> <view class="amount-section">
<view v-if="status !== '退款中'"> <view v-if="status !== '退款中'">
<view class="total-amount">¥{{ orderInfo.shiliu_score }}</view> <view class="total-amount">¥{{ orderInfo.payment_amount }}</view>
<view class="original-price">商品下单应付 <view class="original-price">商品下单应付
<text> ¥{{ orderInfo.shiliu_score }}</text> <text> ¥{{ orderInfo.payment_amount }}</text>
</view> </view>
</view> </view>
<view class="goods-item" v-for="(item, index) in orderInfo.commodity_order_item_list" :key="index"> <view class="goods-item" v-for="(item, index) in orderInfo.commodity_order_item_list" :key="index">
@ -81,12 +81,12 @@
<view class="section-title">配送信息</view> <view class="section-title">配送信息</view>
<view class="info-item"> <view class="info-item">
<view class="info-label">配送方式</view> <view class="info-label">配送方式</view>
<!-- <view class="info-value">{{ orderInfo.deliveryType }}</view> --> <view class="info-value" v-if="orderInfo.order_cate === 1">商家自配</view>
<view class="info-value">商家自配</view> <view class="info-value" v-if="orderInfo.order_cate === 2">客户自提</view>
</view> </view>
<view class="info-item"> <view class="info-item">
<view class="info-label">预计配送时间</view> <view class="info-label">预计配送时间</view>
<view class="info-value"></view> <view class="info-value">{{ orderInfo.estimated_delivery_time }}</view>
</view> </view>
</view> </view>

View File

@ -1,52 +1,52 @@
<template> <template>
<view class="container"> <view class="container">
<div class="row"> <view class="row">
<div class="row_label"><span>*</span>收货人</div> <view class="row_label"><span>*</span>收货人</view>
<div class="row_con"> <view class="row_con">
<u--input placeholder="请输入姓名" clearable border="none" v-model="name"></u--input> <u--input placeholder="请输入姓名" clearable border="none" v-model="name"></u--input>
</div> </view>
</div> </view>
<div class="row"> <view class="row">
<div class="row_label"><span>*</span>手机号</div> <view class="row_label"><span>*</span>手机号</view>
<div class="row_con"> <view class="row_con">
<u--input type="number" placeholder="请输入手机号" clearable border="none" v-model="phone" ></u--input> <u--input type="number" placeholder="请输入手机号" clearable border="none" v-model="phone" ></u--input>
</div> </view>
</div> </view>
<div class="tabList"> <view class="tabList">
<div class="tabItem" :class="{ 'active': tab == 0 }" @click="changeTab(0)">地图选址</div> <view class="tabItem" :class="{ 'active': tab == 0 }" @click="changeTab(0)">地图选址</view>
<div class="tabItem" :class="{ 'active': tab == 1 }" @click="changeTab(1)">地区选择</div> <view class="tabItem" :class="{ 'active': tab == 1 }" @click="changeTab(1)">地区选择</view>
</div> </view>
<div class="tabItems" v-if="tab == 0"> <view class="tabItems" v-if="tab == 0">
<div class="row"> <view class="row">
<div class="row_label">地址</div> <view class="row_label">地址</view>
<div class="row_con"> <view class="row_con">
<div class="choseAddress" @click="chooseAddress"> <view class="choseAddress" @click="chooseAddress">
<text v-if="showOrientation">请选择地址</text> <text v-if="showOrientation">请选择地址</text>
<text v-if="!showOrientation" style="color: #000;">{{ orientation.region }} {{orientation.district}}</text> <text v-if="!showOrientation" style="color: #000;">{{ orientation.region }} {{orientation.district}}</text>
</div> </view>
<div class="currentAddress" v-if="showOrientation"> <view class="currentAddress" v-if="showOrientation">
<div class="currentAddress1"> <view class="currentAddress1">
<div class="currentAddress1_left">当前定位{{orientation.district}}</div> <view class="currentAddress1_left">当前定位{{orientation.district}}</view>
<div class="currentAddress1_right" @click="headerConfirmClick">使用</div> <view class="currentAddress1_right" @click="headerConfirmClick">使用</view>
</div> </view>
<div class="currentAddress2">{{orientation.region}}</div> <view class="currentAddress2">{{orientation.region}}</view>
</div> </view>
</div> </view>
</div> </view>
<div class="row"> <view class="row">
<div class="row_label">门牌号</div> <view class="row_label">门牌号</view>
<div class="row_con noneborder"> <view class="row_con noneborder">
<u--input placeholder="例6栋201室" clearable border="none" v-model="houseNumber"></u--input> <u--input placeholder="例6栋201室" clearable border="none" v-model="houseNumber"></u--input>
<!-- <div class="tips">记得完善门牌号</div> --> <!-- <view class="tips">记得完善门牌号</view> -->
</div> </view>
</div> </view>
</div> </view>
<div class="tabItems" v-if="tab == 1"> <view class="tabItems" v-if="tab == 1">
<view> <view>
<picker-view indicator-style="height: 50px;" style="width: 100%; height: 400rpx;" :value="id" <picker-view indicator-style="height: 50px;" style="width: 100%; height: 400rpx;" :value="id"
@change="bindChange"> @change="bindChange">
@ -65,27 +65,27 @@
</picker-view> </picker-view>
</view> </view>
<div class="row"> <view class="row">
<div class="row_label"><span>*</span>详细地址</div> <view class="row_label"><span>*</span>详细地址</view>
<div class="row_con"> <view class="row_con">
<u--input placeholder="小区、门牌号" clearable border="none" v-model="houseNumber"></u--input> <u--input placeholder="小区、门牌号" clearable border="none" v-model="houseNumber"></u--input>
</div> </view>
</div> </view>
</div> </view>
<div class="line"></div> <view class="line"></view>
<div class="isdef" @click="headerSettingDefaultAddressClick"> <view class="isdef" @click="headerSettingDefaultAddressClick">
<div class="isdef_left"> <view class="isdef_left">
<div class="isdef_left1">设置默认地址</div> <view class="isdef_left1">设置默认地址</view>
<div class="isdef_left2">提醒下单时会优先选择</div> <view class="isdef_left2">提醒下单时会优先选择</view>
</div> </view>
<div class="isdef_right"> <view class="isdef_right">
<img v-if="isDefault == 2" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png" alt="" /> <img v-if="isDefault == 2" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png" alt="" />
<img v-if="isDefault == 1" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png" alt="" /> <img v-if="isDefault == 1" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png" alt="" />
</div> </view>
</div> </view>
<div class="btn" @click="headerSubmitClick">确定</div> <view class="btn" @click="headerSubmitClick">确定</view>
</view> </view>
</template> </template>
@ -222,6 +222,7 @@ export default {
}) })
return return
} }
console.log("🚀 ~ headerSubmitClick ~ type:", this.type)
if(this.type === 'edit') { if(this.type === 'edit') {
const res = await request(apiArr2.updateAddress, "POST", { const res = await request(apiArr2.updateAddress, "POST", {
user_id: this.id, user_id: this.id,

View File

@ -1,44 +1,44 @@
<template> <template>
<view class="container"> <view class="container">
<div class="hasAddress"> <view class="hasAddress">
<div class="addressList"> <view class="addressList">
<div class="addressItem" v-for="item, index in list" :key="index" :class="{ 'addressItem_def': index == 0 }"> <view class="addressItem" v-for="item, index in list" :key="index" :class="{ 'addressItem_def': index == 0 }">
<div class="addressItem_top"> <view class="addressItem_top">
{{item.name}} {{item.phone}} <div v-if="item.is_default === 1" class="is_def">默认</div> {{item.name}} {{item.phone}} <view v-if="item.is_default === 1" class="is_def">默认</view>
</div> </view>
<div class="addressItem_mid">{{item.address}}{{ item.house_number }}</div> <view class="addressItem_mid">{{item.address}}{{ item.house_number }}</view>
<div class="addressItem_footer"> <view class="addressItem_footer">
<div class="addressItem_footer_left"> <view class="addressItem_footer_left">
<div v-if="item.is_default !== 1" @click="headerSettingDefault(item.id)"> <view v-if="item.is_default !== 1" @click="headerSettingDefault(item.id)">
<image src="http://192.168.0.172:5500/7.15/shop_checked1.png"></image> <image src="http://192.168.0.172:5500/7.15/shop_checked1.png"></image>
设为默认 设为默认
</div> </view>
<div v-if="item.is_default === 1"> <view v-if="item.is_default === 1">
<image src="http://192.168.0.172:5500/7.15/shop_checked2.png"></image> <image src="http://192.168.0.172:5500/7.15/shop_checked2.png"></image>
已默认 已默认
</div> </view>
</div> </view>
<div class="addressItem_footer_right"> <view class="addressItem_footer_right">
<div class="btn1" @click="deleteItem(item.id )">删除</div> <view class="btn1" @click="deleteItem(item.id )">删除</view>
<div class="btn2" @click="editItem(item)">修改</div> <view class="btn2" @click="editItem(item)">修改</view>
</div> </view>
</div> </view>
</div> </view>
</div> </view>
<div class="footer"> <view class="footer">
<div class="footerBtn" @click="addAddress">新增收货地址</div> <view class="footerBtn" @click="addAddress">新增收货地址</view>
</div> </view>
</div> </view>
<div class="empty" v-if="false"> <view class="empty" v-if="false">
<image src="http://192.168.0.172:5500/7.15/shop_noAdd.png"></image> <image src="http://192.168.0.172:5500/7.15/shop_noAdd.png"></image>
<div class="empty_text">暂无收货地址</div> <view class="empty_text">暂无收货地址</view>
<div class="addBtn" @click="addAddress">添加收货地址</div> <view class="addBtn" @click="addAddress">添加收货地址</view>
</div> </view>
</view> </view>
</template> </template>
@ -104,7 +104,7 @@ export default {
}, },
async init() { async init() {
const res = await request(apiArr.addressList, 'POST', {}); const res = await request(apiArr.addAddressList, 'POST', {});
this.list = res.address_list; this.list = res.address_list;
} }
}, },

View File

@ -7,9 +7,9 @@
</view> </view>
</view> </view>
</view> </view>
<view class="swiper"> <view class="swiper">
<view v-if="currentGG.is_same_day" class="tag tag-img"> <view v-if="currentGG.is_same_day" class="tag tag-img">
当日达 当日达
</view> </view>
<swiper :indicator-dots="false" :autoplay="true" :interval="3000" :duration="1000" @change="changeIndex"> <swiper :indicator-dots="false" :autoplay="true" :interval="3000" :duration="1000" @change="changeIndex">
<swiper-item v-for="(item, index) in currentGG.goods_carousel" :key="index"> <swiper-item v-for="(item, index) in currentGG.goods_carousel" :key="index">
@ -44,7 +44,10 @@
</view> </view>
</view> </view>
<view class="Tit"><div class="isDay" v-if="currentGG.is_same_day">当日达</div><div>{{ currentGG.goods_name }}</div></view> <view class="Tit">
<view class="isDay" v-if="currentGG.is_same_day">当日达</view>
<view>{{ currentGG.goods_name }}</view>
</view>
<view class="Msg">{{ currentGG.commodity_brief }}</view> <view class="Msg">{{ currentGG.commodity_brief }}</view>
<view class="fenge"></view> <view class="fenge"></view>
@ -170,28 +173,29 @@
</view> </view>
<view class="car_right" v-if=" <view class="car_right" v-if="
!info.commodity_goods_info_list[currentGGIndex].cart_count || !info.commodity_goods_info_list[currentGGIndex].cart_count ||
info.commodity_goods_info_list[currentGGIndex].cart_count.count == 0 info.commodity_goods_info_list[currentGGIndex].cart_count.count == 0
" @click="addCar"> " @click="addCar">
加入购物车 加入购物车
</view> </view>
<view class="car_right" v-if="info.commodity_goods_info_list[currentGGIndex].cart_count.count > 0"> <view class="car_right" v-if="info.commodity_goods_info_list[currentGGIndex].cart_count.count > 0">
<!-- <view class="car_right"> --> <!-- <view class="car_right"> -->
<u-number-box v-model="info.commodity_goods_info_list[currentGGIndex].cart_count.count" @change="changeCar" min="0"> <u-number-box v-model="info.commodity_goods_info_list[currentGGIndex].cart_count.count"
<!-- <u-number-box > --> @change="changeCar" min="0">
<!-- <u-number-box > -->
<view slot="minus" class="minus"> <view slot="minus" class="minus">
<u-icon name="minus" size="36" bold></u-icon> <u-icon name="minus" size="36" bold></u-icon>
</view> </view>
<text slot="input" style="width: 200rpx; text-align: center" class="input"> <text slot="input" style="width: 200rpx; text-align: center" class="input">
{{info.commodity_goods_info_list[currentGGIndex].cart_count.count}} {{ info.commodity_goods_info_list[currentGGIndex].cart_count.count }}
</text> </text>
<<!-- text slot="input" style="width: 200rpx; text-align: center" class="input"> <!-- text slot="input" style="width: 200rpx; text-align: center" class="input">
{{info.commodity_goods_info_list[currentGGIndex]}} {{info.commodity_goods_info_list[currentGGIndex]}}
</text> --> </text> -->
<view slot="plus" class="plus"> <view slot="plus" class="plus">
<u-icon name="plus" color="#FFFFFF" size="36" bold></u-icon> <u-icon name="plus" color="#FFFFFF" size="36" bold></u-icon>
</view> </view>
</u-number-box> </u-number-box>
</view> </view>
</view> </view>
@ -276,15 +280,20 @@
<!-- 选择款式 --> <!-- 选择款式 -->
<u-popup :show="showSize" round="20rpx" mode="bottom" @close="closeSize" @open="open"> <u-popup :show="showSize" round="20rpx" mode="bottom" @close="closeSize" @open="open">
<!-- <view round="20rpx" mode="bottom"> --> <!-- <view round="20rpx" mode="bottom"> -->
<view class="popup-header"> <view class="popup-header">
<h3 class="popup-header-h3">选择款式</h3> <h3 class="popup-header-h3">选择款式</h3>
<view class="popup-header-view" @click="closeSize">取消</view> <view class="popup-header-view" @click="closeSize">取消</view>
</view> </view>
<view class="itemSize_top"> <view class="itemSize_top">
<image :src="changeImg" class="itemSize-img"><view v-if="currentGG.is_same_day" class="isDay" style="position: absolute; font-size: 16rpx; height: 20rpx; z-index: 100;">当日达</view></image> <image :src="changeImg" class="itemSize-img">
<view v-if="currentGG.is_same_day" class="isDay"
style="position: absolute; font-size: 16rpx; height: 20rpx; z-index: 100;">当日达</view>
</image>
<view class="itemSize_info"> <view class="itemSize_info">
<view class="itemSize_name" style="display: flex;"><view v-if="currentGG.is_same_day" class="isDay">当日达</view>{{ changeName }}</view> <view class="itemSize_name" style="display: flex;">
<view v-if="currentGG.is_same_day" class="isDay">当日达</view>{{ changeName }}
</view>
<view class="itemSize_price">{{ changePrice }}/</view> <view class="itemSize_price">{{ changePrice }}/</view>
</view> </view>
</view> </view>
@ -297,343 +306,343 @@
</template> </template>
<script> <script>
import { import {
apiArr apiArr
} from "../../../api/shop"; } from "../../../api/shop";
import { import {
picUrl, picUrl,
menuButtonInfo, menuButtonInfo,
request, request,
NavgateTo NavgateTo
} from "../../../utils"; } from "../../../utils";
export default { export default {
data() { data() {
return { return {
picUrl, picUrl,
top: "", top: "",
localHeight: "", localHeight: "",
carNum: "", carNum: "",
prevCarNum: "", prevCarNum: "",
currentNum: "0", // currentNum: "0", //
type: "error", type: "error",
boxshadow1: false, boxshadow1: false,
boxshadow2: false, boxshadow2: false,
id: "184", id: "184",
info: "", info: "",
currentIndex: "1", // currentIndex: "1", //
currentGG: "", // currentGG: "", //
currentGGIndex: "", //index currentGGIndex: "", //index
carOrderList: [], carOrderList: [],
// //
showReviewPopup: false, showReviewPopup: false,
comments: [{ comments: [{
avatar: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", avatar: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
username: "TP", username: "TP",
product: "库尔勒香梨 10kg/箱", product: "库尔勒香梨 10kg/箱",
content: "踏入这家位于街角的餐厅,木质门框与暖黄灯光交织出温馨氛围,墙面上手绘的食材插画画透着文艺气息,开放式厨房的设计让食客能看见厨师处理食材的全过程,第一印象便给人以干净与安心。", content: "踏入这家位于街角的餐厅,木质门框与暖黄灯光交织出温馨氛围,墙面上手绘的食材插画画透着文艺气息,开放式厨房的设计让食客能看见厨师处理食材的全过程,第一印象便给人以干净与安心。",
images: ["https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png"], images: ["https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png"],
time: "2025-03-01 11:24:20", time: "2025-03-01 11:24:20",
}, },
{ {
avatar: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", avatar: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
username: "TP", username: "TP",
product: "库尔勒香梨 10kg/箱", product: "库尔勒香梨 10kg/箱",
content: "踏入这家位于街角的餐厅木质门框与暖黄灯光交织出温馨氛围墙面上手绘的食材插_draw着文艺气息开放式厨房的设计让食客能看见厨师处理食材的全过程第一印象便给人以干净与安心。", content: "踏入这家位于街角的餐厅木质门框与暖黄灯光交织出温馨氛围墙面上手绘的食材插_draw着文艺气息开放式厨房的设计让食客能看见厨师处理食材的全过程第一印象便给人以干净与安心。",
images: [ images: [
"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
],
time: "2025-03-01 11:24:20",
},
], ],
show: false, time: "2025-03-01 11:24:20",
showSize: false, },
],
show: false,
showSize: false,
changeImg: "", changeImg: "",
changeName: "", changeName: "",
changePrice: "", changePrice: "",
}; };
},
methods: {
changeIndex(e) {
this.currentIndex = e.detail.current + 1;
}, },
methods: {
changeIndex(e) {
this.currentIndex = e.detail.current + 1;
},
back() { back() {
uni.navigateBack({ uni.navigateBack({
delta: 1, delta: 1,
}); });
}, },
// //
shareFriend() { shareFriend() {
this.boxshadow2 = false; this.boxshadow2 = false;
return; return;
// uniapp // uniapp
uni.share({ uni.share({
provider: "weixin", provider: "weixin",
type: "link", type: "link",
scene: "session", scene: "session",
link: "https://uniapp.dcloud.net.cn/", link: "https://uniapp.dcloud.net.cn/",
title: "商品名称", title: "商品名称",
imageUrl: "", imageUrl: "",
success: (res) => { success: (res) => {
uni.showToast({ uni.showToast({
title: "分享成功", title: "分享成功",
icon: "success", icon: "success",
duration: 2000, duration: 2000,
});
this.boxshadow1 = false;
},
fail: (err) => {
console.log("分享失败", err);
this.boxshadow1 = false;
},
});
},
changeShadow() {
this.boxshadow1 = false;
},
openSave() {
this.boxshadow1 = false;
this.boxshadow2 = true;
},
//
saveImg() {
this.boxshadow2 = false;
//
uni.downloadFile({
url: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_share_img.png",
success: (res) => {
if (res.statusCode === 200) {
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: (res) => {
uni.showToast({
title: "保存成功",
icon: "success",
duration: 2000,
});
},
fail: (err) => {
console.log("保存失败", err);
},
});
}
},
fail: (err) => {
console.log("下载失败", err);
},
});
},
changeShadow2() {
this.boxshadow2 = false;
},
//
share() {
this.boxshadow1 = true;
},
//
getGoodsInfo() {
request(apiArr.getGoodsInfo, "POST", {
id: this.id,
}).then((res) => {
console.log(res);
//
res.commodity_goods_info_list.forEach((item) => {
item.goods_detail_pic = item.goods_detail_pic.split(",");
item.goods_carousel = item.goods_carousel.split(",");
item.commodity_pic = item.commodity_pic.split(",");
}); });
this.boxshadow1 = false;
// },
if (this.carOrderList) { fail: (err) => {
this.carOrderList.forEach((items) => { console.log("分享失败", err);
res.commodity_goods_info_list.forEach((item) => { this.boxshadow1 = false;
if (items.goods_id == item.id) { },
item.cart_count = { });
count: 0 },
}; changeShadow() {
item.cart_count.count = items.count; this.boxshadow1 = false;
} },
}); openSave() {
this.boxshadow1 = false;
this.boxshadow2 = true;
},
//
saveImg() {
this.boxshadow2 = false;
//
uni.downloadFile({
url: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_share_img.png",
success: (res) => {
if (res.statusCode === 200) {
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: (res) => {
uni.showToast({
title: "保存成功",
icon: "success",
duration: 2000,
});
},
fail: (err) => {
console.log("保存失败", err);
},
}); });
} }
this.info = res; },
console.log("this.info",this.info.commodity_goods_info_list); fail: (err) => {
// {{info.commodity_goods_info_list[currentGGIndex].cart_count.count}} console.log("下载失败", err);
this.currentGG = res.commodity_goods_info_list[0]; },
console.log("this.currentGG", this.currentGG); });
this.currentGGIndex = 0; },
changeShadow2() {
this.boxshadow2 = false;
},
this.changeImg = this.currentGG.commodity_pic[0] //
this.changeName = this.currentGG.goods_alias share() {
this.changePrice = this.currentGG.sales_price this.boxshadow1 = true;
},
//
getGoodsInfo() {
request(apiArr.getGoodsInfo, "POST", {
id: this.id,
}).then((res) => {
console.log(res);
//
res.commodity_goods_info_list.forEach((item) => {
item.goods_detail_pic = item.goods_detail_pic.split(",");
item.goods_carousel = item.goods_carousel.split(",");
item.commodity_pic = item.commodity_pic.split(",");
}); });
},
copys(e) { //
uni.setClipboardData({ if (this.carOrderList) {
data: e, this.carOrderList.forEach((items) => {
success: (res) => { res.commodity_goods_info_list.forEach((item) => {
uni.showToast({ if (items.goods_id == item.id) {
title: "复制成功", item.cart_count = {
icon: "success", count: 0
duration: 2000, };
item.cart_count.count = items.count;
}
}); });
}, });
});
},
//
changeGG(item, index) {
console.log("🚀 ~ changeGG ~ item:", item);
this.currentGG = item;
this.currentGGIndex = index;
if (this.currentGG.cart_count) {
this.currentNum = this.currentGG.cart_count.count;
} else {
this.currentGG.cart_count = {
count: 0
};
} }
this.changeImg = item.commodity_pic[0] this.info = res;
this.changeName = item.goods_alias console.log("this.info", this.info.commodity_goods_info_list);
this.changePrice = item.sales_price // {{info.commodity_goods_info_list[currentGGIndex].cart_count.count}}
}, this.currentGG = res.commodity_goods_info_list[0];
car() { console.log("this.currentGG", this.currentGG);
NavgateTo("../shopCar/index"); this.currentGGIndex = 0;
},
// this.changeImg = this.currentGG.commodity_pic[0]
getShopCar() { this.changeName = this.currentGG.goods_alias
request(apiArr.getCarCount, "POST", {}).then((res) => { this.changePrice = this.currentGG.sales_price
this.carNum = res.total; });
this.prevCarNum = res.total; },
});
},
getShopCarList() { copys(e) {
request(apiArr.getCar, "POST", {}).then((res) => { uni.setClipboardData({
this.carOrderList = res.commodity_cart_list; data: e,
}); success: (res) => {
},
addCar() {
let that = this;
//
let goods_id_and_count = [];
this.info.commodity_goods_info_list[this.currentGGIndex].cart_count = {
count: 1,
};
this.info.commodity_goods_info_list.forEach((item) => {
console.log(item.cart_count);
goods_id_and_count.push({
goods_id: item.id,
count: item.cart_count ? item.cart_count.count : 0,
});
});
console.log(goods_id_and_count);
// update
request(apiArr.updateCar, "POST", {
goods_id_and_count,
}).then((res) => {
that.getShopCar();
that.getShopCarList();
});
},
//
changeCar(newValue) {
// //
// this.info.commodity_goods_info_list[this.currentGGIndex].cart_count.count = newValue.value
// //
// this.carOrderList.forEach(item => {
// if (item.commodity_goods_info.id == this.info.commodity_goods_info_list[this.currentGGIndex].id) {
// item.count = newValue.value
// }
// })
// //
// let carNum = 0
// this.carOrderList.forEach(item => {
// carNum += item.count
// })
// this.carNum = carNum
//
const params = {
user_id: uni.getStorageSync("userId"),
goods_id_and_count: [{
goods_id: this.info.commodity_goods_info_list[this.currentGGIndex].id,
count: newValue.value,
}, ],
};
request(apiArr.updateCar, "POST", params).then((res) => {
console.log(res);
this.getShopCarList();
uni.showToast({ uni.showToast({
title: "操作成功!", title: "复制成功",
success() {}, icon: "success",
duration: 2000,
}); });
}); },
}, });
showPopup() {
this.show = true;
},
showSizePopup() {
this.showSize = true;
},
close() {
this.show = false;
},
closeSize() {
this.showSize = false;
},
},
onLoad(options) {
console.log(JSON.parse(decodeURIComponent(options.item)));
const itemObj = JSON.parse(decodeURIComponent(options.item));
const meun = menuButtonInfo();
this.top = meun.top;
this.localHeight = meun.height;
this.id = itemObj.id;
},
onReachBottom() {},
onShow() {
this.getShopCarList();
this.getGoodsInfo();
this.getShopCar();
}, },
//( id count 0 ) //
onHide() { changeGG(item, index) {
console.log("🚀 ~ changeGG ~ item:", item);
this.currentGG = item;
this.currentGGIndex = index;
if (this.currentGG.cart_count) {
this.currentNum = this.currentGG.cart_count.count;
} else {
this.currentGG.cart_count = {
count: 0
};
}
this.changeImg = item.commodity_pic[0]
this.changeName = item.goods_alias
this.changePrice = item.sales_price
},
car() {
NavgateTo("../shopCar/index");
},
//
getShopCar() {
request(apiArr.getCarCount, "POST", {}).then((res) => {
this.carNum = res.total;
this.prevCarNum = res.total;
});
},
getShopCarList() {
request(apiArr.getCar, "POST", {}).then((res) => {
this.carOrderList = res.commodity_cart_list;
});
},
addCar() {
let that = this;
//
let goods_id_and_count = []; let goods_id_and_count = [];
this.info.commodity_goods_info_list[this.currentGGIndex].cart_count = {
count: 1,
};
this.info.commodity_goods_info_list.forEach((item) => { this.info.commodity_goods_info_list.forEach((item) => {
console.log(item.cart_count);
goods_id_and_count.push({ goods_id_and_count.push({
goods_id: item.id, goods_id: item.id,
count: item.cart_count ? item.cart_count.count : 0, count: item.cart_count ? item.cart_count.count : 0,
}); });
}); });
console.log(goods_id_and_count);
// update
request(apiArr.updateCar, "POST", { request(apiArr.updateCar, "POST", {
goods_id_and_count, goods_id_and_count,
}).then((res) => { }).then((res) => {
console.log("Cart updated on hide"); that.getShopCar();
that.getShopCarList();
}); });
return;
}, },
};
//
changeCar(newValue) {
// //
// this.info.commodity_goods_info_list[this.currentGGIndex].cart_count.count = newValue.value
// //
// this.carOrderList.forEach(item => {
// if (item.commodity_goods_info.id == this.info.commodity_goods_info_list[this.currentGGIndex].id) {
// item.count = newValue.value
// }
// })
// //
// let carNum = 0
// this.carOrderList.forEach(item => {
// carNum += item.count
// })
// this.carNum = carNum
//
const params = {
user_id: uni.getStorageSync("userId"),
goods_id_and_count: [{
goods_id: this.info.commodity_goods_info_list[this.currentGGIndex].id,
count: newValue.value,
},],
};
request(apiArr.updateCar, "POST", params).then((res) => {
console.log(res);
this.getShopCarList();
uni.showToast({
title: "操作成功!",
success() { },
});
});
},
showPopup() {
this.show = true;
},
showSizePopup() {
this.showSize = true;
},
close() {
this.show = false;
},
closeSize() {
this.showSize = false;
},
},
onLoad(options) {
console.log(JSON.parse(decodeURIComponent(options.item)));
const itemObj = JSON.parse(decodeURIComponent(options.item));
const meun = menuButtonInfo();
this.top = meun.top;
this.localHeight = meun.height;
this.id = itemObj.id;
},
onReachBottom() { },
onShow() {
this.getShopCarList();
this.getGoodsInfo();
this.getShopCar();
},
//( id count 0 )
onHide() {
let goods_id_and_count = [];
this.info.commodity_goods_info_list.forEach((item) => {
goods_id_and_count.push({
goods_id: item.id,
count: item.cart_count ? item.cart_count.count : 0,
});
});
request(apiArr.updateCar, "POST", {
goods_id_and_count,
}).then((res) => {
console.log("Cart updated on hide");
});
return;
},
};
</script> </script>
<style> <style>
@import url("./index.css"); @import url("./index.css");
</style> </style>

View File

@ -10,7 +10,7 @@ m<template>
<!-- 商品项 --> <!-- 商品项 -->
<view v-for="(item, index) in goodsList" :key="index"> <view v-for="(item, index) in goodsList" :key="index">
<!-- 有多个货品 --> <!-- 有多个货品 -->
<view class="goods-info" v-if="item.group_buy_goods_list.length > 1"> <view class="goods-item" v-if="item.group_buy_goods_list.length > 1">
<view class="goods-image"> <view class="goods-image">
<image :src="item.commodity_pic" mode="aspectFill"></image> <image :src="item.commodity_pic" mode="aspectFill"></image>
</view> </view>
@ -46,9 +46,12 @@ m<template>
</view> </view>
</view> </view>
<view class="sku-control"> <view class="sku-control">
<view class="decrease-btn" @tap.stop="decreaseQuantity(index, 0)">-</view> <view class="decrease-btn" @tap.stop="decreaseQuantity(index, skuIndex)">-
</view>
<view class="quantity">{{ sku.quantity }}</view> <view class="quantity">{{ sku.quantity }}</view>
<view class="increase-btn" @tap.stop="increaseQuantity(index, 0)">+</view> <view class="increase-btn" @tap.stop="increaseQuantity(index, skuIndex)">+
</view>
</view> </view>
</view> </view>
<view class="original-price">单买价 {{ sku.sales_price }}/{{ sku.goods_unit }}</view> <view class="original-price">单买价 {{ sku.sales_price }}/{{ sku.goods_unit }}</view>
@ -105,20 +108,23 @@ m<template>
<script> <script>
import { picUrl, menuButtonInfo, request, NavgateTo } from "../../../utils"; import { picUrl, menuButtonInfo, request, NavgateTo } from "../../../utils";
import { apiArr } from '@/api/groupPurchase.js' import { apiArr } from '@/api/groupPurchase.js'
import { apiArr as shopApi } from "../../../api/shop.js";
export default { export default {
data() { data() {
return { return {
goodsList: [], goodsList: [],
carNum: 5, carNum: 0,
quantity: 0, quantity: 0,
timer: null, // ID timer: null, // ID
endTime: '', // endTime: '', //
updateTime: Date.now() // updateTime: Date.now(), //
goodsDetail: []
}; };
}, },
onLoad() { onLoad() {
this.getGoodsList() // this.getGoodsList()
}, },
onShow() { onShow() {
// //
@ -128,13 +134,23 @@ export default {
this.updateTime = Date.now(); this.updateTime = Date.now();
}, 1000); }, 1000);
} }
// getGoodsListgetShopdetailgetGoodsNum
Promise.all([
// getGoodsList
this.goodsList.length > 0 ? Promise.resolve() : this.getGoodsList(),
// getShopdetail
this.getShopdetail()
]).then(() => {
this.getGoodsNum();//
});
}, },
methods: { methods: {
getGoodsList() { getGoodsList() {
const params = { const params = {
user_id: uni.getStorageSync('userId') user_id: uni.getStorageSync('userId')
} }
request(apiArr.groupBuyList, 'POST', params).then(res => { return request(apiArr.groupBuyList, 'POST', params).then(res => {
const list = res.group_buy_list.map(item => { const list = res.group_buy_list.map(item => {
// quantity // quantity
const group_buy_goods_list = item.group_buy_goods_list.map(sku => ({ const group_buy_goods_list = item.group_buy_goods_list.map(sku => ({
@ -149,9 +165,39 @@ export default {
} }
}) })
this.goodsList = list this.goodsList = list
console.log("🚀 ~ getGoodsList ~ this.goodsList:", this.goodsList) return res;
}) })
}, },
getShopdetail() {
return request(shopApi.getCar, "POST").then((res) => {
this.carNum = res.total;
//
this.goodsDetail = [].concat(res.same_day_cart_list, res.normal_cart_list)
.flatMap(supplier => supplier.commodity_cart_and_goods_model);
return res;
});
},
getGoodsNum() {
if (!this.goodsDetail || !this.goodsList || this.goodsList.length === 0) {
return;
}
//
this.goodsList.forEach(goods => {
//
goods.group_buy_goods_list.forEach(sku => {
//
const matchedItem = this.goodsDetail.find(item => item.goods_id === sku.goods_id);
// quantity
if (matchedItem) {
sku.quantity = matchedItem.count;
} else {
// 0
sku.quantity = 0;
}
});
});
},
toDetail(item) { toDetail(item) {
NavgateTo(`/packages/shop/groupPurchaseDetail/index?item=${JSON.stringify(item)}`) NavgateTo(`/packages/shop/groupPurchaseDetail/index?item=${JSON.stringify(item)}`)
}, },
@ -171,22 +217,53 @@ export default {
increaseQuantity(goodsIndex, skuIndex) { increaseQuantity(goodsIndex, skuIndex) {
this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity++; this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity++;
this.carNum++; this.carNum++;
const params = {
goods_id_and_count: [
{
goods_id: this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].id,
count: this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity,
},
],
group_buy_id: this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].group_buy_activity_info.id
}
this.updateCar(params);
}, },
// //
decreaseQuantity(goodsIndex, skuIndex) { decreaseQuantity(goodsIndex, skuIndex) {
if (this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity > 0) { if (this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity > 0) {
this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity--; this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity--;
this.carNum--; this.carNum--;
const params = {
goods_id_and_count: [
{
goods_id: this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].id,
count: this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity,
},
],
group_buy_id: this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].group_buy_activity_info.id
}
this.updateCar(params);
} else { } else {
uni.showToast({
title: '已经没有了...',
icon: 'none'
});
} }
}, },
//
async updateCar(params) {
return request(shopApi.updateCar, "POST", params).then((res) => {
this.getShopdetail();
uni.showToast({
title: "操作成功!",
success() { },
});
});
},
// //
shopCar() { shopCar() {
// NavgateTo("../shopCar/index");
uni.showToast({
title: '跳转到购物车',
icon: 'none'
});
}, },
// //
getEndTheCountdown(endTime) { getEndTheCountdown(endTime) {

View File

@ -64,6 +64,7 @@ image {
display: flex; display: flex;
background-image: url('https://wechat-img-file.oss-cn-beijing.aliyuncs.com/gp_detail_top.png'); background-image: url('https://wechat-img-file.oss-cn-beijing.aliyuncs.com/gp_detail_top.png');
background-size: cover; background-size: cover;
background-position: -30rpx center;
} }
.section_2 { .section_2 {
@ -77,14 +78,14 @@ image {
.text-wrapper_4 { .text-wrapper_4 {
position: relative; position: relative;
width: 221rpx; width: auto;
height: 80rpx; height: 80rpx;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
} }
.text_30 { .text_30 {
width: 184rpx; width: auto;
height: 80rpx; height: 80rpx;
overflow-wrap: break-word; overflow-wrap: break-word;
color: rgba(255, 255, 255, 1.000000); color: rgba(255, 255, 255, 1.000000);
@ -145,8 +146,8 @@ image {
height: 94rpx; height: 94rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; align-items: center;
margin: 22rpx 39rpx 0 162rpx; margin: 22rpx 39rpx 0 230rpx;
} }
.text_34 { .text_34 {
@ -160,16 +161,37 @@ image {
text-align: left; text-align: left;
white-space: nowrap; white-space: nowrap;
line-height: 28rpx; line-height: 28rpx;
margin-left: 51rpx;
} }
.box_16 { .box_16 {
position: relative;
width: 225rpx;
height: 39rpx;
margin-top: 23rpx;
flex-direction: row;
display: flex; display: flex;
width: 290rpx;
height: 39rpx;
align-items: center;
justify-content: center;
margin-top: 20rpx;
}
.timeBox{
display: flex;
color: #ff370e;
align-items: center;
justify-content: center;
}
.dayTimeBox{
margin-right: 10rpx;
}
.time{
padding: 5rpx;
color: #fff;
border-radius: 10rpx;
background-color: #ff370e;
display: flex;
align-items: center;
justify-content: center;
} }
.text_35 { .text_35 {
@ -194,7 +216,7 @@ image {
font-size: 28rpx; font-size: 28rpx;
font-family: Arial-Regular; font-family: Arial-Regular;
font-weight: normal; font-weight: normal;
text-align: left; text-align: center;
white-space: nowrap; white-space: nowrap;
line-height: 28rpx; line-height: 28rpx;
margin: 3rpx 0 0 42rpx; margin: 3rpx 0 0 42rpx;
@ -208,7 +230,7 @@ image {
font-size: 28rpx; font-size: 28rpx;
font-family: Arial-Regular; font-family: Arial-Regular;
font-weight: normal; font-weight: normal;
text-align: left; text-align: center;
white-space: nowrap; white-space: nowrap;
line-height: 28rpx; line-height: 28rpx;
margin: 3rpx 0 0 33rpx; margin: 3rpx 0 0 33rpx;
@ -232,7 +254,7 @@ image {
font-size: 28rpx; font-size: 28rpx;
font-family: Arial-Regular; font-family: Arial-Regular;
font-weight: normal; font-weight: normal;
text-align: left; text-align: center;
white-space: nowrap; white-space: nowrap;
line-height: 28rpx; line-height: 28rpx;
margin: 5rpx 0 0 4rpx; margin: 5rpx 0 0 4rpx;
@ -258,7 +280,7 @@ image {
font-size: 28rpx; font-size: 28rpx;
font-family: Arial-Regular; font-family: Arial-Regular;
font-weight: normal; font-weight: normal;
text-align: left; text-align: center;
white-space: nowrap; white-space: nowrap;
line-height: 28rpx; line-height: 28rpx;
margin: 5rpx 0 0 4rpx; margin: 5rpx 0 0 4rpx;
@ -284,7 +306,7 @@ image {
font-size: 28rpx; font-size: 28rpx;
font-family: Arial-Regular; font-family: Arial-Regular;
font-weight: normal; font-weight: normal;
text-align: left; text-align: center;
white-space: nowrap; white-space: nowrap;
line-height: 28rpx; line-height: 28rpx;
margin: 5rpx 0 0 4rpx; margin: 5rpx 0 0 4rpx;
@ -968,4 +990,35 @@ image {
border-radius: 35rpx; border-radius: 35rpx;
font-size: 28rpx; font-size: 28rpx;
text-align: center; text-align: center;
}
/* 当日达标签 */
.tag {
background-color: #ff7d00;
color: white;
font-size: 22rpx;
padding: 5rpx 10rpx;
border-radius: 20rpx 0 20rpx 20rpx;
}
.tag2 {
width: auto;
background-color: #ff380bd0;
color: white;
font-size: 30rpx;
padding: 10rpx 30rpx;
border-radius: 50rpx 0 0 50rpx;
}
.tag-img {
position: absolute;
top: 200rpx;
right: 0;
z-index: 1;
}
.tag-text {
display: inline-block;
vertical-align: middle;
margin-right: 20rpx;
} }

View File

@ -8,6 +8,9 @@
</view> </view>
</view> </view>
<view class="swiper"> <view class="swiper">
<view class="tag2 tag-img" v-if="
currentGG.is_same_day
">当日达</view>
<swiper :indicator-dots="false" :autoplay="true" :interval="3000" :duration="1000" @change="changeIndex"> <swiper :indicator-dots="false" :autoplay="true" :interval="3000" :duration="1000" @change="changeIndex">
<swiper-item v-for="(item, index) in currentGG.goods_carousel" :key="index"> <swiper-item v-for="(item, index) in currentGG.goods_carousel" :key="index">
<image :src="picUrl + item"></image> <image :src="picUrl + item"></image>
@ -22,37 +25,51 @@
<view class="box_15"> <view class="box_15">
<view class="section_2"> <view class="section_2">
<view class="text-wrapper_4"> <view class="text-wrapper_4">
<text lines="1" class="text_30">255.99</text>
<text lines="1" class="text_31"></text> <text lines="1" class="text_31"></text>
<text lines="1" class="text_30">{{ currentGG.group_buy_price }}</text>
<text lines="1" class="text_33">/{{ currentGG.goods_unit }}</text>
</view> </view>
<text lines="1" decode="true" class="text_32">单买价&nbsp;300/</text> <text lines="1" decode="true" class="text_32">单买价&nbsp;{{ currentGG.sales_price }}/{{
currentGG.goods_unit }}</text>
</view> </view>
<text lines="1" class="text_33">/</text>
<view class="section_3"> <view class="section_3">
<text lines="1" class="text_34">距结束还剩</text> <text lines="1" class="text_34">距结束还剩</text>
<view class="box_16"> <view class="box_16">
<text lines="1" class="text_35">68</text> <view class="timeBox">
<view class="dayTimeBox">{{ endTheCountdownDay }}</view>
<view class="timeBox">
<view class="time">{{ endTheCountdownHour }}</view>
<view></view>
</view>
<view class="timeBox">
<view class="time">{{ endTheCountdownMinute }}</view>
<view></view>
</view>
<view class="timeBox">
<view class="time">{{ endTheCountdownSecond }}</view>
</view>
</view>
<!-- <text lines="1" class="text_35">{{ endTheCountdownDay }}</text>
<text lines="1" class="text_36"></text> <text lines="1" class="text_36"></text>
<text lines="1" class="text_37"></text> <text lines="1" class="text_37"></text>
<view class="text-wrapper_5">
<text lines="1" class="text_38">59</text>
</view>
<view class="text-wrapper_6"> <view class="text-wrapper_6">
<text lines="1" class="text_39">24</text> <text lines="1" class="text_39">{{ endTheCountdownHour }}</text>
</view> </view>
<view class="text-wrapper_7"> <view class="text-wrapper_7">
<text lines="1" class="text_40">59</text> <text lines="1" class="text_40">{{ endTheCountdownMinute }}</text>
</view> </view>
<view class="text-wrapper_5">
<text lines="1" class="text_38">{{ endTheCountdownSecond }}</text>
</view> -->
</view> </view>
</view> </view>
</view> </view>
<view class="Money"> <view class="Money">
<view class="MoneyMark"></view> <view class="MoneyMark"></view>
{{ currentGG.sales_price }} {{ currentGG.group_buy_price }}
<view class="MoneyUnit">/{{ currentGG.goods_unit }}</view> <view class="MoneyUnit">/{{ currentGG.goods_unit }}</view>
<view class="oldMoney">{{ currentGG.market_price }}</view>
</view> </view>
<!-- 规格 --> <!-- 规格 -->
@ -69,7 +86,12 @@
</view> </view>
</view> </view>
<view class="Tit">{{ currentGG.goods_name }}</view> <view class="Tit">
<view class="tag tag-text" v-if="
currentGG.is_same_day
">当日达</view>
{{ currentGG.goods_name }}
</view>
<view class="Msg">{{ currentGG.commodity_brief }}</view> <view class="Msg">{{ currentGG.commodity_brief }}</view>
<view class="fenge"></view> <view class="fenge"></view>
@ -77,17 +99,17 @@
<!-- 已购买区域 --> <!-- 已购买区域 -->
<view> <view>
<view class="purchase-area"> <view class="purchase-area">
<view class="purchase-count">6人已购买</view> <view class="purchase-count">{{ totalCount }}人已购买</view>
<view class="view-more" @click="showPurchaseRecords">查看更多 &gt;</view> <view class="view-more" @click="showPurchaseRecords">查看更多 &gt;</view>
</view> </view>
<view class="record-list"> <view class="record-list">
<view class="record-item" v-for="(record, index) in purchaseRecords" :key="index"> <view class="record-item" v-for="(record, index) in purchaseRecords" :key="index">
<view class="record-user"> <view class="record-user">
<image :src="record.avatar" class="user-avatar"></image> <image :src="record.avatar" class="user-avatar"></image>
<view class="user-name">{{ record.username }}</view> <view class="user-name">{{ record.nick_name }}</view>
</view> </view>
<view class="record-amount"> <view class="record-amount">
7月17日买了一 {{ formatDate(record.buy_time) }}买了{{ record.count }}
</view> </view>
<view class="record-time"> <view class="record-time">
<button class="buy-btn" @click="goSubmit">去下单</button> <button class="buy-btn" @click="goSubmit">去下单</button>
@ -151,23 +173,22 @@
</view> </view>
</view> </view>
<view class="car_right" v-if="info.commodity_goods_info_list[currentGGIndex].total_stock < 1" @click="addCar">
已售罄
</view>
<view class="car_right" v-if=" <view class="car_right" v-if="
!info.commodity_goods_info_list[currentGGIndex].cart_count || info.commodity_goods_info_list[currentGGIndex].total_stock > 0 &&
info.commodity_goods_info_list[currentGGIndex].cart_count.count == 0 (!info.commodity_goods_info_list[currentGGIndex].cart_count ||
info.commodity_goods_info_list[currentGGIndex].cart_count.count == 0)
" @click="addCar"> " @click="addCar">
加入购物车 加入购物车
</view> </view>
<view class="car_right" v-if="false" @click="addCar">
已售罄
</view>
<view class="car_right" v-if="false" @click="addCar">
库存不足
</view>
<view class="car_right" v-if=" <view class="car_right" v-if="
info.commodity_goods_info_list[currentGGIndex].cart_count.count > 0 info.commodity_goods_info_list[currentGGIndex].cart_count.count > 0
&& info.commodity_goods_info_list[currentGGIndex].total_stock > 0
"> ">
<u-number-box v-model="info.commodity_goods_info_list[currentGGIndex].cart_count.count <u-number-box v-model="info.commodity_goods_info_list[currentGGIndex].cart_count.count
" @change="changeCar" min="0"> " @change="changeCar" min="0">
@ -278,10 +299,10 @@
<view class="record-item" v-for="(record, index) in purchaseRecords" :key="index"> <view class="record-item" v-for="(record, index) in purchaseRecords" :key="index">
<view class="record-user"> <view class="record-user">
<image :src="record.avatar" class="user-avatar"></image> <image :src="record.avatar" class="user-avatar"></image>
<view class="user-name">{{ record.username }}</view> <view class="user-name">{{ record.nick_name }}</view>
</view> </view>
<view class="record-amount">+{{ record.amount }}</view> <view class="record-amount">+{{ record.count }}</view>
<view class="record-time">{{ record.time }}</view> <view class="record-time">{{ record.buy_time }}</view>
</view> </view>
</view> </view>
</view> </view>
@ -311,6 +332,7 @@
<script> <script>
import { apiArr } from "../../../api/shop"; import { apiArr } from "../../../api/shop";
import { apiArr as apiArr2 } from "../../../api/groupPurchase";
import { picUrl, menuButtonInfo, request, NavgateTo } from "../../../utils"; import { picUrl, menuButtonInfo, request, NavgateTo } from "../../../utils";
export default { export default {
data() { data() {
@ -334,68 +356,59 @@ export default {
carOrderList: [], carOrderList: [],
// //
showReviewPopup: false, showReviewPopup: false,
comments: [ // comments: [
{ // {
avatar: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", // avatar: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
username: "TP", // username: "TP",
product: "库尔勒香梨 10kg/箱", // product: " 10kg/",
content: // content:
"踏入这家位于街角的餐厅,木质门框与暖黄灯光交织出温馨氛围,墙面上手绘的食材插画画透着文艺气息,开放式厨房的设计让食客能看见厨师处理食材的全过程,第一印象便给人以干净与安心。", // "便",
images: ["https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png"], // images: ["https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png"],
time: "2025-03-01 11:24:20", // time: "2025-03-01 11:24:20",
}, // },
{ // {
avatar: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", // avatar: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
username: "TP", // username: "TP",
product: "库尔勒香梨 10kg/箱", // product: " 10kg/",
content: // content:
"踏入这家位于街角的餐厅木质门框与暖黄灯光交织出温馨氛围墙面上手绘的食材插_draw着文艺气息开放式厨房的设计让食客能看见厨师处理食材的全过程第一印象便给人以干净与安心。", // "_draw便",
images: [ // images: [
"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", // "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", // "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
"https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png", // "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
], // ],
time: "2025-03-01 11:24:20", // time: "2025-03-01 11:24:20",
}, // },
], // ],
show: false, show: false,
showSize: false, showSize: false,
showPurchase: false, showPurchase: false,
purchaseRecords: [ purchaseRecords: [],
{ totalCount: 0,
avatar: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
username: "俏*莲",
amount: 1,
time: "2024-02-04 22:30:35"
},
{
avatar: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
username: "高*",
amount: 1,
time: "2024-02-04 22:30:35"
},
{
avatar: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
username: "俏*莲",
amount: 1,
time: "2024-02-04 22:30:35"
},
{
avatar: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
username: "高*",
amount: 1,
time: "2024-02-04 22:30:35"
}
],
changeImg: "", changeImg: "",
changeName: "", changeName: "",
changePrice: "", changePrice: "",
endTime: "",
endTheCountdownDay: '',
endTheCountdownHour: '',
endTheCountdownMinute: '',
endTheCountdownSecond: '',
timer: null, // ID
}; };
}, },
methods: { methods: {
// //
showPurchaseRecords() { showPurchaseRecords() {
this.showPurchase = true; if (this.purchaseRecords.length > 0) {
this.showPurchase = true;
} else {
uni.showToast({
title: '没有更多数据',
icon: 'none'
})
}
}, },
// //
@ -491,8 +504,6 @@ export default {
request(apiArr.getGoodsInfo, "POST", { request(apiArr.getGoodsInfo, "POST", {
id: this.id, id: this.id,
}).then((res) => { }).then((res) => {
console.log(res);
// //
res.commodity_goods_info_list.forEach((item) => { res.commodity_goods_info_list.forEach((item) => {
item.goods_detail_pic = item.goods_detail_pic.split(","); item.goods_detail_pic = item.goods_detail_pic.split(",");
@ -501,6 +512,7 @@ export default {
}); });
// //
console.log("🚀 ~ getGoodsInfo ~ this.carOrderList:", this.carOrderList)
if (this.carOrderList) { if (this.carOrderList) {
this.carOrderList.forEach((items) => { this.carOrderList.forEach((items) => {
res.commodity_goods_info_list.forEach((item) => { res.commodity_goods_info_list.forEach((item) => {
@ -536,7 +548,6 @@ export default {
// //
changeGG(item, index) { changeGG(item, index) {
console.log("🚀 ~ changeGG ~ item:", item);
this.currentGG = item; this.currentGG = item;
this.currentGGIndex = index; this.currentGGIndex = index;
if (this.currentGG.cart_count) { if (this.currentGG.cart_count) {
@ -561,8 +572,11 @@ export default {
}, },
getShopCarList() { getShopCarList() {
request(apiArr.getCar, "POST", {}).then((res) => { return request(apiArr.getCar, "POST", {}).then((res) => {
this.carOrderList = res.commodity_cart_list; //
this.carOrderList = [].concat(res.same_day_cart_list, res.normal_cart_list)
.flatMap(supplier => supplier.commodity_cart_and_goods_model);
return res;
}); });
}, },
@ -593,20 +607,6 @@ export default {
// //
changeCar(newValue) { changeCar(newValue) {
// //
// this.info.commodity_goods_info_list[this.currentGGIndex].cart_count.count = newValue.value
// //
// this.carOrderList.forEach(item => {
// if (item.commodity_goods_info.id == this.info.commodity_goods_info_list[this.currentGGIndex].id) {
// item.count = newValue.value
// }
// })
// //
// let carNum = 0
// this.carOrderList.forEach(item => {
// carNum += item.count
// })
// this.carNum = carNum
// //
const params = { const params = {
user_id: uni.getStorageSync("userId"), user_id: uni.getStorageSync("userId"),
@ -625,6 +625,7 @@ export default {
title: "操作成功!", title: "操作成功!",
success() { }, success() { },
}); });
this.getShopCar();
}); });
}, },
@ -643,25 +644,88 @@ export default {
closeSize() { closeSize() {
this.showSize = false; this.showSize = false;
}, },
//
getBuyRecord() {
const params = {
activity_id: 47,
goods_id: this.id
}
request(apiArr2.groupBuyRecord, 'POST', params).then(res => {
const record = res.group_buy_record.map(item => {
return {
...item,
avatar: picture + item.avatar
}
})
this.purchaseRecords = record
this.totalCount = res.total_count
})
},
formatDate(dateStr) {
if (!dateStr) return '';
const date = new Date(dateStr);
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${month}${day}`;
},
//
getEndTheCountdown(endTime) {
//
const now = new Date().getTime();
const end = new Date(endTime).getTime();
//
let diff = end - now;
//
if (diff <= 0) {
return '团购已结束';
}
//
this.endTheCountdownDay = Math.floor(diff / (1000 * 60 * 60 * 24));
diff -= this.endTheCountdownDay * (1000 * 60 * 60 * 24);
this.endTheCountdownHour = Math.floor(diff / (1000 * 60 * 60));
diff -= this.endTheCountdownHour * (1000 * 60 * 60);
this.endTheCountdownMinute = Math.floor(diff / (1000 * 60));
diff -= this.endTheCountdownMinute * (1000 * 60);
this.endTheCountdownSecond = Math.floor(diff / (1000));
}
}, },
onLoad(options) { onLoad(options) {
const itemObj = JSON.parse(decodeURIComponent(options.item)); const itemObj = JSON.parse(decodeURIComponent(options.item));
console.log("🚀 ~ onLoad ~ itemObj:", itemObj)
const meun = menuButtonInfo(); const meun = menuButtonInfo();
this.top = meun.top; this.top = meun.top;
this.localHeight = meun.height; this.localHeight = meun.height;
this.id = itemObj.id; this.id = itemObj.id;
this.endTime = itemObj.group_buy_goods_list[0].group_buy_activity_info.end_time
this.getBuyRecord()
this.getEndTheCountdown(this.endTime)
//
this.timer = setInterval(() => {
this.getEndTheCountdown(this.endTime)
}, 1000)
}, },
onReachBottom() { }, onReachBottom() { },
onShow() { onShow() {
this.getShopCarList(); // getShopCarListgetGoodsInfo
this.getGoodsInfo(); this.getShopCarList().then(() => {
this.getGoodsInfo();
});
this.getShopCar(); this.getShopCar();
}, },
//( id count 0 ) //( id count 0 )
onHide() { onHide() {
//
if (this.timer) {
clearInterval(this.timer)
this.timer = null
}
let goods_id_and_count = []; let goods_id_and_count = [];
this.info.commodity_goods_info_list.forEach((item) => { this.info.commodity_goods_info_list.forEach((item) => {
goods_id_and_count.push({ goods_id_and_count.push({

View File

@ -1,6 +1,5 @@
page { page {
background-color: #f5f7fb; background-color: #f5f7fb;
} }
.container { .container {
@ -93,6 +92,8 @@ page {
font-size: 28rpx; font-size: 28rpx;
color: #666; color: #666;
line-height: 40rpx; line-height: 40rpx;
display: flex;
align-items: center;
} }
.address-arrow { .address-arrow {
@ -163,6 +164,10 @@ page {
color: #e63946; color: #e63946;
margin-right: 10rpx; margin-right: 10rpx;
border-radius: 4rpx; border-radius: 4rpx;
/* display: flex; */
}
.group-price-box {
display: flex; display: flex;
} }
@ -262,6 +267,15 @@ page {
color: #FF7658; color: #FF7658;
} }
/* 复制 */
.copy-icon {
width: 30rpx;
height: 30rpx;
background-image: url('https://wechat-img-file.oss-cn-beijing.aliyuncs.com/myOrder/copy.png');
background-size: cover;
margin-left: 10rpx;
}
/* 支付方式区域 */ /* 支付方式区域 */
.payment-section { .payment-section {
background-color: #fff; background-color: #fff;
@ -316,10 +330,11 @@ page {
font-size: 36rpx; font-size: 36rpx;
font-weight: bold; font-weight: bold;
border-radius: 50rpx; border-radius: 50rpx;
position: absolute; position: fixed;
bottom: 50rpx; bottom: 50rpx;
left: 15%; left: 15%;
width: 70%; width: 70%;
z-index: 99;
} }
/* 自提样式 */ /* 自提样式 */
@ -473,4 +488,13 @@ page {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin-top: 60rpx; margin-top: 60rpx;
}
.empty-tip{
height: 200rpx;
font-size: 28rpx;
color: #999999;
text-align: center;
line-height: 200rpx;
background-color: #fff;
} }

View File

@ -5,34 +5,23 @@
<view :class="{ active: activeTab === 'delivery' }" class="tab-item" @click="switchTab('delivery')">配送 <view :class="{ active: activeTab === 'delivery' }" class="tab-item" @click="switchTab('delivery')">配送
</view> </view>
<view :class="{ active: activeTab === 'pickup' }" class="tab-item" @click="switchTab('pickup')">自提</view> <view :class="{ active: activeTab === 'pickup' }" class="tab-item" @click="switchTab('pickup')">自提</view>
</view> </view>
<!-- 分隔线 --> <!-- 分隔线 -->
<view class="divider"></view> <view class="divider"></view>
<!-- 配送/自提信息 --> <!-- 配送/自提信息 -->
<view class="info-section"> <view class="info-section" v-if="activeTab === 'delivery'">
<view v-if="activeTab === 'delivery'" class="address-section"> <view class="address-section">
<view class="section-title">收货地址</view> <view class="section-title">收货地址</view>
<view class="address-info" @click="editAddress"> <view class="address-info" @click="chooseAddress" v-if="defAddress">
<view class="address-main"> <view class="address-main">
<view class="address-name-phone"> <view class="address-name-phone">
<text class="name">李佳</text> <text class="name">{{ defAddress.name }}</text>
<text class="phone">15901518415</text> <text class="phone">{{ defAddress.phone }}</text>
</view> </view>
<view class="address-detail">北京北京市朝阳区珠江绿洲文化广场</view> <view class="address-detail">
</view> {{ defAddress.address }}{{ defAddress.house_number }}
<view class="address-arrow"><u-icon name="arrow-right" size="25"></u-icon></view> <view class="copy-icon" @click.stop="copyAddress" />
</view>
</view>
<view v-else class="address-section">
<view class="section-title">自提点</view>
<view class="address-info" @click="editAddress">
<view class="address-main">
<view class="address-name-phone">
<text class="name">李佳</text>
<text class="phone">15901518415</text>
</view> </view>
<view class="address-detail">北京北京市朝阳区珠江绿洲文化广场</view>
</view> </view>
<view class="address-arrow"><u-icon name="arrow-right" size="25"></u-icon></view> <view class="address-arrow"><u-icon name="arrow-right" size="25"></u-icon></view>
</view> </view>
@ -41,62 +30,190 @@
<!-- 分隔线 --> <!-- 分隔线 -->
<view class="divider"></view> <view class="divider"></view>
<!-- 商品信息 --> <!-- 商品信息 -->
<view class="goods-item"> <view v-if="activeTab === 'delivery' && orderList1.length > 0">
<view class="goods-image"> <view class="goods-list">
<image src="/static/logo.png" mode="aspectFill"></image> <view class="goods-item" v-for="(item, index) in orderList1" :key="index">
</view> <view class="goods-image">
<view class="goods-info"> <image :src="item.commodity_goods_info.commodity_pic" mode="aspectFill"></image>
<view class="goods-name">泰国金枕榴莲泰国金枕榴莲</view>
<view class="goods-desc"> 心形榴莲 软糯香甜</view>
<view class="price-container">
<view class="group-price">
<view class="group-price1">团购价</view>
<view class="group-price2">125.9</view>
</view> </view>
<view class="quantity-control"> <view class="goods-info">
<view class="decrease-btn" @tap.stop="decreaseQuantity(index)">-</view> <view class="goods-name">{{ item.commodity_goods_info.goods_name }}</view>
<view class="quantity">{{ quantity }}</view> <view class="goods-desc">{{ item.commodity_goods_info.goods_spec }}</view>
<view class="increase-btn" @tap.stop="increaseQuantity(index)">+</view> <view class="price-container">
<view class="group-price">
<view>{{ item.commodity_goods_info.sales_price }}/{{
item.commodity_goods_info.goods_unit
}}</view>
<!-- 运费 -->
<view class="goods-desc" style="margin-top: 10rpx;">运费 {{
item.commodity_goods_info.freight }}</view>
</view>
<view class="quantity-control">
<view class="decrease-btn" @tap.stop="decreaseQuantity(item)">-</view>
<view class="quantity">{{ item.count }}</view>
<view class="increase-btn" @tap.stop="increaseQuantity(item)">+</view>
</view>
</view>
</view>
</view>
</view>
<!-- 运费 -->
<!-- <view class="fee-section">
<view class="fee-name">运费</view>
<view class="fee-value">{{ item.commodity_goods_info.freight }}</view>
</view> -->
<!-- 总金额 -->
<view class="total-section">
<view class="total-name">总金额</view>
<view class="total-value">{{ calculateTotal('order1') }}</view>
</view>
<!-- 支付方式 -->
<view class="payment-section">
<view class="payment-item" @click="selectPayment('wechat')">
<view class="payment-icon">
<image
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_wechat.png"
mode="aspectFit"></image>
</view>
<view class="payment-content">
<view class="payment-name">微信支付</view>
<view class="payment-desc"><text
style="color: #f03d0e;margin-right: 15rpx;">可用优惠券</text>单笔支付限额:¥10000.00</view>
</view>
<view class="payment-select" v-if="selectedPayment === 'wechat'">
<image
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png"
mode="aspectFit" style="width: 40rpx; height: 40rpx;"></image>
</view>
<view class="payment-select" v-else>
<image
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png"
mode="aspectFit" style="width: 40rpx; height: 40rpx;"></image>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<!-- 运费 --> <view v-if="activeTab === 'delivery' && orderList1.length == 0" class="empty-tip">
<view class="fee-section"> 暂无商品数据
<view class="fee-name">运费</view>
<view class="fee-value">10</view>
</view> </view>
<!-- 总金额 --> <view v-if="activeTab === 'pickup' && orderList2.length > 0">
<view class="total-section"> <view class="goods-list" v-for="(item, index) in orderList2" :key="index">
<view class="total-name">总金额</view> <view class="info-section">
<view class="total-value">200</view> <view class="address-section">
</view> <view class="section-title">自提点</view>
<!-- 支付方式 --> <view @click="editAddress(item)">
<view class="payment-section"> <view v-if="defZTAddress.length > 0">
<view class="payment-item" @click="selectPayment('wechat')"> <view v-for="(adItem, adIndex) in defZTAddress" :key="adIndex">
<view class="payment-icon"> <view class="address-info" v-if="adItem.id === item.goods_id">
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_wechat.png" <view class="address-main">
mode="aspectFit"></image> <view class="address-name-phone">
<text class="name">{{ adItem.name }}</text>
<text class="phone">{{ adItem.phone }}</text>
</view>
<view class="address-detail">
{{ adItem.address }}
<view class="copy-icon" @click.stop="copyZTAddress" />
</view>
</view>
<view class="address-arrow"><u-icon name="arrow-right" size="25"></u-icon></view>
</view>
</view>
<view class="address-info" v-if="!defZTAddress.some(adItem => adItem.id === item.goods_id)">
<view class="address-main">
<view class="address-name-phone">
<text class="name">请选择自提点</text>
</view>
</view>
<view class="address-arrow"><u-icon name="arrow-right" size="25"></u-icon></view>
</view>
</view>
<view class="address-info" v-else>
<view class="address-main">
<view class="address-name-phone">
<text class="name">请选择自提点</text>
</view>
</view>
<view class="address-arrow"><u-icon name="arrow-right" size="25"></u-icon></view>
</view>
</view>
</view>
</view> </view>
<view class="payment-content"> <view class="goods-item">
<view class="payment-name">微信支付</view> <view class="goods-image">
<view class="payment-desc"><text <image :src="item.commodity_goods_info.commodity_pic" mode="aspectFill"></image>
style="color: #f03d0e;margin-right: 15rpx;">可用优惠券</text>单笔支付限额:¥10000.00</view> </view>
</view> <view class="goods-info">
<view class="payment-select" v-if="selectedPayment === 'wechat'"> <view class="goods-name">{{ item.commodity_goods_info.goods_name }}</view>
<image <view class="goods-desc">{{ item.commodity_goods_info.goods_spec }}</view>
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png" <view class="price-container">
mode="aspectFit" style="width: 40rpx; height: 40rpx;"></image> <view class="group-price">
</view> <view>
<view class="payment-select" v-else> <view v-if="isWithinActivityTime(item)" class="group-price-box">
<image <view class="group-price1">团购价</view>
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png" <view class="group-price2">
mode="aspectFit" style="width: 40rpx; height: 40rpx;"></image> {{ '¥' + item.commodity_goods_info.group_buy_price }}
/{{ item.commodity_goods_info.goods_unit }}
</view>
</view>
<view v-else>
{{ '¥' + item.commodity_goods_info.sales_price }}
/{{ item.commodity_goods_info.goods_unit }}
</view>
</view>
<!-- 运费 -->
<view class="goods-desc" style="margin-top: 10rpx;">运费 {{
item.commodity_goods_info.freight }}</view>
</view>
<view class="quantity-control">
<view class="decrease-btn" @tap.stop="decreaseQuantity(item)">-</view>
<view class="quantity">{{ item.count }}</view>
<view class="increase-btn" @tap.stop="increaseQuantity(item)">+</view>
</view>
</view>
</view>
</view> </view>
</view> </view>
<!-- 运费 -->
<!-- <view class="fee-section">
<view class="fee-name">运费</view>
<view class="fee-value">{{ item.commodity_goods_info.freight }}</view>
</view> -->
<!-- 总金额 -->
<view class="total-section">
<view class="total-name">总金额</view>
<view class="total-value">{{ calculateTotal('order2') }}</view>
</view>
<!-- 支付方式 -->
<view class="payment-section">
<view class="payment-item" @click="selectPayment('wechat')">
<view class="payment-icon">
<image
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_wechat.png"
mode="aspectFit"></image>
</view>
<view class="payment-content">
<view class="payment-name">微信支付</view>
<view class="payment-desc"><text
style="color: #f03d0e;margin-right: 15rpx;">可用优惠券</text>单笔支付限额:¥10000.00</view>
</view>
<view class="payment-select" v-if="selectedPayment === 'wechat'">
<image
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png"
mode="aspectFit" style="width: 40rpx; height: 40rpx;"></image>
</view>
<view class="payment-select" v-else>
<image
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png"
mode="aspectFit" style="width: 40rpx; height: 40rpx;"></image>
</view>
</view>
</view>
</view>
<view v-if="activeTab === 'pickup' && orderList2.length == 0" class="empty-tip">
暂无商品数据
</view> </view>
<!-- 立即支付按钮 --> <!-- 立即支付按钮 -->
<view class="pay-button" @click="submitPayment">立即支付 ¥4500.00</view> <view class="pay-button" @click="submitPayment">立即支付</view>
<!-- 弹窗 - 支付成功 --> <!-- 弹窗 - 支付成功 -->
<view class="shadow" @click="changeShadow" v-if="boxshadow1"> <view class="shadow" @click="changeShadow" v-if="boxshadow1">
@ -173,6 +290,8 @@
</template> </template>
<script> <script>
import { picUrl, menuButtonInfo, request, NavgateTo } from "../../../utils"; import { picUrl, menuButtonInfo, request, NavgateTo } from "../../../utils";
import { apiArr } from "../../../api/shop";
export default { export default {
data() { data() {
return { return {
@ -181,35 +300,171 @@ export default {
selectedPayment: 'wechat', selectedPayment: 'wechat',
boxshadow1: false, boxshadow1: false,
boxshadow2: false, boxshadow2: false,
defAddress: {},
defZTAddress: [],
orderList1: [],
orderList2: [],
carList: [],
}; };
}, },
onLoad(options) {
this.carList = JSON.parse(options.shopCarList)
},
onShow() {
this.getUserAddress()
this.getZTAddress()
this.getGoodsList()
},
onUnload() {
uni.removeStorageSync('changeZTAddress')
},
methods: { methods: {
switchTab(tab) { switchTab(tab) {
this.activeTab = tab; this.activeTab = tab;
}, },
editAddress() { //
if (this.activeTab === 'delivery') { getUserAddress() {
NavgateTo('../addAddress/index'); request(apiArr.getUserDefAddress, "POST", {}).then(res => {
this.defAddress = res.default_address
})
},
//
getGoodsList() {
this.orderList1 = []
this.orderList2 = []
this.carList.forEach(item => {
const list = item.commodity_goods_info.group_buy_activity_info
if (list) {
this.orderList2.push(item)
} else {
this.orderList1.push(item)
}
})
},
getZTAddress() {
setTimeout(() => {
let changeAddress = uni.getStorageSync('changeZTAddress')
if (changeAddress) {
this.defZTAddress = changeAddress
}
}, 100)
},
chooseAddress() {
NavgateTo('../address/index')
},
editAddress(item) {
NavgateTo('../ztLocation/index?item=' + JSON.stringify(item));
},
decreaseQuantity(item) {
if (item.count > 0) {
item.count--
this.changeCart(item)
}
},
increaseQuantity(item) {
console.log("🚀 ~ increaseQuantity ~ item.commodity_goods_info.total_stock:", item.commodity_goods_info.stock_quantity)
if (item.commodity_goods_info.total_stock > 0) {
if (item.count < item.commodity_goods_info.total_stock) {
item.count++;
this.changeCart(item);
} else {
uni.showToast({
title: '库存不足',
icon: 'none'
});
}
} else if (item.count < item.commodity_goods_info.stock_quantity) {
item.count++;
this.changeCart(item);
} else { } else {
NavgateTo('../ztLocation/index'); uni.showToast({
title: '库存不足',
icon: 'none'
});
} }
}, },
decreaseQuantity() { //
if (this.quantity > 1) { changeCart(item) {
this.quantity--; const params = {
goods_id_and_count: [
{
goods_id: item.goods_id,
count: item.count,
},
],
} }
request(apiArr.updateCar, "POST", params).then(res => {
uni.showToast({
title: "操作成功!",
success() { },
});
})
}, },
increaseQuantity() {
this.quantity++; //
calculateTotal(order) {
if (order === 'order1') {
let total = 0;
this.orderList1.forEach(item => {
total += item.commodity_goods_info.sales_price * item.count + item.commodity_goods_info.freight;
});
//
return total;
} else {
let total = 0;
this.orderList2.forEach(item => {
total += item.commodity_goods_info.group_buy_price * item.count + item.commodity_goods_info.freight;
});
//
return total;
}
}, },
selectPayment(payment) { selectPayment(payment) {
console.log("🚀 ~ selectPayment ~ payment:", payment)
this.selectedPayment = payment; this.selectedPayment = payment;
}, },
submitPayment() { submitPayment() {
console.log('提交支付金额¥4500.00'); console.log('提交支付金额¥4500.00');
this.boxshadow1 = true; this.boxshadow1 = true;
}, },
//
copyAddress() {
// 使uni-appAPI
uni.setClipboardData({
data: this.defAddress.address + this.defAddress.house_number,
success: () => {
uni.showToast({
title: '复制成功',
icon: 'success'
});
},
fail: () => {
uni.showToast({
title: '复制失败',
icon: 'none'
});
}
});
},
copyZTAddress() {
// 使uni-appAPI
uni.setClipboardData({
data: this.defZTAddress.address,
success: () => {
uni.showToast({
title: '复制成功',
icon: 'success'
});
},
fail: () => {
uni.showToast({
title: '复制失败',
icon: 'none'
});
}
});
},
openSave() { openSave() {
this.boxshadow1 = false; this.boxshadow1 = false;
this.boxshadow2 = true; this.boxshadow2 = true;
@ -248,6 +503,16 @@ export default {
}, },
}); });
}, },
//
isWithinActivityTime(item) {
if (!item || !item.commodity_goods_info || !item.commodity_goods_info.group_buy_activity_info) {
return false;
}
const now = new Date();
const startTime = new Date(item.commodity_goods_info.group_buy_activity_info.start_time);
const endTime = new Date(item.commodity_goods_info.group_buy_activity_info.end_time);
return now >= startTime && now <= endTime;
},
} }
}; };
</script> </script>

View File

@ -3,34 +3,21 @@
<!-- 顶部展开后的阴影 --> <!-- 顶部展开后的阴影 -->
<view class="boxshadow" v-if="topShow"></view> <view class="boxshadow" v-if="topShow"></view>
<view class="header" :class="topShow ? 'op0' : ''"> <view class="header" :class="topShow ? 'op0' : ''">
<view <view class="searchBox" :style="{ height: localHeight + 'px', paddingTop: top + 'px' }">
class="searchBox"
:style="{ height: localHeight + 'px', paddingTop: top + 'px' }"
>
<view class="searchBox_left" @click="back"> <view class="searchBox_left" @click="back">
<u-icon name="arrow-left" size="20px" color="#000"></u-icon> <u-icon name="arrow-left" size="20px" color="#000"></u-icon>
</view> </view>
<view class="searchBox_ipt" @click="searchPage"> <view class="searchBox_ipt" @click="searchPage">
<image <image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_communitySearchIcon.png"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_communitySearchIcon.png" mode="aspectFill"></image>
mode="aspectFill"
></image>
<input disabled type="text" placeholder="输入商品名称" /> <input disabled type="text" placeholder="输入商品名称" />
</view> </view>
</view> </view>
<view class="slide"> <view class="slide">
<view class="slide_con"> <view class="slide_con">
<view <view v-for="(item, index) in CateList" :key="index" class="slide_conBox" @click="changeCate(item.id)">
v-for="(item, index) in CateList"
:key="index"
class="slide_conBox"
@click="changeCate(item.id)"
>
<view class="slide_item"> <view class="slide_item">
<image <image :src="picUrl + item.category_pic" mode="aspectFill"></image>
:src="picUrl + item.category_pic"
mode="aspectFill"
></image>
<text>{{ item.category_name }}</text> <text>{{ item.category_name }}</text>
</view> </view>
</view> </view>
@ -38,44 +25,30 @@
<view class="open" @click="topOpen" v-if="!topShow"> <view class="open" @click="topOpen" v-if="!topShow">
<image <image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_openIcon.png"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_openIcon.png" mode="aspectFill"></image>
mode="aspectFill"
></image>
</view> </view>
</view> </view>
</view> </view>
<!-- 整体展开的顶部 --> <!-- 整体展开的顶部 -->
<view class="header header2" v-if="topShow"> <view class="header header2" v-if="topShow">
<view <view class="searchBox" :style="{ height: localHeight + 'px', paddingTop: top + 'px' }">
class="searchBox"
:style="{ height: localHeight + 'px', paddingTop: top + 'px' }"
>
<view class="searchBox_left"> <view class="searchBox_left">
<u-icon name="arrow-left" size="20px" color="#000"></u-icon> <u-icon name="arrow-left" size="20px" color="#000"></u-icon>
</view> </view>
<view class="searchBox_ipt"> <view class="searchBox_ipt">
<image <image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_communitySearchIcon.png"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_communitySearchIcon.png" mode="aspectFill"></image>
mode="aspectFill"
></image>
<input type="text" placeholder="输入商品名称" /> <input type="text" placeholder="输入商品名称" />
</view> </view>
</view> </view>
<view class="slide"> <view class="slide">
<view class="slide_con"> <view class="slide_con">
<view <view v-for="(item, index) in CateList" :key="index" class="slide_conBox">
v-for="(item, index) in CateList"
:key="index"
class="slide_conBox"
>
<view class="slide_item"> <view class="slide_item">
<image <image :src="picUrl + item.category_pic" mode="aspectFill"></image>
:src="picUrl + item.category_pic"
mode="aspectFill"
></image>
<text>{{ item.category_name }}</text> <text>{{ item.category_name }}</text>
</view> </view>
</view> </view>
@ -89,13 +62,8 @@
<view class="Con"> <view class="Con">
<view class="Con_left"> <view class="Con_left">
<view <view class="CateItem" :class="item.id === currentLeftCateId ? 'CateItem_active' : ''"
class="CateItem" v-for="item in leftCateList" :key="item.id" @click="changeLeftCate(item.id)">
:class="item.id === currentLeftCateId ? 'CateItem_active' : ''"
v-for="item in leftCateList"
:key="item.id"
@click="changeLeftCate(item.id)"
>
<!-- <image v-if="false" class="hot" <!-- <image v-if="false" class="hot"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_hot.png" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_hot.png"
mode="aspectFill"> mode="aspectFill">
@ -109,13 +77,8 @@
<view class="Con_right"> <view class="Con_right">
<view class="CateList_Box" :class="cateListShow ? 'bgf' : ''"> <view class="CateList_Box" :class="cateListShow ? 'bgf' : ''">
<view class="CateList" ref="cateListRef"> <view class="CateList" ref="cateListRef">
<view <view class="CateList_Item" v-for="(item, index) in tagList" :key="item.id"
class="CateList_Item" :class="index == rightTopActive ? 'CateList_Item_active' : ''" @click="checkItem(index)">
v-for="(item, index) in tagList"
:key="item.id"
:class="index == rightTopActive ? 'CateList_Item_active' : ''"
@click="checkItem(index)"
>
{{ item.tag_name }} {{ item.tag_name }}
</view> </view>
</view> </view>
@ -126,13 +89,8 @@
</view> </view>
<!-- 右下展开的内容 --> <!-- 右下展开的内容 -->
<view class="activeCateList" v-if="cateListShow"> <view class="activeCateList" v-if="cateListShow">
<view <view class="CateList_Item" v-for="(item, index) in tagList" :key="index"
class="CateList_Item" :class="index == rightTopActive ? 'CateList_Item_active' : ''" @click="checkItem(index)">
v-for="(item, index) in tagList"
:key="index"
:class="index == rightTopActive ? 'CateList_Item_active' : ''"
@click="checkItem(index)"
>
{{ item.tag_name }} {{ item.tag_name }}
</view> </view>
</view> </view>
@ -143,36 +101,21 @@
<view class="CateInfo_tit"> <view class="CateInfo_tit">
{{ item.tag_name }} {{ item.tag_name }}
</view> </view>
<view <view class="CateInfo_Item" v-for="items in item.commodity_info_list" :key="items.id">
class="CateInfo_Item"
v-for="items in item.commodity_info_list"
:key="items.id"
>
<view class="CateInfo_Item_Box"> <view class="CateInfo_Item_Box">
<view class="CateInfo_Item_left" @click="goods(items)"> <view class="CateInfo_Item_left" @click="goods(items)">
<view <view class="tag tag-img" v-if="
class="tag tag-img" !items.commodity_goods_info_list[1] &&
v-if=" items.commodity_goods_info_list[0].is_same_day
!items.commodity_goods_info_list[1] && ">当日达</view>
items.commodity_goods_info_list[0].is_same_day <image :src="picUrl + items.commodity_pic" mode="aspectFill"></image>
"
>当日达</view
>
<image
:src="picUrl + items.commodity_pic"
mode="aspectFill"
></image>
</view> </view>
<view class="CateInfo_Item_right" :class="GGshow ? 'noneBor' : ''"> <view class="CateInfo_Item_right" :class="GGshow ? 'noneBor' : ''">
<view class="CateInfo_Item_right_Tit" @click="goods(items)"> <view class="CateInfo_Item_right_Tit" @click="goods(items)">
<view <view class="tag tag-text" v-if="
class="tag tag-text" !items.commodity_goods_info_list[1] &&
v-if=" items.commodity_goods_info_list[0].is_same_day
!items.commodity_goods_info_list[1] && ">当日达</view>
items.commodity_goods_info_list[0].is_same_day
"
>当日达</view
>
{{ items.commodity_name }} {{ items.commodity_name }}
</view> </view>
<view class="CateInfo_Item_right_subtit" @click="goods(items)"> <view class="CateInfo_Item_right_subtit" @click="goods(items)">
@ -182,28 +125,17 @@
<view class="CateInfo_Item_Money_left"> <view class="CateInfo_Item_Money_left">
{{ getPriceRange(items.commodity_goods_info_list) }} {{ getPriceRange(items.commodity_goods_info_list) }}
</view> </view>
<view <view class="CateInfo_Item_Money_right" v-if="!(items.commodity_goods_info_list.length > 1)">
class="CateInfo_Item_Money_right" <u-number-box :min="0" v-model="items.commodity_goods_info_list[0].quantity"
v-if="!(items.commodity_goods_info_list.length > 1)" @change="(value) => handleQuantityChange(value, items)">
>
<u-number-box
:min="0"
v-model="items.commodity_goods_info_list[0].quantity"
@change="(value) => handleQuantityChange(value, items)"
>
<view slot="minus" class="minus"> <view slot="minus" class="minus">
<u-icon name="minus" size="20"></u-icon> <u-icon name="minus" size="20"></u-icon>
</view> </view>
<text <text slot="input" style="width: 50px; text-align: center" class="input">{{
slot="input" items.commodity_goods_info_list[0].quantity
style="width: 50px; text-align: center" ? items.commodity_goods_info_list[0].quantity
class="input" : 0
>{{ }}</text>
items.commodity_goods_info_list[0].quantity
? items.commodity_goods_info_list[0].quantity
: 0
}}</text
>
<view slot="plus" class="plus"> <view slot="plus" class="plus">
<u-icon name="plus" color="#FFFFFF" size="20"></u-icon> <u-icon name="plus" color="#FFFFFF" size="20"></u-icon>
</view> </view>
@ -211,28 +143,16 @@
</view> </view>
</view> </view>
<view <view class="gg" @click="chooseGG(items)" v-if="
class="gg" items.commodity_goods_info_list.length > 1 && !items.isShow
@click="chooseGG(items)" ">
v-if="
items.commodity_goods_info_list.length > 1 && !items.isShow
"
>
选择规格 选择规格
<u-icon <u-icon name="arrow-down" size="26rpx" color="#FF370B"></u-icon>
name="arrow-down"
size="26rpx"
color="#FF370B"
></u-icon>
</view> </view>
<view <view class="gg" @click="chooseGG(items)" v-if="
class="gg" items.commodity_goods_info_list.length > 1 && items.isShow
@click="chooseGG(items)" ">
v-if="
items.commodity_goods_info_list.length > 1 && items.isShow
"
>
收起 收起
<u-icon name="arrow-up" size="26rpx" color="#FF370B"></u-icon> <u-icon name="arrow-up" size="26rpx" color="#FF370B"></u-icon>
</view> </view>
@ -240,24 +160,14 @@
</view> </view>
<view class="GGList" v-if="items.isShow"> <view class="GGList" v-if="items.isShow">
<view <view class="GGItem" v-for="ite in items.commodity_goods_info_list" :key="ite.id" @click="goods(items)">
class="GGItem"
v-for="ite in items.commodity_goods_info_list"
:key="ite.id"
@click="goods(items)"
>
<view class="GGItem_Image"> <view class="GGItem_Image">
<view class="tag tag-img" v-if="ite.is_same_day">当日达</view> <view class="tag tag-img" v-if="ite.is_same_day">当日达</view>
<image <image :src="picUrl + ite.commodity_pic" mode="aspectFill"></image>
:src="picUrl + ite.commodity_pic"
mode="aspectFill"
></image>
</view> </view>
<view class="GGItem_Con"> <view class="GGItem_Con">
<view class="GGItem_Con_Tit"> <view class="GGItem_Con_Tit">
<view class="tag tag-text" v-if="ite.is_same_day" <view class="tag tag-text" v-if="ite.is_same_day">当日达</view>
>当日达</view
>
{{ ite.goods_name }} {{ ite.goods_name }}
</view> </view>
<view class="GGItem_Con_Msg"> <view class="GGItem_Con_Msg">
@ -265,26 +175,15 @@
<span></span>{{ ite.sales_price }} <span></span>{{ ite.sales_price }}
</view> </view>
<view class="GGItem_Con_Msg_right"> <view class="GGItem_Con_Msg_right">
<u-number-box <u-number-box v-model="ite.quantity" :min="0"
v-model="ite.quantity" @change="(value) => handleQuantityChange(value, ite)">
:min="0"
@change="(value) => handleQuantityChange(value, ite)"
>
<view slot="minus" class="minus"> <view slot="minus" class="minus">
<u-icon name="minus" size="20"></u-icon> <u-icon name="minus" size="20"></u-icon>
</view> </view>
<text <text slot="input" style="width: 50px; text-align: center" class="input">{{ ite.quantity ?
slot="input" ite.quantity : 0 }}</text>
style="width: 50px; text-align: center"
class="input"
>{{ ite.quantity ? ite.quantity : 0 }}</text
>
<view slot="plus" class="plus"> <view slot="plus" class="plus">
<u-icon <u-icon name="plus" color="#FFFFFF" size="20"></u-icon>
name="plus"
color="#FFFFFF"
size="20"
></u-icon>
</view> </view>
</u-number-box> </u-number-box>
</view> </view>
@ -308,15 +207,8 @@
<!-- <nav-footer :current="3" /> --> <!-- <nav-footer :current="3" /> -->
<view class="shop_car" @click="shopCar"> <view class="shop_car" @click="shopCar">
<u-badge <u-badge numberType="limit" type="error" max="99" :value="carNum"></u-badge>
numberType="limit" <image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_car_num.png"></image>
type="error"
max="99"
:value="carNum"
></u-badge>
<image
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_car_num.png"
></image>
<!-- <image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_car_empty.png"></image> --> <!-- <image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_car_empty.png"></image> -->
</view> </view>
</view> </view>
@ -435,8 +327,8 @@ export default {
NavgateTo("../search/index"); NavgateTo("../search/index");
}, },
// //
goods(e) { goods(e) {
console.log(`${JSON.stringify(e)}`); console.log(`${JSON.stringify(e)}`);
NavgateTo(`../goods/index?item=${JSON.stringify(e)}`); NavgateTo(`../goods/index?item=${JSON.stringify(e)}`);
// NavgateTo("../goods/index"); // NavgateTo("../goods/index");
}, },
@ -472,9 +364,9 @@ export default {
request(apiArr.getGoodsList, "POST", { request(apiArr.getGoodsList, "POST", {
user_id: uni.getStorageSync("userId"), user_id: uni.getStorageSync("userId"),
id: this.secondId, id: this.secondId,
}).then((res) => { }).then((res) => {
console.log(123); console.log(123);
console.log(res) console.log(res)
res.commodity_list.forEach((item) => { res.commodity_list.forEach((item) => {
item.commodity_info_list.forEach((item) => { item.commodity_info_list.forEach((item) => {
item.commodity_goods_info_list.forEach((param) => { item.commodity_goods_info_list.forEach((param) => {
@ -530,7 +422,7 @@ export default {
this.getShopCarList(); this.getShopCarList();
uni.showToast({ uni.showToast({
title: "操作成功!", title: "操作成功!",
success() {}, success() { },
}); });
}); });
}, },

View File

@ -1,23 +1,23 @@
<template> <template>
<view> <view>
<div class="header"> <view class="header">
<div class="searchBox" :style="{ height: localHeight + 'px', paddingTop: top + 'px' }"> <view class="searchBox" :style="{ height: localHeight + 'px', paddingTop: top + 'px' }">
<div class="searchBox_left" @click="back"> <view class="searchBox_left" @click="back">
<u-icon name="arrow-left" size="20px" color="#000"></u-icon> <u-icon name="arrow-left" size="20px" color="#000"></u-icon>
</div> </view>
<div class="searchBox_mid">购物车({{ shopCarTotal }})</div> <view class="searchBox_mid">购物车({{ shopCarTotal }})</view>
<div class="searchBox_right"> <view class="searchBox_right">
<u-icon name="arrow-left" size="20px" color="#000"></u-icon> <u-icon name="arrow-left" size="20px" color="#000"></u-icon>
</div> </view>
</div> </view>
</div> </view>
<div class="main"> <view class="main">
<div class="deleteIcon" @click="deleteItem"> <view class="deleteIcon" @click="deleteItem">
<u-icon name="trash" size="50rpx"></u-icon> <u-icon name="trash" size="50rpx"></u-icon>
</div> </view>
<div class="is_day " v-if="isDayshow"> <view class="is_day " v-if="isDayshow">
<div class="footer_all" @click="is_day_checked" <view class="footer_all" @click="is_day_checked"
style="color: orange; font-size: 35rpx; font-weight: bolder;"> style="color: orange; font-size: 35rpx; font-weight: bolder;">
<image v-if="!isDaychecked" <image v-if="!isDaychecked"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png"> src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png">
@ -26,60 +26,60 @@
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png"> src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png">
</image> </image>
当日达 当日达
</div> </view>
<div class="goodsList"> <view class="goodsList">
<div class="goodsItem" v-for="(item, index) in isDayCarList" :key="item.id"> <view class="goodsItem" v-for="(item, index) in isDayCarList" :key="item.id">
<div class="goodsItem_left" @click="DayChecked(item, index)"> <view class="goodsItem_left" @click="DayChecked(item, index)">
<image v-if="!item.checked" <image v-if="!item.checked"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png"> src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png">
</image> </image>
<image v-if="item.checked" <image v-if="item.checked"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png"> src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png">
</image> </image>
</div> </view>
<div class="goodsItem_right"> <view class="goodsItem_right">
<div class="goodsItem_msg"> <view class="goodsItem_msg">
<div class="goodsItem_msg_img"> <view class="goodsItem_msg_img">
<view class="tag tag-img">当日达</view> <view class="tag tag-img">当日达</view>
<image :src="picUrl + item.commodity_goods_info.commodity_pic"> <image :src="picUrl + item.commodity_goods_info.commodity_pic">
</image> </image>
</div> </view>
<div class="goodsItem_msg_right"> <view class="goodsItem_msg_right">
<div class="goodsItem_msg_right_tit"> <view class="goodsItem_msg_right_tit">
{{ item.commodity_goods_info.goods_name }} {{ item.commodity_goods_info.goods_name }}
</div> </view>
<div class="goodsItem_msg_right_subTit"> <view class="goodsItem_msg_right_subTit">
{{ item.commodity_goods_info.goods_intro }} {{ item.commodity_goods_info.goods_intro }}
</div> </view>
<div class="goodsItem_msg_right_msg"> <view class="goodsItem_msg_right_msg">
<div class="goodsItem_msg_right_msg_left"> <view class="goodsItem_msg_right_msg_left">
<span></span>{{ item.commodity_goods_info.sales_price }} <span></span>{{ item.commodity_goods_info.sales_price }}
<span>/{{ item.commodity_goods_info.goods_unit }}</span> <span>/{{ item.commodity_goods_info.goods_unit }}</span>
</div> </view>
<div class="goodsItem_msg_right_msg_right"> <view class="goodsItem_msg_right_msg_right">
<u-number-box v-model="item.count" :asyncChange="true" min="0"> <u-number-box v-model="item.count" :asyncChange="true" min="0">
<view slot="minus" class="minus" @click="minus(item, index)"> <view slot="minus" class="minus" @click="minus(item, index)">
<u-icon name="minus" size="32" bold></u-icon> <u-icon name="minus" size="32" bold></u-icon>
</view> </view>
<text slot="input" style="width: 80rpx; text-align: center" <text slot="input" style="width: 80rpx; text-align: center"
class="input">{{ item.count }}</text> class="input">{{ item.count }}</text>
<view slot="plus" class="plus" @click="add(item, index)"> <view slot="plus" class="plus" @click="add(item, index)">
<u-icon name="plus" color="#FFFFFF" size="32" bold></u-icon> <u-icon name="plus" color="#FFFFFF" size="32" bold></u-icon>
</view> </view>
</u-number-box> </u-number-box>
</div> </view>
</div> </view>
</div> </view>
</div> </view>
</div> </view>
</div> </view>
</div> </view>
</div> </view>
<div class="is_day" v-if="parcelPostshow" style="margin-top: 20rpx;"> <view class="is_day" v-if="parcelPostshow" style="margin-top: 20rpx;">
<div class="footer_all" @click="parcel_post_checked" <view class="footer_all" @click="parcel_post_checked"
style="color: orange; font-size: 35rpx; font-weight: bolder;"> style="color: orange; font-size: 35rpx; font-weight: bolder;">
<image v-if="!isParcelPostchecked" <image v-if="!isParcelPostchecked"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png"> src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png">
@ -88,65 +88,65 @@
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png"> src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png">
</image> </image>
包邮 包邮
</div> </view>
<div class="goodsList"> <view class="goodsList">
<div class="goodsItem" v-for="(item, index) in shopCarList" :key="item.id"> <view class="goodsItem" v-for="(item, index) in shopCarList" :key="item.id">
<div class="goodsItem_left" @click="changeChecked(item, index)"> <view class="goodsItem_left" @click="changeChecked(item, index)">
<image v-if="!item.checked" <image v-if="!item.checked"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png"> src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png">
</image> </image>
<image v-if="item.checked" <image v-if="item.checked"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png"> src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png">
</image> </image>
</div> </view>
<div class="goodsItem_right"> <view class="goodsItem_right">
<div class="goodsItem_msg"> <view class="goodsItem_msg">
<div class="goodsItem_msg_img"> <view class="goodsItem_msg_img">
<image :src="picUrl + item.commodity_goods_info.commodity_pic"> <image :src="picUrl + item.commodity_goods_info.commodity_pic">
</image> </image>
</div> </view>
<div class="goodsItem_msg_right"> <view class="goodsItem_msg_right">
<div class="goodsItem_msg_right_tit"> <view class="goodsItem_msg_right_tit">
{{ item.commodity_goods_info.goods_name }} {{ item.commodity_goods_info.goods_name }}
</div> </view>
<div class="goodsItem_msg_right_subTit"> <view class="goodsItem_msg_right_subTit">
{{ item.commodity_goods_info.goods_intro }} {{ item.commodity_goods_info.goods_intro }}
</div> </view>
<div class="goodsItem_msg_right_msg"> <view class="goodsItem_msg_right_msg">
<div class="goodsItem_msg_right_msg_left"> <view class="goodsItem_msg_right_msg_left">
<span></span>{{ item.commodity_goods_info.sales_price }} <span></span>{{ item.commodity_goods_info.sales_price }}
<span>/{{ item.commodity_goods_info.goods_unit }}</span> <span>/{{ item.commodity_goods_info.goods_unit }}</span>
</div> </view>
<div class="goodsItem_msg_right_msg_right"> <view class="goodsItem_msg_right_msg_right">
<u-number-box v-model="item.count" :asyncChange="true" min="0"> <u-number-box v-model="item.count" :asyncChange="true" min="0">
<view slot="minus" class="minus" @click="minus(item, index)"> <view slot="minus" class="minus" @click="minus(item, index)">
<u-icon name="minus" size="32" bold></u-icon> <u-icon name="minus" size="32" bold></u-icon>
</view> </view>
<text slot="input" style="width: 80rpx; text-align: center" <text slot="input" style="width: 80rpx; text-align: center"
class="input">{{ item.count }}</text> class="input">{{ item.count }}</text>
<view slot="plus" class="plus" @click="add(item, index)"> <view slot="plus" class="plus" @click="add(item, index)">
<u-icon name="plus" color="#FFFFFF" size="32" bold></u-icon> <u-icon name="plus" color="#FFFFFF" size="32" bold></u-icon>
</view> </view>
</u-number-box> </u-number-box>
</div> </view>
</div> </view>
</div> </view>
</div> </view>
</div> </view>
</div> </view>
</div> </view>
</div> </view>
<div class="footer"> <view class="footer">
<div class="footer_left"> <view class="footer_left">
<div class="footer_all" @click="allChecked"> <view class="footer_all" @click="allChecked">
<image v-if="!isAllchecked" <image v-if="!isAllchecked"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png"> src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png">
</image> </image>
@ -154,23 +154,23 @@
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png"> src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png">
</image> </image>
全选 全选
</div> </view>
<div class="footer_total"> <view class="footer_total">
<span>合计</span> <span>合计</span>
{{ shopMoney }} {{ shopMoney }}
</div> </view>
</div> </view>
<div class="footer_right" @click="submitOrder">结算</div> <view class="footer_right" @click="submitOrder">结算</view>
</div> </view>
</div> </view>
<div class="empty" v-if="shopCarTotal == 0"> <view class="empty" v-if="shopCarTotal == 0">
<image src="http://192.168.0.172:5500/7.15/shop_empty.png"></image> <image src="http://192.168.0.172:5500/7.15/shop_empty.png"></image>
<div> <view>
啥也没有 <br /> 啥也没有 <br />
赶紧去shopping吧~ 赶紧去shopping吧~
</div> </view>
</div> </view>
</view> </view>
</template> </template>
@ -192,7 +192,7 @@
localHeight: "", localHeight: "",
value: 3, value: 3,
type: "error", type: "error",
shopCarList: [], shopCarList: [],
isDayCarList: [], isDayCarList: [],
shopCarTotal: 0, shopCarTotal: 0,
shopMoney: 0, shopMoney: 0,
@ -230,7 +230,8 @@
} }
}); });
NavgateTo(`../submitOrder/index?shopCarList=${JSON.stringify(arr)}`); // NavgateTo(`../submitOrder/index?shopCarList=${JSON.stringify(arr)}`);
NavgateTo(`../groupPurchaseSubmit/index?shopCarList=${JSON.stringify(arr)}`);
}, },
// //
@ -238,20 +239,20 @@
request(apiArr.getCar, "POST", {}).then((res) => { request(apiArr.getCar, "POST", {}).then((res) => {
console.log(res.total); console.log(res.total);
// res.commodity_cart_list.forEach((item) => { // res.commodity_cart_list.forEach((item) => {
res.normal_cart_list.forEach((item) => { res.normal_cart_list.forEach((item) => {
console.log(item.commodity_cart_and_goods_model); console.log(item.commodity_cart_and_goods_model);
if(item.is_support_same_day == false) { if(item.is_support_same_day == false) {
this.isDayshow = false; this.isDayshow = false;
this.parcelPostshow = true; this.parcelPostshow = true;
this.shopCarList = item.commodity_cart_and_goods_model; this.shopCarList = item.commodity_cart_and_goods_model;
item.checked = false; item.checked = false;
} else { } else {
this.isDayshow = true; this.isDayshow = true;
this.parcelPostshow = false; this.parcelPostshow = false;
this.isDayCarList = item.commodity_cart_and_goods_model; this.isDayCarList = item.commodity_cart_and_goods_model;
item.checked = false; item.checked = false;
} }
}); });
// this.shopCarList = res.commodity_cart_list; // this.shopCarList = res.commodity_cart_list;
// this.shopCarList = res.normal_cart_list[0].commodity_cart_and_goods_model; // this.shopCarList = res.normal_cart_list[0].commodity_cart_and_goods_model;
@ -266,21 +267,21 @@
// }, // },
// //
changeChecked(item, index) { changeChecked(item, index) {
this.shopCarList[index].checked = !this.shopCarList[index].checked; this.shopCarList[index].checked = !this.shopCarList[index].checked;
this.calcTotal(); this.calcTotal();
this.isParcelPostchecked = this.shopCarList.every((item) => item.checked); this.isParcelPostchecked = this.shopCarList.every((item) => item.checked);
if(this.isDayshow == false) { if(this.isDayshow == false) {
this.isAllchecked = this.shopCarList.every((item) => item.checked); this.isAllchecked = this.shopCarList.every((item) => item.checked);
} }
}, },
DayChecked(item, index) { DayChecked(item, index) {
this.isDayCarList[index].checked = !this.isDayCarList[index].checked; this.isDayCarList[index].checked = !this.isDayCarList[index].checked;
this.calcTotal(); this.calcTotal();
this.isDaychecked = this.isDayCarList.every((item) => item.checked); this.isDaychecked = this.isDayCarList.every((item) => item.checked);
if(this.parcelPostshow == false) { if(this.parcelPostshow == false) {
this.isAllchecked = this.isDayCarList.every((item) => item.checked); this.isAllchecked = this.isDayCarList.every((item) => item.checked);
} }
}, },
// //
allChecked() { allChecked() {
@ -288,14 +289,14 @@
// this.isDaychecked = !this.isDaychecked; // this.isDaychecked = !this.isDaychecked;
// this.isParcelPostchecked = !this.isParcelPostchecked; // this.isParcelPostchecked = !this.isParcelPostchecked;
// Bug !this.allChecked !this.isAllchecked // Bug !this.allChecked !this.isAllchecked
if (this.isAllchecked) { if (this.isAllchecked) {
this.isDaychecked = true; this.isDaychecked = true;
this.isParcelPostchecked = true; this.isParcelPostchecked = true;
this.shopCarList.forEach((item) => { this.shopCarList.forEach((item) => {
item.checked = true; item.checked = true;
}); });
} else { } else {
this.isDaychecked = false; this.isDaychecked = false;
this.isParcelPostchecked = false; this.isParcelPostchecked = false;
this.shopCarList.forEach((item) => { this.shopCarList.forEach((item) => {
item.checked = false; item.checked = false;
@ -306,7 +307,7 @@
// //
is_day_checked() { is_day_checked() {
this.isDaychecked = !this.isDaychecked; this.isDaychecked = !this.isDaychecked;
this.isAllchecked = !this.isAllchecked this.isAllchecked = !this.isAllchecked
if (this.isDaychecked) { if (this.isDaychecked) {
this.isDayCarList.forEach((item) => { this.isDayCarList.forEach((item) => {
@ -325,8 +326,8 @@
// //
parcel_post_checked() { parcel_post_checked() {
this.isParcelPostchecked = !this.isParcelPostchecked; this.isParcelPostchecked = !this.isParcelPostchecked;
this.isAllchecked = !this.isAllchecked this.isAllchecked = !this.isAllchecked
console.log(this.isParcelPostchecked); console.log(this.isParcelPostchecked);
if (this.isParcelPostchecked) { if (this.isParcelPostchecked) {
this.shopCarList.forEach((item) => { this.shopCarList.forEach((item) => {
@ -336,7 +337,7 @@
this.shopCarList.forEach((item) => { this.shopCarList.forEach((item) => {
item.checked = false; item.checked = false;
}); });
} }
this.calcTotal(); this.calcTotal();

View File

@ -1,45 +1,44 @@
<template> <template>
<view class="container"> <view class="container">
<div class="address"> <view class="address">
<div class="border"> <view class="border">
<image src="http://192.168.0.172:5500/7.15/shop_border.png" mode="widthFix"></image> <image src="http://192.168.0.172:5500/7.15/shop_border.png" mode="widthFix"></image>
</div> </view>
<div class="address_Info" @click="choseAddress" v-if="defAddress"> <view class="address_Info" @click="choseAddress" v-if="defAddress">
<div class="address_Info_left"> <view class="address_Info_left">
<div class="address_Info_left_tit">收货地址</div> <view class="address_Info_left_tit">收货地址</view>
<div class="address_Info_left_name">{{ defAddress.name }} {{ defAddress.phone }}</div> <view class="address_Info_left_name">{{ defAddress.name }} {{ defAddress.phone }}</view>
<div class="address_Info_left_addr">{{ defAddress.address }}{{ defAddress.house_number }}</div> <view class="address_Info_left_addr">{{ defAddress.address }}{{ defAddress.house_number }}</view>
</div> </view>
</div> </view>
<div class="address_Info" @click="addAddress" v-if="!defAddress"> <view class="address_Info" @click="addAddress" v-if="!defAddress">
<div class="address_Info_left noneDef"> <view class="address_Info_left noneDef">
<div class="address_Info_btn">添加收货地址</div> <view class="address_Info_btn">添加收货地址</view>
</div> </view>
</view>
</div> <view class="border">
<div class="border">
<image src="http://192.168.0.172:5500/7.15/shop_border.png" mode="widthFix"></image> <image src="http://192.168.0.172:5500/7.15/shop_border.png" mode="widthFix"></image>
</div> </view>
</div> </view>
<div class="goodsCate" v-for="items, indexs in carList" :key="indexs"> <view class="goodsCate" v-for="items, indexs in carList" :key="indexs">
<div class="goodsItem"> <view class="goodsItem">
<div class="goodsItem_msg_img"> <view class="goodsItem_msg_img">
<view class="tag tag-img" v-if="items.commodity_goods_info.is_same_day">当日达</view> <view class="tag tag-img" v-if="items.commodity_goods_info.is_same_day">当日达</view>
<image :src="picUrl + items.commodity_goods_info.commodity_pic"> <image :src="picUrl + items.commodity_goods_info.commodity_pic">
</image> </image>
</div> </view>
<div class="goodsItem_msg_right"> <view class="goodsItem_msg_right">
<div class="goodsItem_msg_right_tit" style="display: flex"><div class="tag" style="margin-right: 10rpx" v-if="items.commodity_goods_info.is_same_day">当日达</div><div>{{ items.commodity_goods_info.goods_name }}</div></div> <view class="goodsItem_msg_right_tit" style="display: flex"><view class="tag" style="margin-right: 10rpx" v-if="items.commodity_goods_info.is_same_day">当日达</view><view>{{ items.commodity_goods_info.goods_name }}</view></view>
<div class="goodsItem_msg_right_subTit">{{ items.commodity_goods_info.goods_intro }}</div> <view class="goodsItem_msg_right_subTit">{{ items.commodity_goods_info.goods_intro }}</view>
<div class="goodsItem_msg_right_msg"> <view class="goodsItem_msg_right_msg">
<div class="goodsItem_msg_right_msg_left"> <view class="goodsItem_msg_right_msg_left">
<span></span>{{ items.commodity_goods_info.sales_price }} <span></span>{{ items.commodity_goods_info.sales_price }}
<span>/{{ items.commodity_goods_info.goods_unit }}</span> <span>/{{ items.commodity_goods_info.goods_unit }}</span>
</div> </view>
<div class="goodsItem_msg_right_msg_right"> <view class="goodsItem_msg_right_msg_right">
<u-number-box v-model="value"> <u-number-box v-model="value">
<view slot="minus" class="minus" @click="minus(items, indexs)"> <view slot="minus" class="minus" @click="minus(items, indexs)">
<u-icon name="minus" size="32" bold></u-icon> <u-icon name="minus" size="32" bold></u-icon>
@ -51,20 +50,20 @@
<u-icon name="plus" color="#FFFFFF" size="32" bold></u-icon> <u-icon name="plus" color="#FFFFFF" size="32" bold></u-icon>
</view> </view>
</u-number-box> </u-number-box>
</div> </view>
</div> </view>
</div> </view>
</div> </view>
<div class="yf"> <view class="yf">
<span>运费</span>9.9 <span>运费</span>9.9
</div> </view>
<div class="line"></div> <view class="line"></view>
</div> </view>
<div class="footer"> <view class="footer">
<div class="btn">立即支付{{ totalMony }}</div> <view class="btn">立即支付{{ totalMony }}</view>
</div> </view>
</view> </view>
</template> </template>
@ -225,7 +224,7 @@ export default {
onLoad(options) { onLoad(options) {
const meun = menuButtonInfo(); const meun = menuButtonInfo();
this.top = meun.top; this.top = meun.top;
this.localHeight = meun.height; this.localHeight = meun.height;
console.log(JSON.parse(options.shopCarList)); console.log(JSON.parse(options.shopCarList));
this.carList = JSON.parse(options.shopCarList) this.carList = JSON.parse(options.shopCarList)
this.calcTotal() this.calcTotal()

View File

@ -42,8 +42,9 @@ page {
color: #333; color: #333;
} }
/* 增加优先级确保选中样式生效 */
.location-item .location-address.active { .location-item .location-address.active {
color: #fd631a; color: #fd631a !important;
} }
.location-select { .location-select {

View File

@ -3,23 +3,18 @@
<view class="fenge"></view> <view class="fenge"></view>
<view class="location-list"> <view class="location-list">
<!-- 地址项 --> <!-- 地址项 -->
<view class="location-item" v-for="(item, index) in locationList" :key="index" @click="selectLocation(item)"> <view class="location-item" v-for="(item, index) in locationList" :key="index"
@click="selectLocation(item, index)">
<view class="location-info"> <view class="location-info">
<text :class="['location-address', { 'active': item.checked }]">{{ item.address }}</text> <text :class="['location-address', { 'active': index === selectedIndex }]">{{ item.address }}</text>
</view> </view>
<view class="location-select"> <view class="location-select">
<image <image v-if="index !== selectedIndex"
v-if="!item.checked" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png" mode="aspectFit"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png" style="width: 40rpx; height: 40rpx;"></image>
mode="aspectFit" <image v-if="index === selectedIndex"
style="width: 40rpx; height: 40rpx;" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png" mode="aspectFit"
></image> style="width: 40rpx; height: 40rpx;"></image>
<image
v-if="item.checked"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png"
mode="aspectFit"
style="width: 40rpx; height: 40rpx;"
></image>
</view> </view>
</view> </view>
</view> </view>
@ -27,32 +22,62 @@
</template> </template>
<script> <script>
import { picUrl, menuButtonInfo, request, NavgateTo } from "../../../utils";
import { apiArr } from '../../../api/groupPurchase';
export default { export default {
data() { data() {
return { return {
locationList: [ locationList: [],
{ selectedIndex: -1
id: 1,
address: '上海市上海市浦东新区上海市浦东新区杨高中路2128号正大生活馆F2层',
checked: true
},
{
id: 2,
address: '上海市上海市浦东新区上海市浦东新区杨高中路2128号正大生活馆F2层',
checked: false
}
]
}; };
}, },
onLoad(options) {
const item = JSON.parse(options.item)
console.log("🚀 ~ onLoad ~ item:", item)
this.getLocationList(item.goods_id)
},
methods: { methods: {
selectLocation(item) { async getLocationList(id) {
// const params = {
this.locationList.forEach(loc => { goods_ids: id,
loc.checked = false; }
const res = await request(apiArr.groupBuyAddress, 'POST', params)
//
res.self_pickup_address_list[0].address.forEach(item => {
const [name, phone, address] = item.split(' ');
this.locationList.push({
id: id,
name: name || '',
phone: phone || '',
address: address || ''
});
}); });
// },
item.checked = true; selectLocation(item, index) {
console.log("🚀 ~ selectLocation ~ item.address:", item.address) //
this.selectedIndex = index;
console.log("🚀 ~ selectLocation ~ 选中地址:", item)
//
let addressList = uni.getStorageSync('changeZTAddress') || [];
// id
const existingIndex = addressList.findIndex(addr => addr.id === item.id);
console.log("🚀 ~ selectLocation ~ existingIndex:", existingIndex)
if (existingIndex > -1) {
// id
addressList[existingIndex] = item;
} else {
// id
addressList.push(item);
}
//
uni.setStorageSync('changeZTAddress', addressList);
NavgateTo("1")
} }
} }
}; };