增加新模块

This commit is contained in:
何江明
2025-03-20 08:46:07 +08:00
parent 15014e22aa
commit 2ae62b59ed
1729 changed files with 94700 additions and 4232 deletions
@@ -0,0 +1,372 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const api_product = require("../../api/product.js");
const utils_enumUtils = require("../../utils/enumUtils.js");
const _sfc_main = {
computed: {
PRODUCT_DELIVERY_TIME() {
return utils_enumUtils.PRODUCT_DELIVERY_TIME;
}
},
data() {
return {
id: 0,
swiperList: [],
currentNum: 1,
specificationShow: false,
specificationShowType: "",
// 弹框类型
orderInfo: {
id: 1,
url: "/static/common/product_def.png",
price: 87,
oPrice: 199,
couponPrice: 50,
inventory: 100,
// 库存
quantity: 1,
addressObj: {
name: "李个",
address: "郑州市金水区东风路街道白庙小区五号楼"
}
},
specificationList: [],
//规格
selectSpecification: [],
// 选择的规格
specificationTempl: [],
// 规格模版数据
selectSpecificationTempl: {}
// 选择规格模版数据
};
},
onLoad(options) {
const id = options.id;
if (id && id !== 0) {
this.id = id ? parseInt(id, 10) : 0;
this.getById();
}
},
methods: {
getValue: utils_enumUtils.getValue,
jumpLeft() {
common_vendor.index.navigateBack({
delta: 1
// 返回的页面数,默认为1,返回到上一级
});
},
jumpHome() {
common_vendor.index.switchTab({
url: "/pages/home/home"
});
},
// 分享
jumpShare() {
common_vendor.index.navigateTo({
url: "/pages/invite_friends/invite_friends"
});
},
/**
* 查询详细内容
*/
async getById() {
const params = {
id: this.id
};
const resp = await api_product.getGoodsDetail(params);
if (resp && resp.bizcode === 100) {
const data = resp.data;
if (data.goodsGraph) {
this.swiperList = data.goodsGraph.split(",");
}
data.addressObj = {};
data.quantity = 1;
data.inventory = 0;
this.orderInfo = data;
this.getSpecification(data.specs);
}
},
checkSpecification(val, type) {
if (val) {
this.querySpecification();
} else {
this.specificationList = [];
this.selectSpecification = [];
this.specificationTempl = [];
}
this.specificationShow = val;
this.specificationShowType = type;
},
// 拆解规格
getSpecification(specs) {
common_vendor.index.__f__("log", "at pages/productInfo/productInfo.vue:296", "specs", specs);
const optionArr = [];
if (specs) {
const arr = JSON.parse(specs);
arr.map((item) => {
common_vendor.index.__f__("log", "at pages/productInfo/productInfo.vue:301", "item", item);
optionArr.push({
type: item.type,
items: item.items,
selectVal: null
});
});
}
this.specificationList = optionArr;
},
// 获取规格模版数据
async querySpecification() {
const params = {
id: this.id
};
const resp = await api_product.getGoodsSpecs(params);
if (resp && resp.bizcode === 100) {
const data = resp.data;
let stock = 0;
data.map((item) => {
stock = stock + item.stock;
});
this.specificationTempl = data;
this.orderInfo.inventory = stock;
}
},
//改变规格的样式
clickSpecification(pIndex, oItem) {
this.specificationList[pIndex].selectVal = oItem.n;
this.selectSpecificationFun(pIndex, oItem);
},
// 选择规格
selectSpecificationFun(index, item) {
const currentSelectSpecification = this.selectSpecification;
currentSelectSpecification[index] = item.n;
this.selectSpecification = currentSelectSpecification;
const oldLength = this.specificationList.length;
const newLength = this.selectSpecification.length;
if (oldLength === newLength) {
const newLengthStr = this.selectSpecification.join("♧");
const specificationTempl = this.specificationTempl;
let selectTempl = {};
specificationTempl.map((item2) => {
if (item2.combNames === newLengthStr) {
selectTempl = item2;
return;
}
});
this.selectSpecificationTempl = selectTempl;
this.orderInfo.inventory = selectTempl.stock;
}
},
// 改变数量
quantityFun(type) {
let currentQuantity = this.orderInfo.quantity;
if (type === "minus") {
if (currentQuantity === 1) {
this.$refs.uToastRef.show({
type: "error",
message: "不能低于最低购买数量"
});
} else {
currentQuantity = currentQuantity - 1;
}
} else if (type === "add") {
currentQuantity = currentQuantity + 1;
}
this.orderInfo.quantity = currentQuantity;
},
/**
* 立即购买,确定订单页面
*/
byFun() {
this.addCart();
common_vendor.index.navigateTo({
url: "/pages/order_submit/order_submit"
});
},
/**
* 加入购入车
*/
async addCart() {
const selectTempl = this.selectSpecificationTempl;
if (!selectTempl || Object.keys(selectTempl).length === 0) {
common_vendor.index.showToast({
title: "请先选择规格",
icon: "none",
// 可选 success/loading/none
duration: 2e3
// 持续时长,单位ms
});
return;
}
const params = {
id: this.id,
specsId: selectTempl.id,
// 规格ID
goodsNum: this.orderInfo.quantity
// 商品数量
};
const resp = await api_product.addGoods(params);
if (resp && resp.bizcode === 100) {
common_vendor.index.showToast({
title: "成功加入购物车",
icon: "success",
// 可选 success/loading/none
duration: 2e3
// 持续时长,单位ms
});
setTimeout(() => {
this.checkSpecification(false, null);
}, 2e3);
}
}
}
};
if (!Array) {
const _easycom_up_swiper2 = common_vendor.resolveComponent("up-swiper");
const _easycom_up_image2 = common_vendor.resolveComponent("up-image");
const _easycom_up_popup2 = common_vendor.resolveComponent("up-popup");
(_easycom_up_swiper2 + _easycom_up_image2 + _easycom_up_popup2)();
}
const _easycom_up_swiper = () => "../../uni_modules/uview-plus/components/u-swiper/u-swiper.js";
const _easycom_up_image = () => "../../uni_modules/uview-plus/components/u-image/u-image.js";
const _easycom_up_popup = () => "../../uni_modules/uview-plus/components/u-popup/u-popup.js";
if (!Math) {
(_easycom_up_swiper + _easycom_up_image + _easycom_up_popup)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: common_vendor.t($data.currentNum + 1),
b: common_vendor.t($data.swiperList.length),
c: common_vendor.p({
list: $data.swiperList,
height: "280"
}),
d: common_vendor.o($options.jumpLeft),
e: common_vendor.p({
src: "/static/common/left_b_st.png",
width: "30",
height: "30",
bgColor: "#f1f6ff00"
}),
f: common_vendor.o($options.jumpShare),
g: common_vendor.p({
src: "/static/common/share_st.png",
width: "30",
height: "30",
bgColor: "#f1f6ff00"
}),
h: $data.orderInfo.maxPrice && $data.orderInfo.maxPrice !== 0
}, $data.orderInfo.maxPrice && $data.orderInfo.maxPrice !== 0 ? {
i: common_vendor.t($data.orderInfo.minPrice),
j: common_vendor.t($data.orderInfo.maxPrice)
} : {
k: common_vendor.t($data.orderInfo.minPrice)
}, {
l: common_vendor.t($data.orderInfo.adPrice),
m: common_vendor.t($data.orderInfo.name),
n: common_vendor.t($data.selectSpecificationTempl.combTypes || "暂未选择规格"),
o: common_vendor.p({
src: "/static/common/right.png",
width: "20",
height: "20",
bgColor: "#f1f6ff00"
}),
p: common_vendor.o(($event) => $options.checkSpecification(true)),
q: common_vendor.p({
src: "/static/common/address2.png",
width: "10",
height: "10",
bgColor: "#f1f6ff00"
}),
r: common_vendor.t($options.getValue($options.PRODUCT_DELIVERY_TIME, $data.orderInfo.deliveryTime)),
s: common_vendor.p({
src: "/static/product/product_b.png",
width: "10",
height: "12",
bgColor: "#f1f6ff00"
}),
t: common_vendor.p({
src: "/static/product/product_js.png",
width: "10",
height: "10",
bgColor: "#f1f6ff00"
}),
v: $data.orderInfo.detailInfo,
w: common_vendor.o($options.jumpHome),
x: common_vendor.p({
src: "/static/product/home.png",
width: "20",
height: "20",
bgColor: "#f1f6ff00"
}),
y: common_vendor.o($options.jumpShare),
z: common_vendor.p({
src: "/static/product/kefu.png",
width: "20",
height: "20",
bgColor: "#f1f6ff00"
}),
A: common_vendor.o(($event) => $options.checkSpecification(true, "addCart")),
B: common_vendor.o(($event) => $options.checkSpecification(true, "buy")),
C: common_vendor.p({
src: $data.orderInfo.mainGraph,
width: "100",
height: "100",
bgColor: "#f1f6ff00"
}),
D: $data.selectSpecificationTempl && Object.keys($data.selectSpecificationTempl).length !== 0
}, $data.selectSpecificationTempl && Object.keys($data.selectSpecificationTempl).length !== 0 ? {
E: common_vendor.t($data.selectSpecificationTempl.price)
} : {
F: common_vendor.t($data.orderInfo.minPrice),
G: common_vendor.t($data.orderInfo.maxPrice)
}, {
H: $data.orderInfo.couponPrice && $data.orderInfo.couponPrice !== 0
}, $data.orderInfo.couponPrice && $data.orderInfo.couponPrice !== 0 ? {
I: common_vendor.t($data.orderInfo.couponPrice)
} : {}, {
J: common_vendor.t($data.orderInfo.adPrice),
K: $data.orderInfo.couponPrice && $data.orderInfo.couponPrice !== 0
}, $data.orderInfo.couponPrice && $data.orderInfo.couponPrice !== 0 ? {
L: common_vendor.t($data.orderInfo.couponPrice)
} : {}, {
M: common_vendor.t($data.orderInfo.inventory || 0),
N: common_vendor.f($data.specificationList, (item, index, i0) => {
return {
a: common_vendor.t(item.type),
b: common_vendor.f(item.items, (oItem, oIndex, i1) => {
return {
a: common_vendor.t(oItem.n),
b: common_vendor.n(oItem.inventory === 0 ? "item_Warp item_Warp_no_warp" : item.selectVal === oItem.n ? "item_Warp item_Warp_yes_warp" : "item_Warp"),
c: oItem.n,
d: common_vendor.o(($event) => $options.clickSpecification(index, oItem), oItem.n)
};
}),
c: item.id
};
}),
O: common_vendor.o(($event) => $options.quantityFun("minus")),
P: common_vendor.t($data.orderInfo.quantity),
Q: common_vendor.o(($event) => $options.quantityFun("add")),
R: $data.specificationShowType === "buy"
}, $data.specificationShowType === "buy" ? {
S: common_vendor.o((...args) => $options.byFun && $options.byFun(...args))
} : $data.specificationShowType === "addCart" ? {
U: common_vendor.o((...args) => $options.addCart && $options.addCart(...args))
} : {
V: common_vendor.o((...args) => $options.addCart && $options.addCart(...args)),
W: common_vendor.o((...args) => $options.byFun && $options.byFun(...args))
}, {
T: $data.specificationShowType === "addCart",
X: common_vendor.o(($event) => $data.specificationShow = $event),
Y: common_vendor.p({
round: 10,
closeOnClickOverlay: false,
closeable: true,
mode: "bottom",
show: $data.specificationShow
})
});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-ceb0d096"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/productInfo/productInfo.js.map
@@ -0,0 +1,8 @@
{
"navigationStyle": "custom",
"usingComponents": {
"up-swiper": "../../uni_modules/uview-plus/components/u-swiper/u-swiper",
"up-image": "../../uni_modules/uview-plus/components/u-image/u-image",
"up-popup": "../../uni_modules/uview-plus/components/u-popup/u-popup"
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,328 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/* uni.scss */
/**
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
.product_info_warp.data-v-ceb0d096 {
height: calc(100vh - 196rpx);
background-color: #F5F5F5;
}
.product_info_header_warp.data-v-ceb0d096 {
position: relative;
}
.product_info_header_warp .img_comm.data-v-ceb0d096 {
position: absolute;
top: 140rpx;
}
.product_info_header_warp .left_warp.data-v-ceb0d096 {
left: 40rpx;
}
.product_info_header_warp .right_warp.data-v-ceb0d096 {
right: 40rpx;
}
.product_content_warp.data-v-ceb0d096 {
border-radius: 30rpx 30rpx 0rpx 24rpx;
padding: 20rpx;
}
.product_content_warp .content_data.data-v-ceb0d096 {
padding: 20rpx;
}
.product_content_warp .content_data_price.data-v-ceb0d096 {
font-weight: bold;
font-size: 36rpx;
color: #FF7C41;
}
.product_content_warp .content_data_price .price_o.data-v-ceb0d096 {
font-weight: 500;
font-size: 26rpx;
color: #999999;
-webkit-text-decoration-line: line-through;
text-decoration-line: line-through;
margin-left: 10rpx;
}
.product_content_warp .content_data_title.data-v-ceb0d096 {
font-weight: bold;
font-size: 36rpx;
color: #111111;
margin-top: 10rpx;
}
.product_content_warp .content_data_series.data-v-ceb0d096 {
display: flex;
justify-content: space-between;
align-items: center;
font-weight: 500;
font-size: 24rpx;
color: #999999;
margin-top: 10rpx;
}
.product_content_warp .content_concrete.data-v-ceb0d096 {
padding: 20rpx;
background: #FFFFFF;
border-radius: 30rpx;
margin-top: 20rpx;
}
.product_content_warp .content_concrete .concrete_item.data-v-ceb0d096 {
display: flex;
justify-content: space-between;
font-size: 28rpx;
padding: 20rpx 0;
}
.product_content_warp .content_concrete .concrete_item_.data-v-ceb0d096 {
display: flex;
width: 100%;
}
.product_content_warp .content_concrete .concrete_item_but.data-v-ceb0d096 {
border-bottom: 1rpx solid #EEEEEEFF;
}
.product_content_warp .content_concrete .concrete_item_title.data-v-ceb0d096 {
color: #808080;
width: 140rpx;
}
.product_content_warp .content_concrete .concrete_item_value.data-v-ceb0d096 {
font-weight: 500;
color: #1A1A1A;
width: calc(100% - 140rpx);
}
.product_content_warp .content_concrete .concrete_item_value .address_warp.data-v-ceb0d096 {
display: flex;
margin-bottom: 10rpx;
}
.product_content_warp .content_concrete .concrete_item_value .address_72_warp.data-v-ceb0d096 {
font-size: 24rpx;
color: #808080;
}
.product_content_warp .content_concrete .concrete_item_bz.data-v-ceb0d096 {
display: flex;
}
.product_content_warp .content_concrete .concrete_item_bz_item.data-v-ceb0d096 {
margin-right: 20rpx;
}
.product_content_warp .content_concrete .concrete_item_bz_item_left.data-v-ceb0d096 {
margin-left: 10rpx;
}
.content_details.data-v-ceb0d096 {
background: #FFFFFF;
border-radius: 24rpx;
padding: 10rpx 10rpx 30rpx;
margin-top: 30rpx;
}
.content_details .content_details_title.data-v-ceb0d096 {
padding: 20rpx 30rpx;
}
.content_details img.data-v-ceb0d096,
.content_details img[alt].data-v-ceb0d096 {
max-width: 100%;
}
.product_but_warp.data-v-ceb0d096 {
padding: 20rpx;
position: fixed;
bottom: 0;
height: 160rpx;
width: calc(100% - 40rpx);
background-color: #FFFFFF;
display: flex;
justify-content: space-between;
}
.product_but_warp .product_but_left.data-v-ceb0d096 {
display: flex;
justify-content: space-between;
width: 30%;
}
.product_but_warp .product_but_left .left_item.data-v-ceb0d096 {
width: 50%;
text-align: center;
font-weight: 500;
font-size: 20rpx;
color: #666666;
}
.product_but_right.data-v-ceb0d096 {
display: flex;
justify-content: center;
}
.product_but_right .but_comm.data-v-ceb0d096 {
text-align: center;
padding: 20rpx 40rpx;
color: #FFFFFF;
height: 50rpx;
}
.product_but_right .join_warp.data-v-ceb0d096 {
background: #FFA64F;
border-radius: 16rpx 0rpx 0rpx 16rpx;
}
.product_but_right .buy_warp.data-v-ceb0d096 {
background: #FF7C41;
border-radius: 0rpx 16rpx 16rpx 0rpx;
}
.specification_warp.data-v-ceb0d096 {
background-color: #F5F5F5;
}
.specification_warp .specification_adress_warp.data-v-ceb0d096 {
padding: 30rpx;
background: #FFFFFF;
border-radius: 24rpx;
}
.specification_warp .specification_adress_msg.data-v-ceb0d096 {
text-align: center;
font-weight: 500;
font-size: 24rpx;
color: #808080;
margin: 0 10rpx 0 20rpx;
}
.specification_warp .specification_adress_arr.data-v-ceb0d096 {
display: flex;
align-items: center;
margin-top: 20rpx;
}
.specification_warp .address_title.data-v-ceb0d096 {
font-weight: 500;
font-size: 26rpx;
color: #BBBBBB;
margin-bottom: 10rpx;
margin-right: 20rpx;
width: 592rpx;
white-space: nowrap;
/* 防止文本换行 */
overflow: hidden;
/* 隐藏溢出的文本 */
text-overflow: ellipsis;
/* 使用省略号表示溢出的内容 */
}
.specification_warp .address_title_sel.data-v-ceb0d096 {
color: #333333;
}
.specification_warp .specification_product_warp.data-v-ceb0d096 {
display: flex;
background: #FFFFFF;
border-radius: 24rpx;
padding: 30rpx;
margin-top: 20rpx;
}
.specification_warp .specification_product_warp .product_content.data-v-ceb0d096 {
margin-left: 10rpx;
display: grid;
}
.specification_warp .specification_product_warp .price_content_warp.data-v-ceb0d096 {
font-size: 36rpx;
color: #FF7C41;
display: flex;
align-items: center;
}
.specification_warp .specification_product_warp .price_content_coupon_warp.data-v-ceb0d096 {
margin-left: 20rpx;
padding: 4rpx 10rpx;
text-align: center;
color: #FF7C41;
font-size: 22rpx;
font-weight: 500;
border: 1px solid #FF7C41;
border-radius: 6rpx;
}
.specification_warp .specification_product_warp .oOrice_content_warp.data-v-ceb0d096 {
font-size: 26rpx;
color: #808080;
line-height: 11rpx;
-webkit-text-decoration-line: line-through;
text-decoration-line: line-through;
margin-top: 10rpx;
}
.specification_warp .specification_product_warp .coupon_content_warp.data-v-ceb0d096 {
font-weight: 500;
font-size: 22rpx;
color: #FF7C41;
margin-top: 10rpx;
}
.specification_warp .specification_product_warp .inventory_warp.data-v-ceb0d096 {
display: flex;
font-weight: 500;
font-size: 24rpx;
color: #808080;
}
.specification_warp .specification_list_warp.data-v-ceb0d096 {
background: #FFFFFF;
border-radius: 24rpx;
padding: 30rpx;
margin-top: 20rpx;
}
.specification_warp .specification_list_warp .list_warp.data-v-ceb0d096 {
margin-bottom: 30rpx;
}
.specification_warp .specification_list_warp .list_title_warp.data-v-ceb0d096 {
font-weight: 500;
font-size: 30rpx;
color: #1A1A1A;
line-height: 48rpx;
}
.specification_warp .specification_list_warp .specification_item_warp.data-v-ceb0d096 {
justify-content: space-between;
display: flex;
flex-wrap: wrap;
align-items: center;
}
.specification_warp .specification_list_warp .item_Warp.data-v-ceb0d096 {
width: 48%;
background: #F5F5F5;
border-radius: 10rpx;
color: #333333;
text-align: center;
padding: 10rpx 0;
margin-top: 13rpx;
font-size: 26rpx;
font-weight: 500;
}
.specification_warp .specification_list_warp .item_Warp_no_warp.data-v-ceb0d096 {
background: #F5F5F5;
color: #999999;
-webkit-text-decoration-line: line-through;
text-decoration-line: line-through;
}
.specification_warp .specification_list_warp .item_Warp_yes_warp.data-v-ceb0d096 {
border: 1px solid #FF7C41;
color: #FF7C41;
background: #FFF1EB;
}
.specification_warp .specification_but.data-v-ceb0d096 {
background: #FFFFFF;
border-radius: 24rpx;
padding: 30rpx;
margin-top: 30rpx;
}
.specification_warp .specification_but .specification_buy.data-v-ceb0d096 {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30rpx;
}
.specification_warp .specification_but .specification_buy_but.data-v-ceb0d096 {
width: 100%;
padding: 20rpx 0;
text-align: center;
background-color: #FF7C41;
color: #FFFFFF;
margin-top: 20rpx;
font-weight: 500;
font-size: 28rpx;
color: #FFFFFF;
border-radius: 16rpx;
}
.popup_but .but_comm.data-v-ceb0d096 {
width: 40%;
}