完成团购模块
This commit is contained in:
parent
0b302c5bbe
commit
4d1dcb72cb
@ -12,5 +12,7 @@ export const apiArr = {
|
||||
payOrder: "/api/v2/wechat/commodity/order/pay",//支付订单
|
||||
settingDefaultAddress: '/api/v2/wechat/commodity/receiving_address/default', // 收货地址设置默认
|
||||
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', // 查询订单
|
||||
}
|
||||
@ -1,167 +1,209 @@
|
||||
[
|
||||
{
|
||||
"id": 1001,
|
||||
"user_id": 2001,
|
||||
"user_id": 20001,
|
||||
"supplier_id": 3001,
|
||||
"supplier_name": "生鲜优选",
|
||||
"order_group_id": 5001,
|
||||
"order_no": "DD202508131001",
|
||||
"total_amount": 88.50,
|
||||
"supplier_name": "鲜丰水果供应链有限公司",
|
||||
"order_group_id": 40001,
|
||||
"order_no": "SH20240823001001",
|
||||
"total_amount": 156.80,
|
||||
"total_count": 3,
|
||||
"order_status": 1,
|
||||
"order_status": 3,
|
||||
"cancelled_by": "",
|
||||
"cancel_time": "",
|
||||
"cancel_reason": "",
|
||||
"evauate_status": 2,
|
||||
"after_sales_status": 2,
|
||||
"receiving_name": "张三",
|
||||
"receiving_phone": "13800138001",
|
||||
"receiving_address": "北京市朝阳区科技园A座101",
|
||||
"receiving_name": "李佳",
|
||||
"receiving_phone": "15901518415",
|
||||
"receiving_address": "北京市朝阳区珠江绿洲文化广场3号楼2单元1002室",
|
||||
"pay_method": "微信支付",
|
||||
"payment_amount": 0,
|
||||
"payment_status": "未支付",
|
||||
"payment_serial": "",
|
||||
"payer_name": "",
|
||||
"order_time": "2025-08-13T10:30:00Z",
|
||||
"is_same_day": 1,
|
||||
"estimated_delivery_time": "今日14:00-16:00",
|
||||
"remark": "请尽快配送",
|
||||
"shiliu_score": 88.5,
|
||||
"shiliu_seed": 22.1,
|
||||
"timeout_time_stamp": 1755086400,
|
||||
"payment_amount": 156.80,
|
||||
"payment_status": "已支付",
|
||||
"payment_time": "2024-08-23 10:15:30",
|
||||
"payment_serial": "WX202408231015300012345678",
|
||||
"payer_name": "李佳",
|
||||
"completed_at": "",
|
||||
"order_time": "2024-08-23 10:10:22",
|
||||
"is_same_day": 2,
|
||||
"estimated_delivery_time": "2024-08-24 09:00-18:00",
|
||||
"remark": "请放在小区丰巢柜,谢谢",
|
||||
"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": [
|
||||
{
|
||||
"id": 7001,
|
||||
"id": 50001,
|
||||
"order_id": 1001,
|
||||
"goods_id": 8001,
|
||||
"goods_name": "澳洲牛排",
|
||||
"goods_id": 6001,
|
||||
"goods_name": "泰国金枕榴莲(2-2.5斤/个)",
|
||||
"commodity_pic": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
|
||||
"goods_unit": "盒",
|
||||
"goods_spec": "200g/盒",
|
||||
"cost_price": 45.0,
|
||||
"sales_price": 68.0,
|
||||
"goods_unit": "个",
|
||||
"goods_spec": "2-2.5斤",
|
||||
"cost_price": 45.00,
|
||||
"sales_price": 69.90,
|
||||
"count": 1,
|
||||
"after_sales_status": 2,
|
||||
"is_support_same_day": 1,
|
||||
"is_same_day": true
|
||||
"is_same_day": false
|
||||
},
|
||||
{
|
||||
"id": 7002,
|
||||
"goods_id": 8002,
|
||||
"goods_name": "有机西兰花",
|
||||
"id": 50002,
|
||||
"order_id": 1001,
|
||||
"goods_id": 6002,
|
||||
"goods_name": "阳光玫瑰葡萄(1斤装)",
|
||||
"commodity_pic": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
|
||||
"goods_unit": "份",
|
||||
"goods_spec": "500g/份",
|
||||
"cost_price": 8.0,
|
||||
"sales_price": 10.5,
|
||||
"goods_unit": "斤",
|
||||
"goods_spec": "1斤",
|
||||
"cost_price": 12.00,
|
||||
"sales_price": 25.90,
|
||||
"count": 2,
|
||||
"after_sales_status": 2,
|
||||
"is_support_same_day": 1,
|
||||
"is_same_day": true
|
||||
"is_same_day": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 1002,
|
||||
"order_no": "DD202508131002",
|
||||
"total_amount": 152.0,
|
||||
"total_count": 5,
|
||||
"order_status": 2,
|
||||
"payment_status": "支付中",
|
||||
"payment_time": "2025-08-13T10:35:22Z",
|
||||
"payer_name": "李四",
|
||||
"order_time": "2025-08-13T10:32:15Z",
|
||||
"user_id": 20002,
|
||||
"supplier_id": 3002,
|
||||
"supplier_name": "优选生鲜超市供应链",
|
||||
"order_group_id": 40002,
|
||||
"order_no": "SH20240823001002",
|
||||
"total_amount": 89.50,
|
||||
"total_count": 2,
|
||||
"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": [
|
||||
{
|
||||
"id": 7003,
|
||||
"goods_id": 8003,
|
||||
"goods_name": "精品榴莲",
|
||||
"id": 50003,
|
||||
"order_id": 1002,
|
||||
"goods_id": 6003,
|
||||
"goods_name": "精品富士苹果(5斤装)",
|
||||
"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,
|
||||
"after_sales_status": 2,
|
||||
"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,
|
||||
"order_no": "DD202508131003",
|
||||
"total_amount": 45.8,
|
||||
"order_status": 3,
|
||||
"payment_status": "已支付",
|
||||
"payment_amount": 45.8,
|
||||
"payment_serial": "PY20250813100003",
|
||||
"order_time": "2025-08-13T09:15:30Z",
|
||||
"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",
|
||||
"user_id": 20003,
|
||||
"supplier_id": 3003,
|
||||
"supplier_name": "美菜网餐饮供应链",
|
||||
"order_group_id": 40003,
|
||||
"order_no": "SH20240822001003",
|
||||
"total_amount": 328.00,
|
||||
"total_count": 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": "已支付",
|
||||
"completed_at": "2025-08-13T15:20:18Z",
|
||||
"order_time": "2025-08-13T11:20:18Z",
|
||||
"payment_time": "2024-08-22 15:20:40",
|
||||
"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": [
|
||||
{
|
||||
"id": 7003,
|
||||
"goods_id": 8003,
|
||||
"goods_name": "冷冻虾仁",
|
||||
"id": 50005,
|
||||
"order_id": 1003,
|
||||
"goods_id": 6005,
|
||||
"goods_name": "新鲜生菜(1斤装)",
|
||||
"commodity_pic": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
|
||||
"sales_price": 152.0,
|
||||
"count": 3,
|
||||
"is_support_same_day": 1,
|
||||
"goods_unit": "斤",
|
||||
"goods_spec": "1斤",
|
||||
"cost_price": 1.80,
|
||||
"sales_price": 3.50,
|
||||
"count": 2,
|
||||
"after_sales_status": 1,
|
||||
"is_support_same_day": 2,
|
||||
"is_same_day": false
|
||||
},
|
||||
{
|
||||
"id": 7004,
|
||||
"goods_id": 8004,
|
||||
"goods_name": "精品榴莲",
|
||||
"id": 50006,
|
||||
"order_id": 1003,
|
||||
"goods_id": 6006,
|
||||
"goods_name": "冷冻鸡胸肉(1kg装)",
|
||||
"commodity_pic": "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
|
||||
"sales_price": 152.0,
|
||||
"count": 1,
|
||||
"goods_unit": "袋",
|
||||
"goods_spec": "1kg",
|
||||
"cost_price": 12.00,
|
||||
"sales_price": 22.80,
|
||||
"count": 3,
|
||||
"after_sales_status": 2,
|
||||
"is_support_same_day": 2,
|
||||
"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
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@ -8,12 +8,12 @@
|
||||
</view>
|
||||
<view class="status-bar" v-if="status === '3'">
|
||||
<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>
|
||||
<view class="status-bar" v-if="status === '4'">
|
||||
<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">
|
||||
配送司机:15901518415
|
||||
<img class="phone" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/myOrder/phone.png" />
|
||||
@ -21,7 +21,7 @@
|
||||
</view>
|
||||
<view class="status-bar" v-if="status === '5' || status === '退款中'">
|
||||
<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>
|
||||
<view class="status-bar" v-if="status === '6'">
|
||||
@ -39,9 +39,9 @@
|
||||
<!-- 订单金额 -->
|
||||
<view class="amount-section">
|
||||
<view v-if="status !== '退款中'">
|
||||
<view class="total-amount">¥{{ orderInfo.shiliu_score }}</view>
|
||||
<view class="total-amount">¥{{ orderInfo.payment_amount }}</view>
|
||||
<view class="original-price">商品下单应付
|
||||
<text> ¥{{ orderInfo.shiliu_score }}</text>
|
||||
<text> ¥{{ orderInfo.payment_amount }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<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="info-item">
|
||||
<view class="info-label">配送方式</view>
|
||||
<!-- <view class="info-value">{{ orderInfo.deliveryType }}</view> -->
|
||||
<view class="info-value">商家自配</view>
|
||||
<view class="info-value" v-if="orderInfo.order_cate === 1">商家自配</view>
|
||||
<view class="info-value" v-if="orderInfo.order_cate === 2">客户自提</view>
|
||||
</view>
|
||||
<view class="info-item">
|
||||
<view class="info-label">预计配送时间</view>
|
||||
<view class="info-value"></view>
|
||||
<view class="info-value">{{ orderInfo.estimated_delivery_time }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
@ -1,52 +1,52 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<div class="row">
|
||||
<div class="row_label"><span>*</span>收货人</div>
|
||||
<div class="row_con">
|
||||
<view class="row">
|
||||
<view class="row_label"><span>*</span>收货人</view>
|
||||
<view class="row_con">
|
||||
<u--input placeholder="请输入姓名" clearable border="none" v-model="name"></u--input>
|
||||
</div>
|
||||
</div>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<div class="row">
|
||||
<div class="row_label"><span>*</span>手机号</div>
|
||||
<div class="row_con">
|
||||
<view class="row">
|
||||
<view class="row_label"><span>*</span>手机号</view>
|
||||
<view class="row_con">
|
||||
<u--input type="number" placeholder="请输入手机号" clearable border="none" v-model="phone" ></u--input>
|
||||
</div>
|
||||
</div>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<div class="tabList">
|
||||
<div class="tabItem" :class="{ 'active': tab == 0 }" @click="changeTab(0)">地图选址</div>
|
||||
<div class="tabItem" :class="{ 'active': tab == 1 }" @click="changeTab(1)">地区选择</div>
|
||||
</div>
|
||||
<view class="tabList">
|
||||
<view class="tabItem" :class="{ 'active': tab == 0 }" @click="changeTab(0)">地图选址</view>
|
||||
<view class="tabItem" :class="{ 'active': tab == 1 }" @click="changeTab(1)">地区选择</view>
|
||||
</view>
|
||||
|
||||
<div class="tabItems" v-if="tab == 0">
|
||||
<div class="row">
|
||||
<div class="row_label">地址</div>
|
||||
<div class="row_con">
|
||||
<div class="choseAddress" @click="chooseAddress">
|
||||
<view class="tabItems" v-if="tab == 0">
|
||||
<view class="row">
|
||||
<view class="row_label">地址</view>
|
||||
<view class="row_con">
|
||||
<view class="choseAddress" @click="chooseAddress">
|
||||
<text v-if="showOrientation">请选择地址</text>
|
||||
<text v-if="!showOrientation" style="color: #000;">{{ orientation.region }} {{orientation.district}}</text>
|
||||
</div>
|
||||
</view>
|
||||
|
||||
<div class="currentAddress" v-if="showOrientation">
|
||||
<div class="currentAddress1">
|
||||
<div class="currentAddress1_left">当前定位:{{orientation.district}}</div>
|
||||
<div class="currentAddress1_right" @click="headerConfirmClick">使用</div>
|
||||
</div>
|
||||
<div class="currentAddress2">{{orientation.region}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row_label">门牌号</div>
|
||||
<div class="row_con noneborder">
|
||||
<view class="currentAddress" v-if="showOrientation">
|
||||
<view class="currentAddress1">
|
||||
<view class="currentAddress1_left">当前定位:{{orientation.district}}</view>
|
||||
<view class="currentAddress1_right" @click="headerConfirmClick">使用</view>
|
||||
</view>
|
||||
<view class="currentAddress2">{{orientation.region}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="row_label">门牌号</view>
|
||||
<view class="row_con noneborder">
|
||||
<u--input placeholder="例:6栋201室" clearable border="none" v-model="houseNumber"></u--input>
|
||||
<!-- <div class="tips">记得完善门牌号</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <view class="tips">记得完善门牌号</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<div class="tabItems" v-if="tab == 1">
|
||||
<view class="tabItems" v-if="tab == 1">
|
||||
<view>
|
||||
<picker-view indicator-style="height: 50px;" style="width: 100%; height: 400rpx;" :value="id"
|
||||
@change="bindChange">
|
||||
@ -65,27 +65,27 @@
|
||||
</picker-view>
|
||||
</view>
|
||||
|
||||
<div class="row">
|
||||
<div class="row_label"><span>*</span>详细地址</div>
|
||||
<div class="row_con">
|
||||
<view class="row">
|
||||
<view class="row_label"><span>*</span>详细地址</view>
|
||||
<view class="row_con">
|
||||
<u--input placeholder="小区、门牌号" clearable border="none" v-model="houseNumber"></u--input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<div class="line"></div>
|
||||
<div class="isdef" @click="headerSettingDefaultAddressClick">
|
||||
<div class="isdef_left">
|
||||
<div class="isdef_left1">设置默认地址</div>
|
||||
<div class="isdef_left2">提醒:下单时会优先选择</div>
|
||||
</div>
|
||||
<div class="isdef_right">
|
||||
<view class="line"></view>
|
||||
<view class="isdef" @click="headerSettingDefaultAddressClick">
|
||||
<view class="isdef_left">
|
||||
<view class="isdef_left1">设置默认地址</view>
|
||||
<view class="isdef_left2">提醒:下单时会优先选择</view>
|
||||
</view>
|
||||
<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 == 1" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png" alt="" />
|
||||
</div>
|
||||
</div>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<div class="btn" @click="headerSubmitClick">确定</div>
|
||||
<view class="btn" @click="headerSubmitClick">确定</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
@ -222,6 +222,7 @@ export default {
|
||||
})
|
||||
return
|
||||
}
|
||||
console.log("🚀 ~ headerSubmitClick ~ type:", this.type)
|
||||
if(this.type === 'edit') {
|
||||
const res = await request(apiArr2.updateAddress, "POST", {
|
||||
user_id: this.id,
|
||||
|
||||
@ -1,44 +1,44 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
|
||||
<div class="hasAddress">
|
||||
<div class="addressList">
|
||||
<div class="addressItem" v-for="item, index in list" :key="index" :class="{ 'addressItem_def': index == 0 }">
|
||||
<div class="addressItem_top">
|
||||
{{item.name}} {{item.phone}} <div v-if="item.is_default === 1" class="is_def">默认</div>
|
||||
</div>
|
||||
<div class="addressItem_mid">{{item.address}}{{ item.house_number }}</div>
|
||||
<div class="addressItem_footer">
|
||||
<div class="addressItem_footer_left">
|
||||
<div v-if="item.is_default !== 1" @click="headerSettingDefault(item.id)">
|
||||
<view class="hasAddress">
|
||||
<view class="addressList">
|
||||
<view class="addressItem" v-for="item, index in list" :key="index" :class="{ 'addressItem_def': index == 0 }">
|
||||
<view class="addressItem_top">
|
||||
{{item.name}} {{item.phone}} <view v-if="item.is_default === 1" class="is_def">默认</view>
|
||||
</view>
|
||||
<view class="addressItem_mid">{{item.address}}{{ item.house_number }}</view>
|
||||
<view class="addressItem_footer">
|
||||
<view class="addressItem_footer_left">
|
||||
<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>
|
||||
设为默认
|
||||
</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>
|
||||
已默认
|
||||
</div>
|
||||
</view>
|
||||
|
||||
</div>
|
||||
<div class="addressItem_footer_right">
|
||||
<div class="btn1" @click="deleteItem(item.id )">删除</div>
|
||||
<div class="btn2" @click="editItem(item)">修改</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="footerBtn" @click="addAddress">新增收货地址</div>
|
||||
</div>
|
||||
</div>
|
||||
</view>
|
||||
<view class="addressItem_footer_right">
|
||||
<view class="btn1" @click="deleteItem(item.id )">删除</view>
|
||||
<view class="btn2" @click="editItem(item)">修改</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="footer">
|
||||
<view class="footerBtn" @click="addAddress">新增收货地址</view>
|
||||
</view>
|
||||
</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>
|
||||
<div class="empty_text">暂无收货地址</div>
|
||||
<view class="empty_text">暂无收货地址</view>
|
||||
|
||||
<div class="addBtn" @click="addAddress">添加收货地址</div>
|
||||
</div>
|
||||
<view class="addBtn" @click="addAddress">添加收货地址</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
@ -104,7 +104,7 @@ export default {
|
||||
},
|
||||
|
||||
async init() {
|
||||
const res = await request(apiArr.addressList, 'POST', {});
|
||||
const res = await request(apiArr.addAddressList, 'POST', {});
|
||||
this.list = res.address_list;
|
||||
}
|
||||
},
|
||||
|
||||
@ -44,7 +44,10 @@
|
||||
</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="fenge"></view>
|
||||
@ -178,7 +181,8 @@
|
||||
|
||||
<view class="car_right" v-if="info.commodity_goods_info_list[currentGGIndex].cart_count.count > 0">
|
||||
<!-- <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"
|
||||
@change="changeCar" min="0">
|
||||
<!-- <u-number-box > -->
|
||||
<view slot="minus" class="minus">
|
||||
<u-icon name="minus" size="36" bold></u-icon>
|
||||
@ -186,7 +190,7 @@
|
||||
<text slot="input" style="width: 200rpx; text-align: center" class="input">
|
||||
{{ info.commodity_goods_info_list[currentGGIndex].cart_count.count }}
|
||||
</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]}}
|
||||
</text> -->
|
||||
<view slot="plus" class="plus">
|
||||
@ -282,9 +286,14 @@
|
||||
<view class="popup-header-view" @click="closeSize">取消</view>
|
||||
</view>
|
||||
<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_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>
|
||||
</view>
|
||||
|
||||
@ -10,7 +10,7 @@ m<template>
|
||||
<!-- 商品项 -->
|
||||
<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">
|
||||
<image :src="item.commodity_pic" mode="aspectFill"></image>
|
||||
</view>
|
||||
@ -46,9 +46,12 @@ m<template>
|
||||
</view>
|
||||
</view>
|
||||
<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="increase-btn" @tap.stop="increaseQuantity(index, 0)">+</view>
|
||||
<view class="increase-btn" @tap.stop="increaseQuantity(index, skuIndex)">+
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="original-price">单买价 ¥{{ sku.sales_price }}/{{ sku.goods_unit }}</view>
|
||||
@ -105,20 +108,23 @@ m<template>
|
||||
<script>
|
||||
import { picUrl, menuButtonInfo, request, NavgateTo } from "../../../utils";
|
||||
import { apiArr } from '@/api/groupPurchase.js'
|
||||
import { apiArr as shopApi } from "../../../api/shop.js";
|
||||
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
goodsList: [],
|
||||
carNum: 5,
|
||||
carNum: 0,
|
||||
quantity: 0,
|
||||
timer: null, // 定时器ID
|
||||
endTime: '', // 初始化结束时间
|
||||
updateTime: Date.now() // 用于触发倒计时更新的时间戳
|
||||
updateTime: Date.now(), // 用于触发倒计时更新的时间戳
|
||||
goodsDetail: []
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.getGoodsList()
|
||||
// this.getGoodsList()
|
||||
},
|
||||
onShow() {
|
||||
// 在页面显示时启动定时器
|
||||
@ -128,13 +134,23 @@ export default {
|
||||
this.updateTime = Date.now();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
// 确保getGoodsList和getShopdetail都执行完毕后再执行getGoodsNum
|
||||
Promise.all([
|
||||
// 确保getGoodsList已完成
|
||||
this.goodsList.length > 0 ? Promise.resolve() : this.getGoodsList(),
|
||||
// 调用getShopdetail并等待其完成
|
||||
this.getShopdetail()
|
||||
]).then(() => {
|
||||
this.getGoodsNum();//获取货品在购物车中的数量
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
getGoodsList() {
|
||||
const params = {
|
||||
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 => {
|
||||
// 为每个货品初始化quantity
|
||||
const group_buy_goods_list = item.group_buy_goods_list.map(sku => ({
|
||||
@ -149,9 +165,39 @@ export default {
|
||||
}
|
||||
})
|
||||
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) {
|
||||
NavgateTo(`/packages/shop/groupPurchaseDetail/index?item=${JSON.stringify(item)}`)
|
||||
},
|
||||
@ -171,22 +217,53 @@ export default {
|
||||
increaseQuantity(goodsIndex, skuIndex) {
|
||||
this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity++;
|
||||
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) {
|
||||
if (this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity > 0) {
|
||||
this.goodsList[goodsIndex].group_buy_goods_list[skuIndex].quantity--;
|
||||
this.carNum--;
|
||||
} else {
|
||||
|
||||
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 {
|
||||
uni.showToast({
|
||||
title: '已经没有了...',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
},
|
||||
// 请求更改购物车接口
|
||||
async updateCar(params) {
|
||||
return request(shopApi.updateCar, "POST", params).then((res) => {
|
||||
this.getShopdetail();
|
||||
uni.showToast({
|
||||
title: "操作成功!",
|
||||
success() { },
|
||||
});
|
||||
});
|
||||
},
|
||||
// 跳转到购物车
|
||||
shopCar() {
|
||||
// 跳转到购物车页面的逻辑
|
||||
uni.showToast({
|
||||
title: '跳转到购物车',
|
||||
icon: 'none'
|
||||
});
|
||||
NavgateTo("../shopCar/index");
|
||||
},
|
||||
// 计算距离结束日期的剩余时间
|
||||
getEndTheCountdown(endTime) {
|
||||
|
||||
@ -64,6 +64,7 @@ image {
|
||||
display: flex;
|
||||
background-image: url('https://wechat-img-file.oss-cn-beijing.aliyuncs.com/gp_detail_top.png');
|
||||
background-size: cover;
|
||||
background-position: -30rpx center;
|
||||
}
|
||||
|
||||
.section_2 {
|
||||
@ -77,14 +78,14 @@ image {
|
||||
|
||||
.text-wrapper_4 {
|
||||
position: relative;
|
||||
width: 221rpx;
|
||||
width: auto;
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.text_30 {
|
||||
width: 184rpx;
|
||||
width: auto;
|
||||
height: 80rpx;
|
||||
overflow-wrap: break-word;
|
||||
color: rgba(255, 255, 255, 1.000000);
|
||||
@ -145,8 +146,8 @@ image {
|
||||
height: 94rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
margin: 22rpx 39rpx 0 162rpx;
|
||||
align-items: center;
|
||||
margin: 22rpx 39rpx 0 230rpx;
|
||||
}
|
||||
|
||||
.text_34 {
|
||||
@ -160,16 +161,37 @@ image {
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
line-height: 28rpx;
|
||||
margin-left: 51rpx;
|
||||
}
|
||||
|
||||
.box_16 {
|
||||
position: relative;
|
||||
width: 225rpx;
|
||||
height: 39rpx;
|
||||
margin-top: 23rpx;
|
||||
flex-direction: row;
|
||||
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 {
|
||||
@ -194,7 +216,7 @@ image {
|
||||
font-size: 28rpx;
|
||||
font-family: Arial-Regular;
|
||||
font-weight: normal;
|
||||
text-align: left;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 28rpx;
|
||||
margin: 3rpx 0 0 42rpx;
|
||||
@ -208,7 +230,7 @@ image {
|
||||
font-size: 28rpx;
|
||||
font-family: Arial-Regular;
|
||||
font-weight: normal;
|
||||
text-align: left;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 28rpx;
|
||||
margin: 3rpx 0 0 33rpx;
|
||||
@ -232,7 +254,7 @@ image {
|
||||
font-size: 28rpx;
|
||||
font-family: Arial-Regular;
|
||||
font-weight: normal;
|
||||
text-align: left;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 28rpx;
|
||||
margin: 5rpx 0 0 4rpx;
|
||||
@ -258,7 +280,7 @@ image {
|
||||
font-size: 28rpx;
|
||||
font-family: Arial-Regular;
|
||||
font-weight: normal;
|
||||
text-align: left;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 28rpx;
|
||||
margin: 5rpx 0 0 4rpx;
|
||||
@ -284,7 +306,7 @@ image {
|
||||
font-size: 28rpx;
|
||||
font-family: Arial-Regular;
|
||||
font-weight: normal;
|
||||
text-align: left;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
line-height: 28rpx;
|
||||
margin: 5rpx 0 0 4rpx;
|
||||
@ -969,3 +991,34 @@ image {
|
||||
font-size: 28rpx;
|
||||
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;
|
||||
}
|
||||
@ -8,6 +8,9 @@
|
||||
</view>
|
||||
</view>
|
||||
<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-item v-for="(item, index) in currentGG.goods_carousel" :key="index">
|
||||
<image :src="picUrl + item"></image>
|
||||
@ -22,37 +25,51 @@
|
||||
<view class="box_15">
|
||||
<view class="section_2">
|
||||
<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_30">{{ currentGG.group_buy_price }}</text>
|
||||
<text lines="1" class="text_33">/{{ currentGG.goods_unit }}</text>
|
||||
</view>
|
||||
<text lines="1" decode="true" class="text_32">单买价 ¥300/箱</text>
|
||||
<text lines="1" decode="true" class="text_32">单买价 ¥{{ currentGG.sales_price }}/{{
|
||||
currentGG.goods_unit }}</text>
|
||||
</view>
|
||||
<text lines="1" class="text_33">/箱</text>
|
||||
<view class="section_3">
|
||||
<text lines="1" class="text_34">距结束还剩</text>
|
||||
<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_37">:</text>
|
||||
<view class="text-wrapper_5">
|
||||
<text lines="1" class="text_38">59</text>
|
||||
</view>
|
||||
<view class="text-wrapper_6">
|
||||
<text lines="1" class="text_39">24</text>
|
||||
<text lines="1" class="text_39">{{ endTheCountdownHour }}</text>
|
||||
</view>
|
||||
<view class="text-wrapper_7">
|
||||
<text lines="1" class="text_40">59</text>
|
||||
<text lines="1" class="text_40">{{ endTheCountdownMinute }}</text>
|
||||
</view>
|
||||
<view class="text-wrapper_5">
|
||||
<text lines="1" class="text_38">{{ endTheCountdownSecond }}</text>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="Money">
|
||||
<view class="MoneyMark">¥</view>
|
||||
{{ currentGG.sales_price }}
|
||||
{{ currentGG.group_buy_price }}
|
||||
<view class="MoneyUnit">/{{ currentGG.goods_unit }}</view>
|
||||
|
||||
<view class="oldMoney">¥{{ currentGG.market_price }}</view>
|
||||
</view>
|
||||
|
||||
<!-- 规格 -->
|
||||
@ -69,7 +86,12 @@
|
||||
</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="fenge"></view>
|
||||
@ -77,17 +99,17 @@
|
||||
<!-- 已购买区域 -->
|
||||
<view>
|
||||
<view class="purchase-area">
|
||||
<view class="purchase-count">6人已购买</view>
|
||||
<view class="purchase-count">{{ totalCount }}人已购买</view>
|
||||
<view class="view-more" @click="showPurchaseRecords">查看更多 ></view>
|
||||
</view>
|
||||
<view class="record-list">
|
||||
<view class="record-item" v-for="(record, index) in purchaseRecords" :key="index">
|
||||
<view class="record-user">
|
||||
<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 class="record-amount">
|
||||
7月17日买了一件
|
||||
{{ formatDate(record.buy_time) }}买了{{ record.count }}件
|
||||
</view>
|
||||
<view class="record-time">
|
||||
<button class="buy-btn" @click="goSubmit">去下单</button>
|
||||
@ -151,23 +173,22 @@
|
||||
</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="
|
||||
!info.commodity_goods_info_list[currentGGIndex].cart_count ||
|
||||
info.commodity_goods_info_list[currentGGIndex].cart_count.count == 0
|
||||
info.commodity_goods_info_list[currentGGIndex].total_stock > 0 &&
|
||||
(!info.commodity_goods_info_list[currentGGIndex].cart_count ||
|
||||
info.commodity_goods_info_list[currentGGIndex].cart_count.count == 0)
|
||||
" @click="addCar">
|
||||
加入购物车
|
||||
</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="
|
||||
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
|
||||
" @change="changeCar" min="0">
|
||||
@ -278,10 +299,10 @@
|
||||
<view class="record-item" v-for="(record, index) in purchaseRecords" :key="index">
|
||||
<view class="record-user">
|
||||
<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 class="record-amount">+{{ record.amount }}</view>
|
||||
<view class="record-time">{{ record.time }}</view>
|
||||
<view class="record-amount">+{{ record.count }}</view>
|
||||
<view class="record-time">{{ record.buy_time }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -311,6 +332,7 @@
|
||||
|
||||
<script>
|
||||
import { apiArr } from "../../../api/shop";
|
||||
import { apiArr as apiArr2 } from "../../../api/groupPurchase";
|
||||
import { picUrl, menuButtonInfo, request, NavgateTo } from "../../../utils";
|
||||
export default {
|
||||
data() {
|
||||
@ -334,68 +356,59 @@ export default {
|
||||
carOrderList: [],
|
||||
// 新增评论数据
|
||||
showReviewPopup: false,
|
||||
comments: [
|
||||
{
|
||||
avatar: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
|
||||
username: "TP",
|
||||
product: "库尔勒香梨 10kg/箱",
|
||||
content:
|
||||
"踏入这家位于街角的餐厅,木质门框与暖黄灯光交织出温馨氛围,墙面上手绘的食材插画画透着文艺气息,开放式厨房的设计让食客能看见厨师处理食材的全过程,第一印象便给人以干净与安心。",
|
||||
images: ["https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png"],
|
||||
time: "2025-03-01 11:24:20",
|
||||
},
|
||||
{
|
||||
avatar: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
|
||||
username: "TP",
|
||||
product: "库尔勒香梨 10kg/箱",
|
||||
content:
|
||||
"踏入这家位于街角的餐厅,木质门框与暖黄灯光交织出温馨氛围,墙面上手绘的食材插_draw着文艺气息,开放式厨房的设计让食客能看见厨师处理食材的全过程,第一印象便给人以干净与安心。",
|
||||
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",
|
||||
],
|
||||
time: "2025-03-01 11:24:20",
|
||||
},
|
||||
],
|
||||
// comments: [
|
||||
// {
|
||||
// avatar: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
|
||||
// username: "TP",
|
||||
// product: "库尔勒香梨 10kg/箱",
|
||||
// content:
|
||||
// "踏入这家位于街角的餐厅,木质门框与暖黄灯光交织出温馨氛围,墙面上手绘的食材插画画透着文艺气息,开放式厨房的设计让食客能看见厨师处理食材的全过程,第一印象便给人以干净与安心。",
|
||||
// images: ["https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png"],
|
||||
// time: "2025-03-01 11:24:20",
|
||||
// },
|
||||
// {
|
||||
// avatar: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/test.png",
|
||||
// username: "TP",
|
||||
// product: "库尔勒香梨 10kg/箱",
|
||||
// content:
|
||||
// "踏入这家位于街角的餐厅,木质门框与暖黄灯光交织出温馨氛围,墙面上手绘的食材插_draw着文艺气息,开放式厨房的设计让食客能看见厨师处理食材的全过程,第一印象便给人以干净与安心。",
|
||||
// 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",
|
||||
// ],
|
||||
// time: "2025-03-01 11:24:20",
|
||||
// },
|
||||
// ],
|
||||
show: false,
|
||||
showSize: false,
|
||||
showPurchase: false,
|
||||
purchaseRecords: [
|
||||
{
|
||||
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"
|
||||
}
|
||||
],
|
||||
purchaseRecords: [],
|
||||
totalCount: 0,
|
||||
changeImg: "",
|
||||
changeName: "",
|
||||
changePrice: "",
|
||||
|
||||
endTime: "",
|
||||
endTheCountdownDay: '',
|
||||
endTheCountdownHour: '',
|
||||
endTheCountdownMinute: '',
|
||||
endTheCountdownSecond: '',
|
||||
timer: null, // 定时器ID
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
// 显示团购记录
|
||||
showPurchaseRecords() {
|
||||
if (this.purchaseRecords.length > 0) {
|
||||
this.showPurchase = true;
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '没有更多数据',
|
||||
icon: 'none'
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
// 关闭团购记录
|
||||
@ -491,8 +504,6 @@ export default {
|
||||
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(",");
|
||||
@ -501,6 +512,7 @@ export default {
|
||||
});
|
||||
|
||||
//根据购物车列表 和 当前商品列表 来更新当前商品列表在购物车中的数量
|
||||
console.log("🚀 ~ getGoodsInfo ~ this.carOrderList:", this.carOrderList)
|
||||
if (this.carOrderList) {
|
||||
this.carOrderList.forEach((items) => {
|
||||
res.commodity_goods_info_list.forEach((item) => {
|
||||
@ -536,7 +548,6 @@ export default {
|
||||
|
||||
// 切换规格
|
||||
changeGG(item, index) {
|
||||
console.log("🚀 ~ changeGG ~ item:", item);
|
||||
this.currentGG = item;
|
||||
this.currentGGIndex = index;
|
||||
if (this.currentGG.cart_count) {
|
||||
@ -561,8 +572,11 @@ export default {
|
||||
},
|
||||
|
||||
getShopCarList() {
|
||||
request(apiArr.getCar, "POST", {}).then((res) => {
|
||||
this.carOrderList = res.commodity_cart_list;
|
||||
return request(apiArr.getCar, "POST", {}).then((res) => {
|
||||
// 合并当日达和普通商品数据
|
||||
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) {
|
||||
// // 修改当前商品在购物车中的数量
|
||||
// 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"),
|
||||
@ -625,6 +625,7 @@ export default {
|
||||
title: "操作成功!",
|
||||
success() { },
|
||||
});
|
||||
this.getShopCar();
|
||||
});
|
||||
},
|
||||
|
||||
@ -643,25 +644,88 @@ export default {
|
||||
closeSize() {
|
||||
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) {
|
||||
const itemObj = JSON.parse(decodeURIComponent(options.item));
|
||||
console.log("🚀 ~ onLoad ~ itemObj:", itemObj)
|
||||
const meun = menuButtonInfo();
|
||||
this.top = meun.top;
|
||||
this.localHeight = meun.height;
|
||||
|
||||
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() { },
|
||||
onShow() {
|
||||
this.getShopCarList();
|
||||
// 确保getShopCarList完成后再执行getGoodsInfo
|
||||
this.getShopCarList().then(() => {
|
||||
this.getGoodsInfo();
|
||||
});
|
||||
this.getShopCar();
|
||||
},
|
||||
|
||||
//离开页面的时候直接更新购物车数量(目前接口是 传入商品id 数量。如果有当前商品就更新数量。如果没有就增加商品。如果删除某个商品 count 为0 就删除)
|
||||
onHide() {
|
||||
// 清除定时器
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer)
|
||||
this.timer = null
|
||||
}
|
||||
|
||||
let goods_id_and_count = [];
|
||||
this.info.commodity_goods_info_list.forEach((item) => {
|
||||
goods_id_and_count.push({
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
page {
|
||||
background-color: #f5f7fb;
|
||||
|
||||
}
|
||||
|
||||
.container {
|
||||
@ -93,6 +92,8 @@ page {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
line-height: 40rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.address-arrow {
|
||||
@ -163,6 +164,10 @@ page {
|
||||
color: #e63946;
|
||||
margin-right: 10rpx;
|
||||
border-radius: 4rpx;
|
||||
/* display: flex; */
|
||||
}
|
||||
|
||||
.group-price-box {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
@ -262,6 +267,15 @@ page {
|
||||
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 {
|
||||
background-color: #fff;
|
||||
@ -316,10 +330,11 @@ page {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
border-radius: 50rpx;
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
bottom: 50rpx;
|
||||
left: 15%;
|
||||
width: 70%;
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
/* 自提样式 */
|
||||
@ -474,3 +489,12 @@ page {
|
||||
justify-content: center;
|
||||
margin-top: 60rpx;
|
||||
}
|
||||
|
||||
.empty-tip{
|
||||
height: 200rpx;
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
text-align: center;
|
||||
line-height: 200rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
@ -5,34 +5,23 @@
|
||||
<view :class="{ active: activeTab === 'delivery' }" class="tab-item" @click="switchTab('delivery')">配送
|
||||
</view>
|
||||
<view :class="{ active: activeTab === 'pickup' }" class="tab-item" @click="switchTab('pickup')">自提</view>
|
||||
|
||||
</view>
|
||||
<!-- 分隔线 -->
|
||||
<view class="divider"></view>
|
||||
<!-- 配送/自提信息 -->
|
||||
<view class="info-section">
|
||||
<view v-if="activeTab === 'delivery'" class="address-section">
|
||||
<view class="info-section" v-if="activeTab === 'delivery'">
|
||||
<view class="address-section">
|
||||
<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-name-phone">
|
||||
<text class="name">李佳</text>
|
||||
<text class="phone">15901518415</text>
|
||||
<text class="name">{{ defAddress.name }}</text>
|
||||
<text class="phone">{{ defAddress.phone }}</text>
|
||||
</view>
|
||||
<view class="address-detail">北京北京市朝阳区珠江绿洲文化广场</view>
|
||||
<view class="address-detail">
|
||||
{{ defAddress.address }}{{ defAddress.house_number }}
|
||||
<view class="copy-icon" @click.stop="copyAddress" />
|
||||
</view>
|
||||
<view class="address-arrow"><u-icon name="arrow-right" size="25"></u-icon></view>
|
||||
</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 class="address-detail">北京北京市朝阳区珠江绿洲文化广场</view>
|
||||
</view>
|
||||
<view class="address-arrow"><u-icon name="arrow-right" size="25"></u-icon></view>
|
||||
</view>
|
||||
@ -41,41 +30,49 @@
|
||||
<!-- 分隔线 -->
|
||||
<view class="divider"></view>
|
||||
<!-- 商品信息 -->
|
||||
<view class="goods-item">
|
||||
<view v-if="activeTab === 'delivery' && orderList1.length > 0">
|
||||
<view class="goods-list">
|
||||
<view class="goods-item" v-for="(item, index) in orderList1" :key="index">
|
||||
<view class="goods-image">
|
||||
<image src="/static/logo.png" mode="aspectFill"></image>
|
||||
<image :src="item.commodity_goods_info.commodity_pic" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="goods-info">
|
||||
<view class="goods-name">泰国金枕榴莲泰国金枕榴莲</view>
|
||||
<view class="goods-desc"> 心形榴莲 软糯香甜</view>
|
||||
<view class="goods-name">{{ item.commodity_goods_info.goods_name }}</view>
|
||||
<view class="goods-desc">{{ item.commodity_goods_info.goods_spec }}</view>
|
||||
<view class="price-container">
|
||||
<view class="group-price">
|
||||
<view class="group-price1">团购价</view>
|
||||
<view class="group-price2">¥125.9</view>
|
||||
<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(index)">-</view>
|
||||
<view class="quantity">{{ quantity }}</view>
|
||||
<view class="increase-btn" @tap.stop="increaseQuantity(index)">+</view>
|
||||
<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-section">
|
||||
<view class="fee-name">运费</view>
|
||||
<view class="fee-value">¥10</view>
|
||||
</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">¥200</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"
|
||||
<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">
|
||||
@ -95,8 +92,128 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="activeTab === 'delivery' && orderList1.length == 0" class="empty-tip">
|
||||
暂无商品数据
|
||||
</view>
|
||||
<view v-if="activeTab === 'pickup' && orderList2.length > 0">
|
||||
<view class="goods-list" v-for="(item, index) in orderList2" :key="index">
|
||||
<view class="info-section">
|
||||
<view class="address-section">
|
||||
<view class="section-title">自提点</view>
|
||||
<view @click="editAddress(item)">
|
||||
<view v-if="defZTAddress.length > 0">
|
||||
<view v-for="(adItem, adIndex) in defZTAddress" :key="adIndex">
|
||||
<view class="address-info" v-if="adItem.id === item.goods_id">
|
||||
<view class="address-main">
|
||||
<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 class="goods-item">
|
||||
<view class="goods-image">
|
||||
<image :src="item.commodity_goods_info.commodity_pic" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="goods-info">
|
||||
<view class="goods-name">{{ item.commodity_goods_info.goods_name }}</view>
|
||||
<view class="goods-desc">{{ item.commodity_goods_info.goods_spec }}</view>
|
||||
<view class="price-container">
|
||||
<view class="group-price">
|
||||
<view>
|
||||
<view v-if="isWithinActivityTime(item)" class="group-price-box">
|
||||
<view class="group-price1">团购价</view>
|
||||
<view class="group-price2">
|
||||
{{ '¥' + 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 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 class="pay-button" @click="submitPayment">立即支付 ¥4500.00</view>
|
||||
<view class="pay-button" @click="submitPayment">立即支付</view>
|
||||
|
||||
<!-- 弹窗 - 支付成功 -->
|
||||
<view class="shadow" @click="changeShadow" v-if="boxshadow1">
|
||||
@ -173,6 +290,8 @@
|
||||
</template>
|
||||
<script>
|
||||
import { picUrl, menuButtonInfo, request, NavgateTo } from "../../../utils";
|
||||
import { apiArr } from "../../../api/shop";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -181,35 +300,171 @@ export default {
|
||||
selectedPayment: 'wechat',
|
||||
boxshadow1: 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: {
|
||||
switchTab(tab) {
|
||||
this.activeTab = tab;
|
||||
},
|
||||
editAddress() {
|
||||
if (this.activeTab === 'delivery') {
|
||||
NavgateTo('../addAddress/index');
|
||||
//用户收货地址
|
||||
getUserAddress() {
|
||||
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 {
|
||||
NavgateTo('../ztLocation/index');
|
||||
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)
|
||||
}
|
||||
},
|
||||
decreaseQuantity() {
|
||||
if (this.quantity > 1) {
|
||||
this.quantity--;
|
||||
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 {
|
||||
uni.showToast({
|
||||
title: '库存不足',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
},
|
||||
increaseQuantity() {
|
||||
this.quantity++;
|
||||
// 更改购物车
|
||||
changeCart(item) {
|
||||
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() { },
|
||||
});
|
||||
})
|
||||
},
|
||||
|
||||
// 计算总金额
|
||||
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) {
|
||||
console.log("🚀 ~ selectPayment ~ payment:", payment)
|
||||
this.selectedPayment = payment;
|
||||
},
|
||||
submitPayment() {
|
||||
console.log('提交支付,金额:¥4500.00');
|
||||
this.boxshadow1 = true;
|
||||
},
|
||||
// 复制收货地址
|
||||
copyAddress() {
|
||||
// 使用uni-app的复制API
|
||||
uni.setClipboardData({
|
||||
data: this.defAddress.address + this.defAddress.house_number,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: '复制成功',
|
||||
icon: 'success'
|
||||
});
|
||||
},
|
||||
fail: () => {
|
||||
uni.showToast({
|
||||
title: '复制失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
copyZTAddress() {
|
||||
// 使用uni-app的复制API
|
||||
uni.setClipboardData({
|
||||
data: this.defZTAddress.address,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: '复制成功',
|
||||
icon: 'success'
|
||||
});
|
||||
},
|
||||
fail: () => {
|
||||
uni.showToast({
|
||||
title: '复制失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
openSave() {
|
||||
this.boxshadow1 = false;
|
||||
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>
|
||||
|
||||
@ -3,34 +3,21 @@
|
||||
<!-- 顶部展开后的阴影 -->
|
||||
<view class="boxshadow" v-if="topShow"></view>
|
||||
<view class="header" :class="topShow ? 'op0' : ''">
|
||||
<view
|
||||
class="searchBox"
|
||||
:style="{ height: localHeight + 'px', paddingTop: top + 'px' }"
|
||||
>
|
||||
<view class="searchBox" :style="{ height: localHeight + 'px', paddingTop: top + 'px' }">
|
||||
<view class="searchBox_left" @click="back">
|
||||
<u-icon name="arrow-left" size="20px" color="#000"></u-icon>
|
||||
</view>
|
||||
<view class="searchBox_ipt" @click="searchPage">
|
||||
<image
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_communitySearchIcon.png"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_communitySearchIcon.png"
|
||||
mode="aspectFill"></image>
|
||||
<input disabled type="text" placeholder="输入商品名称" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="slide">
|
||||
<view class="slide_con">
|
||||
<view
|
||||
v-for="(item, index) in CateList"
|
||||
:key="index"
|
||||
class="slide_conBox"
|
||||
@click="changeCate(item.id)"
|
||||
>
|
||||
<view v-for="(item, index) in CateList" :key="index" class="slide_conBox" @click="changeCate(item.id)">
|
||||
<view class="slide_item">
|
||||
<image
|
||||
:src="picUrl + item.category_pic"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<image :src="picUrl + item.category_pic" mode="aspectFill"></image>
|
||||
<text>{{ item.category_name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
@ -38,44 +25,30 @@
|
||||
|
||||
<view class="open" @click="topOpen" v-if="!topShow">
|
||||
展 开
|
||||
<image
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_openIcon.png"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_openIcon.png"
|
||||
mode="aspectFill"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 整体展开的顶部 -->
|
||||
<view class="header header2" v-if="topShow">
|
||||
<view
|
||||
class="searchBox"
|
||||
:style="{ height: localHeight + 'px', paddingTop: top + 'px' }"
|
||||
>
|
||||
<view class="searchBox" :style="{ height: localHeight + 'px', paddingTop: top + 'px' }">
|
||||
<view class="searchBox_left">
|
||||
<u-icon name="arrow-left" size="20px" color="#000"></u-icon>
|
||||
</view>
|
||||
<view class="searchBox_ipt">
|
||||
<image
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_communitySearchIcon.png"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_communitySearchIcon.png"
|
||||
mode="aspectFill"></image>
|
||||
<input type="text" placeholder="输入商品名称" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="slide">
|
||||
<view class="slide_con">
|
||||
<view
|
||||
v-for="(item, index) in CateList"
|
||||
:key="index"
|
||||
class="slide_conBox"
|
||||
>
|
||||
<view v-for="(item, index) in CateList" :key="index" class="slide_conBox">
|
||||
<view class="slide_item">
|
||||
<image
|
||||
:src="picUrl + item.category_pic"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<image :src="picUrl + item.category_pic" mode="aspectFill"></image>
|
||||
<text>{{ item.category_name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
@ -89,13 +62,8 @@
|
||||
|
||||
<view class="Con">
|
||||
<view class="Con_left">
|
||||
<view
|
||||
class="CateItem"
|
||||
:class="item.id === currentLeftCateId ? 'CateItem_active' : ''"
|
||||
v-for="item in leftCateList"
|
||||
:key="item.id"
|
||||
@click="changeLeftCate(item.id)"
|
||||
>
|
||||
<view class="CateItem" :class="item.id === currentLeftCateId ? 'CateItem_active' : ''"
|
||||
v-for="item in leftCateList" :key="item.id" @click="changeLeftCate(item.id)">
|
||||
<!-- <image v-if="false" class="hot"
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_hot.png"
|
||||
mode="aspectFill">
|
||||
@ -109,13 +77,8 @@
|
||||
<view class="Con_right">
|
||||
<view class="CateList_Box" :class="cateListShow ? 'bgf' : ''">
|
||||
<view class="CateList" ref="cateListRef">
|
||||
<view
|
||||
class="CateList_Item"
|
||||
v-for="(item, index) in tagList"
|
||||
:key="item.id"
|
||||
:class="index == rightTopActive ? 'CateList_Item_active' : ''"
|
||||
@click="checkItem(index)"
|
||||
>
|
||||
<view class="CateList_Item" v-for="(item, index) in tagList" :key="item.id"
|
||||
:class="index == rightTopActive ? 'CateList_Item_active' : ''" @click="checkItem(index)">
|
||||
{{ item.tag_name }}
|
||||
</view>
|
||||
</view>
|
||||
@ -126,13 +89,8 @@
|
||||
</view>
|
||||
<!-- 右下展开的内容 -->
|
||||
<view class="activeCateList" v-if="cateListShow">
|
||||
<view
|
||||
class="CateList_Item"
|
||||
v-for="(item, index) in tagList"
|
||||
:key="index"
|
||||
:class="index == rightTopActive ? 'CateList_Item_active' : ''"
|
||||
@click="checkItem(index)"
|
||||
>
|
||||
<view class="CateList_Item" v-for="(item, index) in tagList" :key="index"
|
||||
:class="index == rightTopActive ? 'CateList_Item_active' : ''" @click="checkItem(index)">
|
||||
{{ item.tag_name }}
|
||||
</view>
|
||||
</view>
|
||||
@ -143,36 +101,21 @@
|
||||
<view class="CateInfo_tit">
|
||||
{{ item.tag_name }}
|
||||
</view>
|
||||
<view
|
||||
class="CateInfo_Item"
|
||||
v-for="items in item.commodity_info_list"
|
||||
:key="items.id"
|
||||
>
|
||||
<view class="CateInfo_Item" v-for="items in item.commodity_info_list" :key="items.id">
|
||||
<view class="CateInfo_Item_Box">
|
||||
<view class="CateInfo_Item_left" @click="goods(items)">
|
||||
<view
|
||||
class="tag tag-img"
|
||||
v-if="
|
||||
<view class="tag tag-img" v-if="
|
||||
!items.commodity_goods_info_list[1] &&
|
||||
items.commodity_goods_info_list[0].is_same_day
|
||||
"
|
||||
>当日达</view
|
||||
>
|
||||
<image
|
||||
:src="picUrl + items.commodity_pic"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
">当日达</view>
|
||||
<image :src="picUrl + items.commodity_pic" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="CateInfo_Item_right" :class="GGshow ? 'noneBor' : ''">
|
||||
<view class="CateInfo_Item_right_Tit" @click="goods(items)">
|
||||
<view
|
||||
class="tag tag-text"
|
||||
v-if="
|
||||
<view class="tag tag-text" v-if="
|
||||
!items.commodity_goods_info_list[1] &&
|
||||
items.commodity_goods_info_list[0].is_same_day
|
||||
"
|
||||
>当日达</view
|
||||
>
|
||||
">当日达</view>
|
||||
{{ items.commodity_name }}
|
||||
</view>
|
||||
<view class="CateInfo_Item_right_subtit" @click="goods(items)">
|
||||
@ -182,28 +125,17 @@
|
||||
<view class="CateInfo_Item_Money_left">
|
||||
{{ getPriceRange(items.commodity_goods_info_list) }}
|
||||
</view>
|
||||
<view
|
||||
class="CateInfo_Item_Money_right"
|
||||
v-if="!(items.commodity_goods_info_list.length > 1)"
|
||||
>
|
||||
<u-number-box
|
||||
:min="0"
|
||||
v-model="items.commodity_goods_info_list[0].quantity"
|
||||
@change="(value) => handleQuantityChange(value, items)"
|
||||
>
|
||||
<view class="CateInfo_Item_Money_right" v-if="!(items.commodity_goods_info_list.length > 1)">
|
||||
<u-number-box :min="0" v-model="items.commodity_goods_info_list[0].quantity"
|
||||
@change="(value) => handleQuantityChange(value, items)">
|
||||
<view slot="minus" class="minus">
|
||||
<u-icon name="minus" size="20"></u-icon>
|
||||
</view>
|
||||
<text
|
||||
slot="input"
|
||||
style="width: 50px; text-align: center"
|
||||
class="input"
|
||||
>{{
|
||||
<text slot="input" style="width: 50px; text-align: center" class="input">{{
|
||||
items.commodity_goods_info_list[0].quantity
|
||||
? items.commodity_goods_info_list[0].quantity
|
||||
: 0
|
||||
}}</text
|
||||
>
|
||||
}}</text>
|
||||
<view slot="plus" class="plus">
|
||||
<u-icon name="plus" color="#FFFFFF" size="20"></u-icon>
|
||||
</view>
|
||||
@ -211,28 +143,16 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="gg"
|
||||
@click="chooseGG(items)"
|
||||
v-if="
|
||||
<view class="gg" @click="chooseGG(items)" v-if="
|
||||
items.commodity_goods_info_list.length > 1 && !items.isShow
|
||||
"
|
||||
>
|
||||
">
|
||||
选择规格
|
||||
<u-icon
|
||||
name="arrow-down"
|
||||
size="26rpx"
|
||||
color="#FF370B"
|
||||
></u-icon>
|
||||
<u-icon name="arrow-down" size="26rpx" color="#FF370B"></u-icon>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="gg"
|
||||
@click="chooseGG(items)"
|
||||
v-if="
|
||||
<view class="gg" @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>
|
||||
</view>
|
||||
@ -240,24 +160,14 @@
|
||||
</view>
|
||||
|
||||
<view class="GGList" v-if="items.isShow">
|
||||
<view
|
||||
class="GGItem"
|
||||
v-for="ite in items.commodity_goods_info_list"
|
||||
:key="ite.id"
|
||||
@click="goods(items)"
|
||||
>
|
||||
<view class="GGItem" v-for="ite in items.commodity_goods_info_list" :key="ite.id" @click="goods(items)">
|
||||
<view class="GGItem_Image">
|
||||
<view class="tag tag-img" v-if="ite.is_same_day">当日达</view>
|
||||
<image
|
||||
:src="picUrl + ite.commodity_pic"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<image :src="picUrl + ite.commodity_pic" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="GGItem_Con">
|
||||
<view class="GGItem_Con_Tit">
|
||||
<view class="tag tag-text" v-if="ite.is_same_day"
|
||||
>当日达</view
|
||||
>
|
||||
<view class="tag tag-text" v-if="ite.is_same_day">当日达</view>
|
||||
{{ ite.goods_name }}
|
||||
</view>
|
||||
<view class="GGItem_Con_Msg">
|
||||
@ -265,26 +175,15 @@
|
||||
<span>¥</span>{{ ite.sales_price }}
|
||||
</view>
|
||||
<view class="GGItem_Con_Msg_right">
|
||||
<u-number-box
|
||||
v-model="ite.quantity"
|
||||
:min="0"
|
||||
@change="(value) => handleQuantityChange(value, ite)"
|
||||
>
|
||||
<u-number-box v-model="ite.quantity" :min="0"
|
||||
@change="(value) => handleQuantityChange(value, ite)">
|
||||
<view slot="minus" class="minus">
|
||||
<u-icon name="minus" size="20"></u-icon>
|
||||
</view>
|
||||
<text
|
||||
slot="input"
|
||||
style="width: 50px; text-align: center"
|
||||
class="input"
|
||||
>{{ ite.quantity ? ite.quantity : 0 }}</text
|
||||
>
|
||||
<text slot="input" style="width: 50px; text-align: center" class="input">{{ ite.quantity ?
|
||||
ite.quantity : 0 }}</text>
|
||||
<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>
|
||||
</u-number-box>
|
||||
</view>
|
||||
@ -308,15 +207,8 @@
|
||||
<!-- <nav-footer :current="3" /> -->
|
||||
|
||||
<view class="shop_car" @click="shopCar">
|
||||
<u-badge
|
||||
numberType="limit"
|
||||
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>
|
||||
<u-badge numberType="limit" 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> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -1,23 +1,23 @@
|
||||
<template>
|
||||
<view>
|
||||
<div class="header">
|
||||
<div class="searchBox" :style="{ height: localHeight + 'px', paddingTop: top + 'px' }">
|
||||
<div class="searchBox_left" @click="back">
|
||||
<view class="header">
|
||||
<view class="searchBox" :style="{ height: localHeight + 'px', paddingTop: top + 'px' }">
|
||||
<view class="searchBox_left" @click="back">
|
||||
<u-icon name="arrow-left" size="20px" color="#000"></u-icon>
|
||||
</div>
|
||||
<div class="searchBox_mid">购物车({{ shopCarTotal }})</div>
|
||||
<div class="searchBox_right">
|
||||
</view>
|
||||
<view class="searchBox_mid">购物车({{ shopCarTotal }})</view>
|
||||
<view class="searchBox_right">
|
||||
<u-icon name="arrow-left" size="20px" color="#000"></u-icon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<div class="main">
|
||||
<div class="deleteIcon" @click="deleteItem">
|
||||
<view class="main">
|
||||
<view class="deleteIcon" @click="deleteItem">
|
||||
<u-icon name="trash" size="50rpx"></u-icon>
|
||||
</div>
|
||||
<div class="is_day " v-if="isDayshow">
|
||||
<div class="footer_all" @click="is_day_checked"
|
||||
</view>
|
||||
<view class="is_day " v-if="isDayshow">
|
||||
<view class="footer_all" @click="is_day_checked"
|
||||
style="color: orange; font-size: 35rpx; font-weight: bolder;">
|
||||
<image v-if="!isDaychecked"
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png">
|
||||
@ -26,38 +26,38 @@
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png">
|
||||
</image>
|
||||
当日达
|
||||
</div>
|
||||
<div class="goodsList">
|
||||
<div class="goodsItem" v-for="(item, index) in isDayCarList" :key="item.id">
|
||||
</view>
|
||||
<view class="goodsList">
|
||||
<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"
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png">
|
||||
</image>
|
||||
<image v-if="item.checked"
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png">
|
||||
</image>
|
||||
</div>
|
||||
<div class="goodsItem_right">
|
||||
<div class="goodsItem_msg">
|
||||
<div class="goodsItem_msg_img">
|
||||
</view>
|
||||
<view class="goodsItem_right">
|
||||
<view class="goodsItem_msg">
|
||||
<view class="goodsItem_msg_img">
|
||||
<view class="tag tag-img">当日达</view>
|
||||
<image :src="picUrl + item.commodity_goods_info.commodity_pic">
|
||||
</image>
|
||||
</div>
|
||||
<div class="goodsItem_msg_right">
|
||||
<div class="goodsItem_msg_right_tit">
|
||||
</view>
|
||||
<view class="goodsItem_msg_right">
|
||||
<view class="goodsItem_msg_right_tit">
|
||||
{{ item.commodity_goods_info.goods_name }}
|
||||
</div>
|
||||
<div class="goodsItem_msg_right_subTit">
|
||||
</view>
|
||||
<view class="goodsItem_msg_right_subTit">
|
||||
{{ item.commodity_goods_info.goods_intro }}
|
||||
</div>
|
||||
<div class="goodsItem_msg_right_msg">
|
||||
<div class="goodsItem_msg_right_msg_left">
|
||||
</view>
|
||||
<view class="goodsItem_msg_right_msg">
|
||||
<view class="goodsItem_msg_right_msg_left">
|
||||
<span>¥</span>{{ item.commodity_goods_info.sales_price }}
|
||||
<span>/{{ item.commodity_goods_info.goods_unit }}</span>
|
||||
</div>
|
||||
<div class="goodsItem_msg_right_msg_right">
|
||||
</view>
|
||||
<view class="goodsItem_msg_right_msg_right">
|
||||
<u-number-box v-model="item.count" :asyncChange="true" min="0">
|
||||
<view slot="minus" class="minus" @click="minus(item, index)">
|
||||
<u-icon name="minus" size="32" bold></u-icon>
|
||||
@ -68,18 +68,18 @@
|
||||
<u-icon name="plus" color="#FFFFFF" size="32" bold></u-icon>
|
||||
</view>
|
||||
</u-number-box>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<div class="is_day" v-if="parcelPostshow" style="margin-top: 20rpx;">
|
||||
<div class="footer_all" @click="parcel_post_checked"
|
||||
<view class="is_day" v-if="parcelPostshow" style="margin-top: 20rpx;">
|
||||
<view class="footer_all" @click="parcel_post_checked"
|
||||
style="color: orange; font-size: 35rpx; font-weight: bolder;">
|
||||
<image v-if="!isParcelPostchecked"
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png">
|
||||
@ -88,38 +88,38 @@
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png">
|
||||
</image>
|
||||
包邮
|
||||
</div>
|
||||
<div class="goodsList">
|
||||
<div class="goodsItem" v-for="(item, index) in shopCarList" :key="item.id">
|
||||
</view>
|
||||
<view class="goodsList">
|
||||
<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"
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png">
|
||||
</image>
|
||||
<image v-if="item.checked"
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png">
|
||||
</image>
|
||||
</div>
|
||||
<div class="goodsItem_right">
|
||||
<div class="goodsItem_msg">
|
||||
<div class="goodsItem_msg_img">
|
||||
</view>
|
||||
<view class="goodsItem_right">
|
||||
<view class="goodsItem_msg">
|
||||
<view class="goodsItem_msg_img">
|
||||
|
||||
<image :src="picUrl + item.commodity_goods_info.commodity_pic">
|
||||
</image>
|
||||
</div>
|
||||
<div class="goodsItem_msg_right">
|
||||
<div class="goodsItem_msg_right_tit">
|
||||
</view>
|
||||
<view class="goodsItem_msg_right">
|
||||
<view class="goodsItem_msg_right_tit">
|
||||
{{ item.commodity_goods_info.goods_name }}
|
||||
</div>
|
||||
<div class="goodsItem_msg_right_subTit">
|
||||
</view>
|
||||
<view class="goodsItem_msg_right_subTit">
|
||||
{{ item.commodity_goods_info.goods_intro }}
|
||||
</div>
|
||||
<div class="goodsItem_msg_right_msg">
|
||||
<div class="goodsItem_msg_right_msg_left">
|
||||
</view>
|
||||
<view class="goodsItem_msg_right_msg">
|
||||
<view class="goodsItem_msg_right_msg_left">
|
||||
<span>¥</span>{{ item.commodity_goods_info.sales_price }}
|
||||
<span>/{{ item.commodity_goods_info.goods_unit }}</span>
|
||||
</div>
|
||||
<div class="goodsItem_msg_right_msg_right">
|
||||
</view>
|
||||
<view class="goodsItem_msg_right_msg_right">
|
||||
<u-number-box v-model="item.count" :asyncChange="true" min="0">
|
||||
<view slot="minus" class="minus" @click="minus(item, index)">
|
||||
<u-icon name="minus" size="32" bold></u-icon>
|
||||
@ -130,23 +130,23 @@
|
||||
<u-icon name="plus" color="#FFFFFF" size="32" bold></u-icon>
|
||||
</view>
|
||||
</u-number-box>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="footer">
|
||||
<div class="footer_left">
|
||||
<div class="footer_all" @click="allChecked">
|
||||
<view class="footer">
|
||||
<view class="footer_left">
|
||||
<view class="footer_all" @click="allChecked">
|
||||
<image v-if="!isAllchecked"
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png">
|
||||
</image>
|
||||
@ -154,23 +154,23 @@
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check2.png">
|
||||
</image>
|
||||
全选
|
||||
</div>
|
||||
<div class="footer_total">
|
||||
</view>
|
||||
<view class="footer_total">
|
||||
<span>合计</span>
|
||||
¥{{ shopMoney }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer_right" @click="submitOrder">结算</div>
|
||||
</div>
|
||||
</div>
|
||||
</view>
|
||||
</view>
|
||||
<view class="footer_right" @click="submitOrder">结算</view>
|
||||
</view>
|
||||
</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>
|
||||
<div>
|
||||
<view>
|
||||
啥也没有 <br />
|
||||
赶紧去shopping吧~
|
||||
</div>
|
||||
</div>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -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)}`);
|
||||
},
|
||||
|
||||
// 获取购物车列表
|
||||
|
||||
@ -1,45 +1,44 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<div class="address">
|
||||
<div class="border">
|
||||
<view class="address">
|
||||
<view class="border">
|
||||
<image src="http://192.168.0.172:5500/7.15/shop_border.png" mode="widthFix"></image>
|
||||
</div>
|
||||
<div class="address_Info" @click="choseAddress" v-if="defAddress">
|
||||
<div class="address_Info_left">
|
||||
<div class="address_Info_left_tit">收货地址</div>
|
||||
<div class="address_Info_left_name">{{ defAddress.name }} {{ defAddress.phone }}</div>
|
||||
<div class="address_Info_left_addr">{{ defAddress.address }}{{ defAddress.house_number }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</view>
|
||||
<view class="address_Info" @click="choseAddress" v-if="defAddress">
|
||||
<view class="address_Info_left">
|
||||
<view class="address_Info_left_tit">收货地址</view>
|
||||
<view class="address_Info_left_name">{{ defAddress.name }} {{ defAddress.phone }}</view>
|
||||
<view class="address_Info_left_addr">{{ defAddress.address }}{{ defAddress.house_number }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<div class="address_Info" @click="addAddress" v-if="!defAddress">
|
||||
<div class="address_Info_left noneDef">
|
||||
<div class="address_Info_btn">添加收货地址</div>
|
||||
</div>
|
||||
<view class="address_Info" @click="addAddress" v-if="!defAddress">
|
||||
<view class="address_Info_left noneDef">
|
||||
<view class="address_Info_btn">添加收货地址</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="border">
|
||||
<view class="border">
|
||||
<image src="http://192.168.0.172:5500/7.15/shop_border.png" mode="widthFix"></image>
|
||||
</div>
|
||||
</div>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<div class="goodsCate" v-for="items, indexs in carList" :key="indexs">
|
||||
<div class="goodsItem">
|
||||
<div class="goodsItem_msg_img">
|
||||
<view class="goodsCate" v-for="items, indexs in carList" :key="indexs">
|
||||
<view class="goodsItem">
|
||||
<view class="goodsItem_msg_img">
|
||||
<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>
|
||||
</div>
|
||||
<div 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>
|
||||
<div class="goodsItem_msg_right_subTit">{{ items.commodity_goods_info.goods_intro }}</div>
|
||||
<div class="goodsItem_msg_right_msg">
|
||||
<div class="goodsItem_msg_right_msg_left">
|
||||
</view>
|
||||
<view class="goodsItem_msg_right">
|
||||
<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>
|
||||
<view class="goodsItem_msg_right_subTit">{{ items.commodity_goods_info.goods_intro }}</view>
|
||||
<view class="goodsItem_msg_right_msg">
|
||||
<view class="goodsItem_msg_right_msg_left">
|
||||
<span>¥</span>{{ items.commodity_goods_info.sales_price }}
|
||||
<span>/{{ items.commodity_goods_info.goods_unit }}</span>
|
||||
</div>
|
||||
<div class="goodsItem_msg_right_msg_right">
|
||||
</view>
|
||||
<view class="goodsItem_msg_right_msg_right">
|
||||
<u-number-box v-model="value">
|
||||
<view slot="minus" class="minus" @click="minus(items, indexs)">
|
||||
<u-icon name="minus" size="32" bold></u-icon>
|
||||
@ -51,20 +50,20 @@
|
||||
<u-icon name="plus" color="#FFFFFF" size="32" bold></u-icon>
|
||||
</view>
|
||||
</u-number-box>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="yf">
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="yf">
|
||||
<span>运费</span>¥9.9
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
</div>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
</view>
|
||||
|
||||
|
||||
<div class="footer">
|
||||
<div class="btn">立即支付¥{{ totalMony }}</div>
|
||||
</div>
|
||||
<view class="footer">
|
||||
<view class="btn">立即支付¥{{ totalMony }}</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -42,8 +42,9 @@ page {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* 增加优先级确保选中样式生效 */
|
||||
.location-item .location-address.active {
|
||||
color: #fd631a;
|
||||
color: #fd631a !important;
|
||||
}
|
||||
|
||||
.location-select {
|
||||
|
||||
@ -3,23 +3,18 @@
|
||||
<view class="fenge"></view>
|
||||
<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">
|
||||
<text :class="['location-address', { 'active': item.checked }]">{{ item.address }}</text>
|
||||
<text :class="['location-address', { 'active': index === selectedIndex }]">{{ item.address }}</text>
|
||||
</view>
|
||||
<view class="location-select">
|
||||
<image
|
||||
v-if="!item.checked"
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png"
|
||||
mode="aspectFit"
|
||||
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>
|
||||
<image v-if="index !== selectedIndex"
|
||||
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/com_check1.png" mode="aspectFit"
|
||||
style="width: 40rpx; height: 40rpx;"></image>
|
||||
<image v-if="index === selectedIndex"
|
||||
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>
|
||||
@ -27,32 +22,62 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { picUrl, menuButtonInfo, request, NavgateTo } from "../../../utils";
|
||||
import { apiArr } from '../../../api/groupPurchase';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
locationList: [
|
||||
{
|
||||
id: 1,
|
||||
address: '上海市上海市浦东新区上海市浦东新区杨高中路2128号正大生活馆F2层',
|
||||
checked: true
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
address: '上海市上海市浦东新区上海市浦东新区杨高中路2128号正大生活馆F2层',
|
||||
checked: false
|
||||
}
|
||||
]
|
||||
locationList: [],
|
||||
selectedIndex: -1
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
const item = JSON.parse(options.item)
|
||||
console.log("🚀 ~ onLoad ~ item:", item)
|
||||
this.getLocationList(item.goods_id)
|
||||
},
|
||||
methods: {
|
||||
selectLocation(item) {
|
||||
// 取消所有选中状态
|
||||
this.locationList.forEach(loc => {
|
||||
loc.checked = false;
|
||||
async getLocationList(id) {
|
||||
const params = {
|
||||
goods_ids: id,
|
||||
}
|
||||
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;
|
||||
console.log("🚀 ~ selectLocation ~ item.address:", item.address)
|
||||
});
|
||||
},
|
||||
selectLocation(item, index) {
|
||||
// 更新选中项的索引
|
||||
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")
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user