This commit is contained in:
2024-08-22 12:53:28 +08:00
commit 1d65a849fd
360 changed files with 41757 additions and 0 deletions

View File

@@ -0,0 +1,175 @@
var t = require("../../@babel/runtime/helpers/typeof"), o = getApp(), e = require("../../wxParse/wxParse.js");
Page({
data: {
nav_select: !1,
indicatorDots: !0,
autoplay: !0,
interval: 3e3,
duration: 800,
currentIndex: 1,
floorstatus: !1,
showView: !0,
detail: {},
goods_price: 0,
line_price: 0,
stock_num: 0,
goods_num: 1,
goods_sku_id: 0,
cart_total_num: 0,
specData: {},
colourList: [],
colour_id: 0,
storeInfo: {},
notice_image: ""
},
goods_spec_arr: [],
onLoad: function(t) {
this.data.goods_id = t.goods_id, this.getGoodsDetail(), this.getColourList(), this.getStoreInfo();
},
imgYu: function(t) {
var o = t.currentTarget.dataset.src, e = t.currentTarget.dataset.list;
console.log(e);
var s = [], a = e.length;
if (a > 0) for (var i = 0; i < a; i++) s.push(e[i].file_path);
console.log(o), console.log(s), wx.previewImage({
current: o,
urls: s
});
},
getColourList: function() {
var t = this;
o._get("goods/getColourList", {}, function(o) {
var e = o.data;
t.setData({
colourList: e.list
});
});
},
getStoreInfo: function() {
var t = this;
o._get("index/getStoreInfo", {}, function(o) {
var e = o.data;
console.log(e), t.setData({
storeInfo: e.store,
notice_image: e.notice_image
});
});
},
getGoodsDetail: function() {
var t = this;
o._get("goods/detail", {
goods_id: t.data.goods_id
}, function(o) {
var e = t.initGoodsDetailData(o.data);
t.setData(e);
});
},
initGoodsDetailData: function(t) {
return t.detail.content.length > 0 && e.wxParse("content", "html", t.detail.content, this, 0),
t.goods_sku_id = t.detail.spec[0].spec_sku_id, t.goods_price = t.detail.spec[0].goods_price,
t.line_price = t.detail.spec[0].line_price, t.stock_num = t.detail.spec[0].stock_num,
20 == t.detail.spec_type && (t.specData = this.initManySpecData(t.specData)), t;
},
initManySpecData: function(t) {
for (var o in t.spec_attr) for (var e in t.spec_attr[o].spec_items) e < 1 && (t.spec_attr[o].spec_items[0].checked = !0,
this.goods_spec_arr[o] = t.spec_attr[o].spec_items[0].item_id);
return t;
},
modelTap: function(t) {
var o = t.currentTarget.dataset.attrIdx, e = t.currentTarget.dataset.itemIdx, s = this.data.specData;
for (var a in s.spec_attr) for (var i in s.spec_attr[a].spec_items) o == a && (s.spec_attr[a].spec_items[i].checked = !1,
e == i && (s.spec_attr[a].spec_items[e].checked = !0, this.goods_spec_arr[a] = s.spec_attr[a].spec_items[e].item_id));
this.setData({
specData: s
}), this.updateSpecGoods();
},
updateSpecGoods: function() {
var o = this.goods_spec_arr.join("_"), e = this.data.specData.spec_list.find(function(t) {
return t.spec_sku_id == o;
});
"object" === t(e) && this.setData({
goods_sku_id: e.spec_sku_id,
goods_price: e.form.goods_price,
line_price: e.form.line_price,
stock_num: e.form.stock_num
});
},
setCurrent: function(t) {
this.setData({
currentIndex: t.detail.current + 1
});
},
onChangeShowState: function() {
this.setData({
showView: !this.data.showView
});
},
goTop: function(t) {
this.setData({
scrollTop: 0
});
},
scroll: function(t) {
this.setData({
floorstatus: t.detail.scrollTop > 200
});
},
up: function() {
this.setData({
goods_num: ++this.data.goods_num
});
},
down: function() {
this.data.goods_num > 1 && this.setData({
goods_num: --this.data.goods_num
});
},
flowCart: function() {
wx.switchTab({
url: "../flow/index"
});
},
toIndex: function() {
wx.switchTab({
url: "../index/index"
});
},
submit: function(t) {
var e = this, s = t.currentTarget.dataset.type;
o._post_form("cart/check", {
goods_id: e.data.goods_id,
goods_num: e.data.goods_num,
goods_sku_id: e.data.goods_sku_id
}, function(t) {
if (1 != t.code) return o.showSuccess(t.msg), !1;
"buyNow" === s ? wx.navigateTo({
url: "../flow/checkout?" + o.urlEncode({
order_type: "buyNow",
goods_id: e.data.goods_id,
goods_num: e.data.goods_num,
goods_sku_id: e.data.goods_sku_id
})
}) : "addCart" === s && o._post_form("cart/add", {
goods_id: e.data.goods_id,
goods_num: e.data.goods_num,
goods_sku_id: e.data.goods_sku_id
}, function(t) {
o.showSuccess(t.msg), e.setData(t.data);
});
});
},
onShareAppMessage: function() {
return {
title: this.data.detail.goods_name + " " + this.data.detail.goods_title,
path: "/pages/goods/index?goods_id=" + this.data.goods_id
};
},
onShareTimeline: function(t) {
return {
title: this.data.detail.goods_name + " " + this.data.detail.goods_title,
path: "/pages/goods/index?goods_id=" + this.data.goods_id,
imageUrl: this.data.detail.image[0].file_path
};
}
});

View File

@@ -0,0 +1,6 @@
{
"navigationBarTitleText": "商品详情",
"usingComponents": {
"shortcut": "/components/shortcut/shortcut"
}
}

View File

@@ -0,0 +1,82 @@
<import src="../../wxParse/wxParse.wxml"></import>
<scroll-view bindscroll="scroll" scrollTop="{{scrollTop}}" scrollY="true" style="position:absolute; top:0; left:0; right:0; bottom:0;">
<view class="container" wx:if="{{detail.goods_id}}">
<view bindtap="imgPreview">
<swiper autoplay="{{autoplay}}" bindchange="setCurrent" circular="{{true}}" class="banner-box swiper-box" duration="{{duration}}" indicatorDots="{{indicatorDots}}" interval="{{interval}}">
<swiper-item wx:for="{{detail.image}}" wx:key="this">
<image bindtap="imgYu" class="slide-image" data-list="{{detail.image}}" data-src="{{item.file_path}}" mode="aspectFill" src="{{item.file_path}}"></image>
</swiper-item>
</swiper>
<view class="number-banner">
<text>{{currentIndex}}</text>
<text>/{{detail.image.length}}</text>
</view>
</view>
<view class="cont-box b-f">
<view class="goods-title ">
<text class="title f-32 twolist-hidden">
<text class="colour-box f-20" wx:if="{{detail.colour>0}}">{{colourList[detail.colour]}}</text>
<text>{{detail.goods_name}}</text>
</text>
</view>
<view class="goods-title ">
<text class="title f-26 twolist-hidden" style="color: #555;">{{detail.goods_title.length>0?detail.goods_title:' '}}</text>
</view>
<view class="money-box">
<text class="num">¥{{goods_price}}</text>
<text class="del" wx:if="{{line_price>0}}">¥{{line_price}}</text>
</view>
</view>
<view class="cont-box b-f goods-property-box m-top20" wx:if="{{storeInfo.notice.length>0}}">
<text class="col-3 f-30">{{storeInfo.notice}}</text>
</view>
<view class="cont-box b-f goods-property-box m-top20" wx:if="{{notice_image.length>0}}">
<image src="{{notice_image}}" style="width: 100%;"></image>
</view>
<view class="p-bottom">
<view class="top-nav m-top20 b-f b-b">
<view class="top-nav-bar">
<view bindtap="toOrder" id="top-nav-bar-true">
<span>商品描述</span>
</view>
</view>
</view>
<view class="order" hidden="{{hiddenOrder}}">
<view wx:if="{{detail.content!=''}}">
<view class="b-f goods-detail-box">
<view class="goods-cont-li">
<template is="wxParse" data="{{wxParseData:content.nodes}}"></template>
</view>
</view>
</view>
<view wx:else>
<view class="yoshop-notcont">
<text class="iconfont icon-ziyuan"></text>
<text class="cont">亲,此处暂无详情数据</text>
</view>
</view>
</view>
</view>
<view class="footer-fixed f-30" style="padding-bottom: 20px;">
<view bindtap="toIndex" class="goods-fixed-icon dis-flex flex-x-center flex-y-center">
<text class="iconfont icon-home"></text>
</view>
<view class="goods-fixed-icon dis-flex flex-x-center flex-y-center">
<button openType="contact" sessionFrom="weapp" size="27" style="opacity: 0;position:absolute;top:0px;left:0px;display:block;width:100%;height:100%;" type="default-light"></button>
<text class="iconfont icon-icon_service"></text>
</view>
<view bindtap="flowCart" class="goods-fixed-icon dis-flex flex-x-center flex-y-center">
<text class="iconfont icon-cart_b"></text>
<view class="flow_num" wx:if="{{cart_total_num>0}}">
<text class="">{{cart_total_num}}</text>
</view>
</view>
<view bindtap="submit" class="order-number" data-type="addCart" style="padding-bottom: 3px;">加入购物车</view>
<view bindtap="submit" class="order-bt" data-type="buyNow" style="padding-bottom: 3px;"> 立即购买</view>
</view>
</view>
</scroll-view>
<view bindtap="goTop" class="widget-goTop" wx:if="{{floorstatus}}">
<text class="iconfont icon-fanhuidingbu"></text>
</view>
<shortcut></shortcut>

View File

@@ -0,0 +1,330 @@
.slide-image {
background: #fff;
}
.banner-box {
border-bottom: 1rpx solid #e4e4e4;
height: 900rpx;
}
.user-orderJtou {
color: #999;
font-size: 26rpx;
margin-top: -9rpx;
position: absolute;
top: 50%;
}
.goods-title {
color: #333;
overflow: hidden;
padding: 0 0rpx 0 0;
}
.money-box,.money-box .num {
margin-top: 10rpx;
}
.money-box .num {
color: #ff495e;
font-size: 40rpx;
}
.money-box .del {
TEXT-DECORATION: line-through;
color: #999;
font-size: 24rpx;
margin-left: 6rpx;
}
.goods-sales-box {
color: #888;
}
.goods-sales-box .stock {
display: block;
text-align: right;
}
.goods-property-box {
padding: 12px;
position: relative;
}
.goods-property-jianTou {
margin-top: -13rpx;
position: absolute;
right: 0;
top: 50%;
width: 52rpx;
}
.goods-property-jianTou image {
height: 100%;
width: 100%;
}
.modal_cont_box {
border-top: 1rpx solid #eee;
padding: 20rpx 12px;
}
.buy_number {
justify-content: space-between;
}
.buyNumber {
background: #fff;
border-radius: 10rpx;
color: #888;
margin-bottom: 10rpx;
}
.tmall-types.mb20 {
margin-bottom: 20rpx;
}
.tipstxt {
color: #888;
font-size: 28rpx;
margin-bottom: 10rpx;
}
.cartypeitem,.cartypelist {
display: inline-block;
}
.cartypeitem {
background: #f3f2f8;
border: 1rpx solid #f3f2f8;
border-radius: 10rpx;
color: #444;
font-size: 31rpx;
height: 60rpx;
line-height: 60rpx;
margin: 0 20rpx 20rpx 0;
overflow: hidden;
padding: 0 30rpx;
position: relative;
}
.cartypeitem.cur {
background: #ff495e;
border: 1rpx solid #ff495e;
color: #fff;
}
.cartypeitem.cur:after {
bottom: 0;
content: "";
display: inline-block;
height: 16rpx;
position: absolute;
right: 0;
width: 16rpx;
}
.cartypeitem.disabled {
background: #eee;
border: 2rpx dashed #dedede;
color: #dedede;
cursor: not-allowed;
}
.number-banner {
background: rgba(0,0,0,.3);
border-radius: 50rpx;
color: #fff;
font-size: 32rpx;
margin-top: -70rpx;
padding: 0 18rpx;
position: absolute;
right: 30rpx;
}
.number-banner text:last-child {
color: hsla(0,0%,100%,.6);
font-size: 26rpx;
}
.cart {
background-color: #fff;
}
.order-number {
background-color: #f4a213;
color: #fff;
line-height: 46px;
text-align: center;
width: 50%;
}
.order-number button {
background: none;
border: 0;
border-radius: 0;
color: #fff;
font-size: 34rpx;
line-height: inherit;
padding: 0;
}
.order-number button::after {
border: none;
border-radius: 0;
box-sizing: border-box;
content: " ";
height: 0;
left: 0;
position: absolute;
top: 0;
transform: scale(0);
transform-origin: 0 0;
width: 0;
}
.default-btn {
background-color: #ccc;
color: #fff;
line-height: 46px;
text-align: center;
width: 50%;
}
.user-orderJtou-1 {
color: #999;
font-size: 26rpx;
position: absolute;
transform: rotate(-90deg);
}
.user-orderJtou-1,.user-orderJtou-2 {
transition: all .2s;
}
.user-orderJtou-2 {
transform: rotate(90deg);
}
.flow_num {
background: #ff495e;
border-radius: 30rpx;
height: 30rpx;
min-width: 30rpx;
position: absolute;
right: 20rpx;
top: 10rpx;
}
.goods-cont-li .wxParse-inline {
padding: 20rpx 10rpx;
}
.goods-cont-li image {
display: block;
margin: 0 auto;
width: 100%;
}
.goods-cont-li .wxParse-inline {
font-size: 30rpx;
}
.comment-num {
color: #333;
font-size: 28rpx;
margin-top: -20rpx;
position: absolute;
right: 34px;
top: 50%;
}
.top-nav-bar {
display: flex;
flex-wrap: wrap;
font-size: 31rpx;
padding: 12px;
}
#top-nav-bar-true text {
border: 1rpx solid #ff495e;
color: #ff495e;
}
#top-nav-bar-0 span {
color: #444;
}
.footer-fixed .goods-fixed-icon {
background: #fff;
border-left: 1rpx solid #eee;
height: 92rpx;
margin: 0 auto;
padding: 0 6rpx;
position: relative;
width: 150rpx;
}
.footer-fixed .goods-fixed-icon:first-child {
border-left: none;
}
.footer-fixed .goods-fixed-icon image {
display: block;
height: 56rpx;
left: 0;
margin-left: 30rpx;
margin-top: 17rpx;
position: absolute;
top: 0;
width: 56rpx;
}
.footer-fixed .goods-fixed-icon text {
color: #7a7e83;
font-size: 48rpx;
}
.footer-fixed .goods-fixed-icon .bargain-icon {
height: 50rpx;
}
.footer-fixed .goods-fixed-icon .bargain-icon image {
height: 50rpx;
margin-top: -40rpx;
width: 50rpx;
}
.footer-fixed .goods-fixed-icon .bargain-home {
margin-top: 6rpx;
text-align: center;
}
.footer-fixed .goods-fixed-icon .flow_num text {
color: #fff;
display: block;
font-size: 22rpx;
text-align: center;
}
.footer-fixed .goods-fixed-icon .icon-shoucang {
font-size: 40rpx;
}
.footer-fixed .goods-fixed-icon .s_cont {
color: #ff495e;
}
.colour-box {
background: #e64340;
color: #fff;
font-size: 26rpx;
line-height: 26rpx;
margin-right: 10rpx;
padding: 4rpx 8rpx;
text-align: center;
}
.goods-title {
margin-top: 8rpx;
}