mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 21:03:26 +08:00
### 0.6.0 专业版(大版本升级,破坏性升级,请酌情处理):
【新增】弃用现在sku前端,启用全新sku组件,更加灵活,体验更好。 【新增】新增通过商品序列获取sku全新列表功能。 【新增】仓储层底层增加二级缓存功能,后面将逐步完善底层缓存中心模块。 【新增】0元购,积分兑换模式下,也去计算用户是否科技升级。 【新增】数据及业务仓储增加二级缓存功能。curd可自主控制是否缓存和清除。 【新增】订单导出excel数据增加商品名称+货品sku组合展示的方式。 【新增】自定义交易组件增加【获取商家信息】【更新商家信息】两个接口处理。 【新增】增加公告列表及公告详情页面,首页组件公告点击跳转列表展示。 【新增】个人中心增加【公告中心】入口。 【新增】后台余额变动增加说明录入。 【调整】将前端能进行分包的文件夹都进行分包,减少主包占用,方便进行二开。 【调整】因ckeditor5存在图片不可设置宽度,上传不支持mp4,排版不畅等情况,降级使用ckeditor4版本。 【修复】修复0.5.5版本售后积分返还机制积分模式判断异常的问题。 【修复】修复使用积分全额抵扣,或其他优惠政策导致的0元购,未进行短信提醒及小票打印机未打印的问题。 【修复】修复更换ckeditor4编辑器后接龙添加编辑调用失败的问题。 【修复】修复积分全额抵扣,金额0元购的情况下,进行售后执行完毕,订单未完结的情况。 【优化】去除分销申请面板按钮无用并失效报错的customStyle属性。 【优化】优化部分方法中使用手写字符串的遗留问题,统一采用enum方式。 【优化】优化前端及接口部分命名错误的问题。错将skill误写成seckill。 【优化】去除uniapp端多个客服代码。 【优化】商品详情底部完善购物车数量显示的问题。 【优化】优化团购列表,拼团列表,秒杀页面页面样式布局差异问题。 【优化】调整支付结果界面样式效果,仿微信支付结果界面。更加清晰明朗。 【优化】优化售后提交页面json计算,开放当用户下单后但未发货情况下,可以申请直接售后的操作需求。 【优化】后台商家手机号码支持设置多个,使用小写逗号分隔,方便多个商家管理员接收下单提醒。 【优化】后台售后单审核,调整售后商品为必选项。
This commit is contained in:
@@ -5,16 +5,12 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="CoreShop\.hbuilderx\**" />
|
||||
<Compile Remove="CoreShop\unpackage\**" />
|
||||
<EmbeddedResource Remove="CoreShop\.hbuilderx\**" />
|
||||
<EmbeddedResource Remove="CoreShop\unpackage\**" />
|
||||
<None Remove="CoreShop\.hbuilderx\**" />
|
||||
<None Remove="CoreShop\unpackage\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="CoreShop\pages\form\" />
|
||||
<Compile Remove="CoreShopProfessional-UniApp\.hbuilderx\**" />
|
||||
<Compile Remove="CoreShopProfessional-UniApp\unpackage\**" />
|
||||
<EmbeddedResource Remove="CoreShopProfessional-UniApp\.hbuilderx\**" />
|
||||
<EmbeddedResource Remove="CoreShopProfessional-UniApp\unpackage\**" />
|
||||
<None Remove="CoreShopProfessional-UniApp\.hbuilderx\**" />
|
||||
<None Remove="CoreShopProfessional-UniApp\unpackage\**" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
uni.getSystemInfo({
|
||||
success: res => {
|
||||
console.log('当前平台:' + res.platform);
|
||||
if (res.platform == 'android') {
|
||||
if (res.platform =='android') {
|
||||
_this.updateHandler(version);
|
||||
}
|
||||
}
|
||||
@@ -166,6 +166,7 @@
|
||||
@import "@/uni_modules/uview-ui/index.scss";
|
||||
/*公共css */
|
||||
@import '@/static/style/coreCommon.scss';
|
||||
@import "@/static/style/tags";
|
||||
|
||||
// vue App的样式
|
||||
/* #ifdef APP-PLUS */
|
||||
@@ -39,18 +39,24 @@ const install = (Vue, vm) => {
|
||||
let categories = (params, config = {}) => http.post('/Api/Good/GetAllCategories', params, { custom: { methodName: 'categories.getallcat', needToken: false } });
|
||||
// 获取商品列表
|
||||
let goodsList = (params, config = {}) => http.post('/Api/Good/GetGoodsPageList', params, { custom: { methodName: 'goods.goodsList', needToken: false } });
|
||||
// 获取商品详情
|
||||
let goodsDetail = (params, config = {}) => http.post('/Api/Good/GetDetial', params, { custom: { methodName: 'goods.getdetial', needToken: false } });
|
||||
//获取随机推荐商品
|
||||
let getGoodsRecommendList = (params, config = {}) => http.post('/Api/Good/GetGoodsRecommendList', params, { custom: { methodName: 'goods.getGoodsRecommendList', needToken: false } });
|
||||
// 获取商品详情
|
||||
let goodsDetailByToken = (params, config = {}) => http.post('/Api/Good/GetDetialByToken', params, { custom: { methodName: 'goods.getDetialByToken', needToken: true } });
|
||||
// 获取商品参数信息
|
||||
let goodsParams = (params, config = {}) => http.post('/Api/Good/GetGoodsParams', params, { custom: { methodName: 'goods.getgoodsparams', needToken: false } });
|
||||
// 获取设置默认货品
|
||||
let getProductInfo = (params, config = {}) => http.post('/Api/Good/GetProductInfo', params, { custom: { methodName: 'goods.getproductinfo', needToken: false } });
|
||||
// 获取商品评论信息
|
||||
let goodsComment = (params, config = {}) => http.post('/Api/Good/GetGoodsComment', params, { custom: { methodName: 'goods.getgoodscomment', needToken: false } });
|
||||
// 获取商品详情
|
||||
let goodsDetail = (params, config = {}) => http.post('/Api/Good/GetDetial', params, { custom: { methodName: 'goods.getdetial', needToken: false } });
|
||||
// 获取商品详情
|
||||
let goodsDetailByToken = (params, config = {}) => http.post('/Api/Good/GetDetialByToken', params, { custom: { methodName: 'goods.getDetialByToken', needToken: true } });
|
||||
|
||||
// 获取商品详情
|
||||
let goodsSku = (params, config = {}) => http.post('/Api/Good/GetSku', params, { custom: { methodName: 'goods.getdetial', needToken: false } });
|
||||
// 获取商品详情
|
||||
let goodsSkuByToken = (params, config = {}) => http.post('/Api/Good/GetSkuByToken', params, { custom: { methodName: 'goods.getDetialByToken', needToken: true } });
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -429,6 +435,8 @@ const install = (Vue, vm) => {
|
||||
goodsParams,
|
||||
getProductInfo,
|
||||
goodsComment,
|
||||
goodsSku,
|
||||
goodsSkuByToken,
|
||||
|
||||
addCart,
|
||||
removeCart,
|
||||
@@ -8,7 +8,7 @@ module.exports = (vm) => {
|
||||
/* defaultConfig 为默认全局配置 */
|
||||
defaultConfig.baseURL = apiBaseUrl; /* 根域名 */
|
||||
//defaultConfig.header = {
|
||||
// 'Content-type': 'application/json'
|
||||
// 'Content-type': 'application/json1'
|
||||
//};
|
||||
defaultConfig.method = 'POST';
|
||||
defaultConfig.dataType = 'json';
|
||||
@@ -4,7 +4,8 @@
|
||||
*/
|
||||
|
||||
//接口请求地址,如果需要不部署接口端的情况下测试uni-app,可以直接替换为官方测试接口:https://api.demo.coreshop.cn
|
||||
export const apiBaseUrl = 'https://api.pro.coreshop.cn';
|
||||
//export const apiBaseUrl = 'https://api.pro.coreshop.cn';
|
||||
export const apiBaseUrl = 'http://localhost:2015';
|
||||
//项目静态资源请求地址,如果使用官方的静态文件地址可以直接替换为:https://files.cdn.coreshop.cn
|
||||
export const apiFilesUrl = 'https://files.cdn.coreshop.cn';
|
||||
|
||||
@@ -23,7 +24,7 @@ export const paymentType = {
|
||||
//团购订单
|
||||
group: 3,
|
||||
//秒杀订单
|
||||
skill: 4,
|
||||
seckill: 4,
|
||||
|
||||
//砍价
|
||||
bargain: 6,
|
||||
@@ -75,6 +76,7 @@ export const shareType = {
|
||||
};
|
||||
|
||||
|
||||
|
||||
// #ifdef MP-TOUTIAO
|
||||
export const ttPlatform = 'toutiao'; //toutiao=今日头条小程序, douyin=抖音小程序, pipixia=皮皮虾小程序, huoshan=火山小视频小程序
|
||||
// #endif
|
||||
@@ -87,4 +89,4 @@ export const navLinkType = {
|
||||
article: 3,// "文章"
|
||||
articleCategory: 4,// "文章分类",
|
||||
intelligentForms: 5// "智能表单"
|
||||
};
|
||||
};
|
||||
@@ -23,7 +23,7 @@
|
||||
}
|
||||
},
|
||||
created() {
|
||||
console.log(this.codes);
|
||||
//console.log(this.codes);
|
||||
this.getData();
|
||||
},
|
||||
methods: {
|
||||
@@ -1,13 +1,14 @@
|
||||
<template>
|
||||
<view class="coreshop-copyright">
|
||||
<view class="coreshop-font-xs" v-if="shopName">
|
||||
© {{shopName}} 品牌运营
|
||||
</view>
|
||||
<view class="coreshop-font-xs" v-if="shopBeiAn">
|
||||
<view>备案号:{{shopBeiAn}}</view>
|
||||
</view>
|
||||
<view class="coreshop-font-xs">
|
||||
Powered by CoreShop
|
||||
<!--© {{shopName}} 品牌运营-->
|
||||
© 小小助农 品牌运营
|
||||
</view>
|
||||
<!--<view class="coreshop-font-xs" v-if="shopBeiAn">
|
||||
<view>备案号:{{shopBeiAn}}</view>
|
||||
</view>-->
|
||||
<view class="coreshop-font-xs">
|
||||
软件技术支持:怀化南山田舍科技有限公司
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<!-- 首页标题栏,轮播图整合插件 -->
|
||||
<view class="banner-swiper-wrap">
|
||||
<!-- 标题栏 -->
|
||||
<view class="u-navbar u-navbar-fixed" :style="[navbarStyle]">
|
||||
<view class="u-status-bar" :style="{ height: statusBarHeight + 'px' }"></view>
|
||||
<view class="u-navbar-inner" :style="[navbarInnerStyle]">
|
||||
<view class="u-back-wrap">
|
||||
<view class="u-icon-wrap u-back-text u-line-1 coreshop-text-white coreshop-font-20">
|
||||
<u--image :showLoading="true" src="/static/images/logo/logo2.png" width="223px" height="50px"></u--image>
|
||||
</view>
|
||||
</view>
|
||||
<view hover-class="hover-search" class="search-box coreshop-flex u-row-center u-col-center coreshop-margin-right-10" @tap="goSearch">
|
||||
<u-icon name="search" color="#fff" size="24"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 获取系统状态栏的高度
|
||||
let systemInfo = uni.getSystemInfoSync();
|
||||
let menuButtonInfo = {};
|
||||
// #ifdef MP-WEIXIN || MP-BAIDU || MP-TOUTIAO || MP-QQ
|
||||
menuButtonInfo = uni.getMenuButtonBoundingClientRect();
|
||||
// #endif
|
||||
/**
|
||||
* home-head-轮播卡片,主要为了处理数据
|
||||
* @property {Array} list 轮播图数据,
|
||||
* @property {String} mode 指示器模式
|
||||
*/
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
navBgImage: '',
|
||||
changeNavBackground: false,
|
||||
swiperCur: 0,
|
||||
statusBarHeight: systemInfo.statusBarHeight
|
||||
};
|
||||
},
|
||||
props: {
|
||||
coreshopdata: {
|
||||
// type: Object,
|
||||
required: true,
|
||||
},
|
||||
isScorll: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
isScorll(newValue, oldValue) {
|
||||
this.changeNavBackground = newValue;
|
||||
this.navBgImage = this.coreshopdata.parameters.list[this.swiperCur].image;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 导航栏内部盒子的样式
|
||||
navbarInnerStyle() {
|
||||
let style = {};
|
||||
style.height = this.navbarHeight + 'px';
|
||||
// #ifdef MP
|
||||
let rightButtonWidth = systemInfo.windowWidth - menuButtonInfo.left;
|
||||
style.marginRight = rightButtonWidth + 'px';
|
||||
// #endif
|
||||
return style;
|
||||
},
|
||||
// 整个导航栏的样式
|
||||
navbarStyle() {
|
||||
let style = {};
|
||||
style.zIndex = this.$u.zIndex.navbar;
|
||||
style.background = this.changeNavBackground ? `url(${this.navBgImage}) no-repeat top / 100% auto` : 'none';
|
||||
Object.assign(style, this.background);
|
||||
return style;
|
||||
},
|
||||
navbarHeight() {
|
||||
// #ifdef APP-PLUS || H5
|
||||
return 44;
|
||||
// #endif
|
||||
// #ifdef MP
|
||||
return systemInfo.platform == 'ios' ? 44 : 48;
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.navBgImage = this.coreshopdata.parameters.list[0].image;
|
||||
},
|
||||
methods: {
|
||||
onSwiper(e) {
|
||||
var item = this.coreshopdata.parameters.list[e];
|
||||
if (item) {
|
||||
this.showSliderInfo(item.linkType, item.linkValue);
|
||||
}
|
||||
},
|
||||
onChange(e) {
|
||||
this.swiperCur = e.detail.current;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@mixin vue-flex($direction: row) { /* #ifndef APP-NVUE */ display: flex; flex-direction: $direction; /* #endif */ }
|
||||
// 轮播
|
||||
.banner-swiper-wrap { height: 260px; position: relative; z-index: 100;
|
||||
.search-box { width: 25px; height: 25px; background: rgba(#000, 0.18); border-radius: 100%; justify-content: center; }
|
||||
.hover-search { background: rgba(#fff, 0.18); }
|
||||
}
|
||||
|
||||
.u-navbar { width: 100%; }
|
||||
.u-navbar-fixed { position: fixed; left: 0; right: 0; top: 0; z-index: 991; }
|
||||
.u-status-bar { width: 100%; }
|
||||
|
||||
.u-navbar-inner {
|
||||
@include vue-flex;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.u-back-wrap {
|
||||
@include vue-flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
flex-grow: 0;
|
||||
padding: 0px 7px 7px 5px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,52 @@
|
||||
<template>
|
||||
<view class="coreshop-bg-white">
|
||||
<u-swiper :list="swiperItems" :height="swiperHeight" :interval="swiperDuration" keyName="image" @click="taped" circular radius="0"></u-swiper>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopimgSlide",
|
||||
props: {
|
||||
coreshopdata: {
|
||||
// type: Object,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
swiperItems: [],
|
||||
swiperHeight: 130,
|
||||
swiperDuration: 2500,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
count() {
|
||||
return (this.coreshopdata.parameters.list.length > 0)
|
||||
}
|
||||
},
|
||||
components: {},
|
||||
created() {
|
||||
var data = this.coreshopdata.parameters.list;
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
let moder = {
|
||||
image: data[i].image == '/images/empty-banner.png' ? '/static/images/common/empty-banner.png' : data[i].image,
|
||||
opentype: 'click',
|
||||
url: '',
|
||||
title: data[i].linkType,
|
||||
linkType: data[i].linkType,
|
||||
linkValue: data[i].linkValue,
|
||||
}
|
||||
this.swiperItems.push(moder);
|
||||
}
|
||||
this.swiperHeight = this.coreshopdata.parameters.height;
|
||||
this.swiperDuration = this.coreshopdata.parameters.duration;
|
||||
},
|
||||
watch: {},
|
||||
methods: {
|
||||
taped: function (e) {
|
||||
this.showSliderInfo(this.swiperItems[e].linkType, this.swiperItems[e].linkValue);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,110 @@
|
||||
<template>
|
||||
<view>
|
||||
<block v-for="(item,index) in coreshopdata" :key="index">
|
||||
<!--搜索(修复)-->
|
||||
<coreshopsearch :coreshopdata="item" v-if="item.widgetCode=='search' "></coreshopsearch>
|
||||
<!--切换-->
|
||||
<coreshoptabbar :coreshopdata="item" v-if="item.widgetCode=='tabBar' "></coreshoptabbar>
|
||||
<!--公告(修复)-->
|
||||
<coreshopnotice :coreshopdata="item" v-if="item.widgetCode=='notice' "></coreshopnotice>
|
||||
<!--图片轮播(修复)-->
|
||||
<coreshopimgSlide :coreshopdata="item" v-if="item.widgetCode=='imgSlide' "></coreshopimgSlide>
|
||||
<!--优惠券(修复)-->
|
||||
<coreshopcoupon :coreshopdata="item" v-if="item.widgetCode=='coupon' "></coreshopcoupon>
|
||||
<!--空格(修复)-->
|
||||
<coreshopblank :coreshopdata="item" v-if="item.widgetCode=='blank' "></coreshopblank>
|
||||
<!--多行文本输入区(修复)-->
|
||||
<coreshoptextarea :coreshopdata="item" v-if="item.widgetCode=='textarea' "></coreshoptextarea>
|
||||
<!--视频(修复)-->
|
||||
<coreshopvideo :coreshopdata="item" v-if="item.widgetCode=='video' "></coreshopvideo>
|
||||
<!--图片集(修复)-->
|
||||
<coreshopimgWindow :coreshopdata="item" v-if="item.widgetCode=='imgWindow' "></coreshopimgWindow>
|
||||
<!--图片--(修复)-->
|
||||
<coreshopimgSingle :coreshopdata="item" v-if="item.widgetCode=='imgSingle' "></coreshopimgSingle>
|
||||
<!--商品(修复)-->
|
||||
<coreshopgoods :coreshopdata="item" v-if="item.widgetCode=='goods' "></coreshopgoods>
|
||||
<!--商品选项卡(修复)-->
|
||||
<coreshopgoodTabBar :coreshopdata="item" v-if="item.widgetCode=='goodTabBar' "></coreshopgoodTabBar>
|
||||
<!--文章(修复)-->
|
||||
<coreshoparticle :coreshopdata="item" v-if="item.widgetCode=='article' "></coreshoparticle>
|
||||
<!--文章分类(修复)-->
|
||||
<coreshoparticleClassify :coreshopdata="item" v-if="item.widgetCode=='articleClassify' "></coreshoparticleClassify>
|
||||
<!--宫格自定义导航(修复)-->
|
||||
<coreshopnavBar :coreshopdata="item" v-if="item.widgetCode=='navBar' "></coreshopnavBar>
|
||||
<!--团购(修复)-->
|
||||
<coreshopgroupPurchase :coreshopdata="item" v-if="item.widgetCode=='groupPurchase' "></coreshopgroupPurchase>
|
||||
<!--浏览记录(修复)-->
|
||||
<coreshoprecord :coreshopdata="item" v-if="item.widgetCode=='record' "></coreshoprecord>
|
||||
<!--拼团(修复)-->
|
||||
<coreshoppinTuan :coreshopdata="item" v-if="item.widgetCode=='pinTuan' "></coreshoppinTuan>
|
||||
<!--服务(修复)-->
|
||||
<coreshopservice :coreshopdata="item" v-if="item.widgetCode=='service' "></coreshopservice>
|
||||
<!--弹窗广告-->
|
||||
<coreshopadpop :coreshopdata="item" v-if="item.widgetCode=='adpop' "></coreshopadpop>
|
||||
<!--文本内容(修复)-->
|
||||
<coreshopContent :coreshopdata="item" v-if="item.widgetCode=='content' "></coreshopContent>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import coreshopimgSlide from '@/components/nsts-page/coreshop-imgSlide.vue'
|
||||
import coreshopsearch from '@/components/coreshop-page/coreshop-search.vue'
|
||||
import coreshopnotice from '@/components/coreshop-page/coreshop-notice.vue'
|
||||
import coreshopcoupon from '@/components/coreshop-page/coreshop-coupon.vue'
|
||||
import coreshopblank from '@/components/coreshop-page/coreshop-blank.vue'
|
||||
import coreshoptextarea from '@/components/coreshop-page/coreshop-textarea.vue'
|
||||
import coreshopvideo from '@/components/coreshop-page/coreshop-video.vue'
|
||||
import coreshopimgWindow from '@/components/coreshop-page/coreshop-imgWindow.vue'
|
||||
import coreshopimgSingle from '@/components/coreshop-page/coreshop-imgSingle.vue'
|
||||
import coreshopgoods from '@/components/coreshop-page/coreshop-goods.vue'
|
||||
import coreshopgoodTabBar from '@/components/coreshop-page/coreshop-goodTabBar.vue'
|
||||
import coreshoparticle from '@/components/coreshop-page/coreshop-article.vue'
|
||||
import coreshoparticleClassify from '@/components/coreshop-page/coreshop-articleClassify.vue'
|
||||
import coreshopnavBar from '@/components/coreshop-page/coreshop-navBar.vue'
|
||||
import coreshopgroupPurchase from '@/components/coreshop-page/coreshop-groupPurchase.vue'
|
||||
import coreshoprecord from '@/components/coreshop-page/coreshop-record.vue'
|
||||
import coreshoppinTuan from '@/components/coreshop-page/coreshop-pinTuan.vue'
|
||||
import coreshopservice from '@/components/coreshop-page/coreshop-service.vue'
|
||||
import coreshoptabbar from '@/components/coreshop-page/coreshop-tabbar.vue'
|
||||
import coreshopadpop from '@/components/coreshop-page/coreshop-adpop.vue'
|
||||
import coreshopContent from '@/components/coreshop-page/coreshop-content.vue'
|
||||
|
||||
export default {
|
||||
name: 'nsts-page',
|
||||
components: {
|
||||
coreshopimgSlide,
|
||||
coreshopsearch,
|
||||
coreshopnotice,
|
||||
coreshopcoupon,
|
||||
coreshopblank,
|
||||
coreshoptextarea,
|
||||
coreshopvideo,
|
||||
coreshopimgWindow,
|
||||
coreshopimgSingle,
|
||||
coreshopgoods,
|
||||
coreshopgoodTabBar,
|
||||
coreshoparticle,
|
||||
coreshoparticleClassify,
|
||||
coreshopnavBar,
|
||||
coreshopgroupPurchase,
|
||||
coreshoprecord,
|
||||
coreshoppinTuan,
|
||||
coreshopservice,
|
||||
coreshoptabbar,
|
||||
coreshopadpop,
|
||||
coreshopContent
|
||||
},
|
||||
props: {
|
||||
coreshopdata: {
|
||||
default: function () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
isScorll: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,456 @@
|
||||
<!-- 步进器 -->
|
||||
<template>
|
||||
<view class="vk-data-input-number-box">
|
||||
<view
|
||||
class="u-icon-minus"
|
||||
:class="{ 'u-icon-disabled': disabled || inputVal <= min }"
|
||||
:style="{
|
||||
background: bgColor,
|
||||
height: inputHeight + 'rpx',
|
||||
color: color,
|
||||
fontSize: size + 'rpx',
|
||||
minHeight: '1.4em'
|
||||
}"
|
||||
@touchstart.prevent="btnTouchStart('minus')"
|
||||
@touchend.stop.prevent="clearTimer"
|
||||
>
|
||||
<view :style="'font-size:' + (Number(size) + 10) + 'rpx'" class="num-btn">-</view>
|
||||
</view>
|
||||
<input
|
||||
v-model="inputVal"
|
||||
:disabled="disabledInput || disabled"
|
||||
:cursor-spacing="getCursorSpacing"
|
||||
:class="{ 'u-input-disabled': disabled }"
|
||||
class="u-number-input"
|
||||
type="number"
|
||||
:style="{
|
||||
color: color,
|
||||
fontSize: size + 'rpx',
|
||||
background: bgColor,
|
||||
height: inputHeight + 'rpx',
|
||||
width: inputWidth + 'rpx'
|
||||
}"
|
||||
@blur="onBlur"
|
||||
/>
|
||||
<view
|
||||
class="u-icon-plus"
|
||||
:class="{ 'u-icon-disabled': disabled || inputVal >= max }"
|
||||
:style="{
|
||||
background: bgColor,
|
||||
height: inputHeight + 'rpx',
|
||||
color: color,
|
||||
fontSize: size + 'rpx',
|
||||
minHeight: '1.4em'
|
||||
}"
|
||||
@touchstart.prevent="btnTouchStart('plus')"
|
||||
@touchend.stop.prevent="clearTimer"
|
||||
>
|
||||
<view :style="'font-size:' + (Number(size) + 10) + 'rpx'" class="num-btn">+</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
/**
|
||||
* numberBox 步进器(此为uview组件改造)
|
||||
* @description 该组件一般用于商城购物选择物品数量的场景。注意:该输入框只能输入大于或等于0的整数,不支持小数输入
|
||||
* @tutorial https://www.uviewui.com/components/numberBox.html
|
||||
* @property {Number} value 输入框初始值(默认1)
|
||||
* @property {String} bg-color 输入框和按钮的背景颜色(默认#F2F3F5)
|
||||
* @property {Number} min 用户可输入的最小值(默认0)
|
||||
* @property {Number} max 用户可输入的最大值(默认99999)
|
||||
* @property {Number} step 步长,每次加或减的值(默认1)
|
||||
* @property {Number} stepFirst 步进值,首次增加或最后减的值(默认step值和一致)
|
||||
* @property {Boolean} disabled 是否禁用操作,禁用后无法加减或手动修改输入框的值(默认false)
|
||||
* @property {Boolean} disabled-input 是否禁止输入框手动输入值(默认false)
|
||||
* @property {Boolean} positive-integer 是否只能输入正整数(默认true)
|
||||
* @property {String | Number} size 输入框文字和按钮字体大小,单位rpx(默认26)
|
||||
* @property {String} color 输入框文字和加减按钮图标的颜色(默认#323233)
|
||||
* @property {String | Number} input-width 输入框宽度,单位rpx(默认80)
|
||||
* @property {String | Number} input-height 输入框和按钮的高度,单位rpx(默认50)
|
||||
* @property {String | Number} index 事件回调时用以区分当前发生变化的是哪个输入框
|
||||
* @property {Boolean} long-press 是否开启长按连续递增或递减(默认true)
|
||||
* @property {String | Number} press-time 开启长按触发后,每触发一次需要多久,单位ms(默认250)
|
||||
* @property {String | Number} cursor-spacing 指定光标于键盘的距离,避免键盘遮挡输入框,单位rpx(默认200)
|
||||
* @event {Function} change 输入框内容发生变化时触发,对象形式
|
||||
* @event {Function} blur 输入框失去焦点时触发,对象形式
|
||||
* @event {Function} minus 点击减少按钮时触发(按钮可点击情况下),对象形式
|
||||
* @event {Function} plus 点击增加按钮时触发(按钮可点击情况下),对象形式
|
||||
* @example <vk-data-input-number-box :min="1" :max="100"></vk-data-input-number-box>
|
||||
*/
|
||||
export default {
|
||||
name: 'vk-data-input-number-box',
|
||||
emits: ['update:modelValue', 'input', 'change', 'blur', 'plus', 'minus'],
|
||||
props: {
|
||||
// 预显示的数字
|
||||
value: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
modelValue: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
// 背景颜色
|
||||
bgColor: {
|
||||
type: String,
|
||||
default: '#F2F3F5'
|
||||
},
|
||||
// 最小值
|
||||
min: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
// 最大值
|
||||
max: {
|
||||
type: Number,
|
||||
default: 99999
|
||||
},
|
||||
// 步进值,每次加或减的值
|
||||
step: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
// 步进值,首次增加或最后减的值
|
||||
stepFirst: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
// 是否只能输入 step 的倍数
|
||||
stepStrictly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 是否禁用加减操作
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// input的字体大小,单位rpx
|
||||
size: {
|
||||
type: [Number, String],
|
||||
default: 26
|
||||
},
|
||||
// 加减图标的颜色
|
||||
color: {
|
||||
type: String,
|
||||
default: '#323233'
|
||||
},
|
||||
// input宽度,单位rpx
|
||||
inputWidth: {
|
||||
type: [Number, String],
|
||||
default: 80
|
||||
},
|
||||
// input高度,单位rpx
|
||||
inputHeight: {
|
||||
type: [Number, String],
|
||||
default: 50
|
||||
},
|
||||
// index索引,用于列表中使用,让用户知道是哪个numberbox发生了变化,一般使用for循环出来的index值即可
|
||||
index: {
|
||||
type: [Number, String],
|
||||
default: ''
|
||||
},
|
||||
// 是否禁用输入框,与disabled作用于输入框时,为OR的关系,即想要禁用输入框,又可以加减的话
|
||||
// 设置disabled为false,disabledInput为true即可
|
||||
disabledInput: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 输入框于键盘之间的距离
|
||||
cursorSpacing: {
|
||||
type: [Number, String],
|
||||
default: 100
|
||||
},
|
||||
// 是否开启长按连续递增或递减
|
||||
longPress: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 开启长按触发后,每触发一次需要多久
|
||||
pressTime: {
|
||||
type: [Number, String],
|
||||
default: 250
|
||||
},
|
||||
// 是否只能输入大于或等于0的整数(正整数)
|
||||
positiveInteger: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
valueCom(v1, v2) {
|
||||
// 只有value的改变是来自外部的时候,才去同步inputVal的值,否则会造成循环错误
|
||||
if (!this.changeFromInner) {
|
||||
this.inputVal = v1;
|
||||
// 因为inputVal变化后,会触发this.handleChange(),在其中changeFromInner会再次被设置为true,
|
||||
// 造成外面修改值,也导致被认为是内部修改的混乱,这里进行this.$nextTick延时,保证在运行周期的最后处
|
||||
// 将changeFromInner设置为false
|
||||
this.$nextTick(function() {
|
||||
this.changeFromInner = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
inputVal(v1, v2) {
|
||||
// 为了让用户能够删除所有输入值,重新输入内容,删除所有值后,内容为空字符串
|
||||
if (v1 == '') return;
|
||||
let value = 0;
|
||||
// 首先判断是否数值,并且在min和max之间,如果不是,使用原来值
|
||||
let tmp = this.isNumber(v1);
|
||||
if (tmp && v1 >= this.min && v1 <= this.max) value = v1;
|
||||
else value = v2;
|
||||
// 判断是否只能输入大于等于0的整数
|
||||
if (this.positiveInteger) {
|
||||
// 小于0,或者带有小数点,
|
||||
if (v1 < 0 || String(v1).indexOf('.') !== -1) {
|
||||
value = v2;
|
||||
// 双向绑定input的值,必须要使用$nextTick修改显示的值
|
||||
this.$nextTick(() => {
|
||||
this.inputVal = v2;
|
||||
});
|
||||
}
|
||||
}
|
||||
// 发出change事件
|
||||
this.handleChange(value, 'change');
|
||||
},
|
||||
min(v1) {
|
||||
if (v1 !== undefined && v1 != '' && this.valueCom < v1) {
|
||||
this.$emit('input', v1);
|
||||
this.$emit('update:modelValue', v1);
|
||||
}
|
||||
},
|
||||
max(v1) {
|
||||
if (v1 !== undefined && v1 != '' && this.valueCom > v1) {
|
||||
this.$emit('input', v1);
|
||||
this.$emit('update:modelValue', v1);
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
inputVal: 1, // 输入框中的值,不能直接使用props中的value,因为应该改变props的状态
|
||||
timer: null, // 用作长按的定时器
|
||||
changeFromInner: false, // 值发生变化,是来自内部还是外部
|
||||
innerChangeTimer: null // 内部定时器
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.inputVal = Number(this.valueCom);
|
||||
},
|
||||
computed: {
|
||||
valueCom() {
|
||||
// #ifndef VUE3
|
||||
return this.value;
|
||||
// #endif
|
||||
|
||||
// #ifdef VUE3
|
||||
return this.modelValue;
|
||||
// #endif
|
||||
},
|
||||
getCursorSpacing() {
|
||||
// 先将值转为px单位,再转为数值
|
||||
return Number(uni.upx2px(this.cursorSpacing));
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 点击退格键
|
||||
btnTouchStart(callback) {
|
||||
// 先执行一遍方法,否则会造成松开手时,就执行了clearTimer,导致无法实现功能
|
||||
this[callback]();
|
||||
// 如果没开启长按功能,直接返回
|
||||
if (!this.longPress) return;
|
||||
clearInterval(this.timer); //再次清空定时器,防止重复注册定时器
|
||||
this.timer = null;
|
||||
this.timer = setInterval(() => {
|
||||
// 执行加或减函数
|
||||
this[callback]();
|
||||
}, this.pressTime);
|
||||
},
|
||||
clearTimer() {
|
||||
this.$nextTick(() => {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
});
|
||||
},
|
||||
minus() {
|
||||
this.computeVal('minus');
|
||||
},
|
||||
plus() {
|
||||
this.computeVal('plus');
|
||||
},
|
||||
// 为了保证小数相加减出现精度溢出的问题
|
||||
calcPlus(num1, num2) {
|
||||
let baseNum, baseNum1, baseNum2;
|
||||
try {
|
||||
baseNum1 = num1.toString().split('.')[1].length;
|
||||
} catch (e) {
|
||||
baseNum1 = 0;
|
||||
}
|
||||
try {
|
||||
baseNum2 = num2.toString().split('.')[1].length;
|
||||
} catch (e) {
|
||||
baseNum2 = 0;
|
||||
}
|
||||
baseNum = Math.pow(10, Math.max(baseNum1, baseNum2));
|
||||
let precision = baseNum1 >= baseNum2 ? baseNum1 : baseNum2; //精度
|
||||
return ((num1 * baseNum + num2 * baseNum) / baseNum).toFixed(precision);
|
||||
},
|
||||
// 为了保证小数相加减出现精度溢出的问题
|
||||
calcMinus(num1, num2) {
|
||||
let baseNum, baseNum1, baseNum2;
|
||||
try {
|
||||
baseNum1 = num1.toString().split('.')[1].length;
|
||||
} catch (e) {
|
||||
baseNum1 = 0;
|
||||
}
|
||||
try {
|
||||
baseNum2 = num2.toString().split('.')[1].length;
|
||||
} catch (e) {
|
||||
baseNum2 = 0;
|
||||
}
|
||||
baseNum = Math.pow(10, Math.max(baseNum1, baseNum2));
|
||||
let precision = baseNum1 >= baseNum2 ? baseNum1 : baseNum2;
|
||||
return ((num1 * baseNum - num2 * baseNum) / baseNum).toFixed(precision);
|
||||
},
|
||||
computeVal(type) {
|
||||
uni.hideKeyboard();
|
||||
if (this.disabled) return;
|
||||
let value = 0;
|
||||
// 新增stepFirst开始
|
||||
// 减
|
||||
if (type === 'minus') {
|
||||
if (this.stepFirst > 0 && this.inputVal == this.stepFirst) {
|
||||
value = this.min;
|
||||
} else {
|
||||
value = this.calcMinus(this.inputVal, this.step);
|
||||
}
|
||||
} else if (type === 'plus') {
|
||||
if (this.stepFirst > 0 && this.inputVal < this.stepFirst) {
|
||||
value = this.stepFirst;
|
||||
} else {
|
||||
value = this.calcPlus(this.inputVal, this.step);
|
||||
}
|
||||
}
|
||||
if (this.stepStrictly) {
|
||||
let strictly = value % this.step;
|
||||
if (strictly > 0) {
|
||||
value -= strictly;
|
||||
}
|
||||
}
|
||||
if (value > this.max) {
|
||||
value = this.max;
|
||||
} else if (value < this.min) {
|
||||
value = this.min;
|
||||
}
|
||||
// 新增stepFirst结束
|
||||
this.inputVal = value;
|
||||
this.handleChange(value, type);
|
||||
},
|
||||
// 处理用户手动输入的情况
|
||||
onBlur(event) {
|
||||
let val = 0;
|
||||
let value = event.detail.value;
|
||||
// 如果为非0-9数字组成,或者其第一位数值为0,直接让其等于min值
|
||||
// 这里不直接判断是否正整数,是因为用户传递的props min值可能为0
|
||||
if (!/(^\d+$)/.test(value) || value[0] == 0) val = this.min;
|
||||
val = +value;
|
||||
|
||||
// 新增stepFirst开始
|
||||
if (this.stepFirst > 0 && this.inputVal < this.stepFirst && this.inputVal > 0) {
|
||||
val = this.stepFirst;
|
||||
}
|
||||
// 新增stepFirst结束
|
||||
if (this.stepStrictly) {
|
||||
let strictly = val % this.step;
|
||||
if (strictly > 0) {
|
||||
val -= strictly;
|
||||
}
|
||||
}
|
||||
if (val > this.max) {
|
||||
val = this.max;
|
||||
} else if (val < this.min) {
|
||||
val = this.min;
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.inputVal = val;
|
||||
});
|
||||
this.handleChange(val, 'blur');
|
||||
},
|
||||
handleChange(value, type) {
|
||||
if (this.disabled) return;
|
||||
// 清除定时器,避免造成混乱
|
||||
if (this.innerChangeTimer) {
|
||||
clearTimeout(this.innerChangeTimer);
|
||||
this.innerChangeTimer = null;
|
||||
}
|
||||
// 发出input事件,修改通过v-model绑定的值,达到双向绑定的效果
|
||||
this.changeFromInner = true;
|
||||
// 一定时间内,清除changeFromInner标记,否则内部值改变后
|
||||
// 外部通过程序修改value值,将会无效
|
||||
this.innerChangeTimer = setTimeout(() => {
|
||||
this.changeFromInner = false;
|
||||
}, 150);
|
||||
this.$emit('input', Number(value));
|
||||
this.$emit('update:modelValue', Number(value));
|
||||
this.$emit(type, {
|
||||
// 转为Number类型
|
||||
value: Number(value),
|
||||
index: this.index
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 验证十进制数字
|
||||
*/
|
||||
isNumber(value) {
|
||||
return /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.vk-data-input-number-box {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.u-number-input {
|
||||
position: relative;
|
||||
text-align: center;
|
||||
padding: 0;
|
||||
margin: 0 6rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.u-icon-plus,
|
||||
.u-icon-minus {
|
||||
width: 60rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.u-icon-plus {
|
||||
border-radius: 0 8rpx 8rpx 0;
|
||||
}
|
||||
|
||||
.u-icon-minus {
|
||||
border-radius: 8rpx 0 0 8rpx;
|
||||
}
|
||||
|
||||
.u-icon-disabled {
|
||||
color: #c8c9cc !important;
|
||||
background: #f7f8fa !important;
|
||||
}
|
||||
|
||||
.u-input-disabled {
|
||||
color: #c8c9cc !important;
|
||||
background-color: #f2f3f5 !important;
|
||||
}
|
||||
.num-btn {
|
||||
font-weight: 550;
|
||||
position: relative;
|
||||
top: -4rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -18,9 +18,10 @@
|
||||
<link rel="stylesheet" href="<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css" />
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>Please enable JavaScript to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<noscript>
|
||||
<strong>Please enable JavaScript to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name" : "南山田舍测试号",
|
||||
"name" : "小小助农",
|
||||
"appid" : "__UNI__EAACF14",
|
||||
"description" : "核心商城系统(CoreShop)是基于uni-app框架开发的商城应用程序",
|
||||
"versionName" : "1.0",
|
||||
@@ -9,7 +9,8 @@
|
||||
/* 5+App特有相关 */
|
||||
"modules" : {
|
||||
"Payment" : {},
|
||||
"VideoPlayer" : {}
|
||||
"VideoPlayer" : {},
|
||||
"Maps" : {}
|
||||
},
|
||||
/* 模块配置 */
|
||||
"distribute" : {
|
||||
@@ -50,16 +51,19 @@
|
||||
"payment" : {
|
||||
"weixin" : {
|
||||
"appid" : "wx11d95cdaee6058f6"
|
||||
},
|
||||
"alipay" : {
|
||||
"scheme" : ""
|
||||
}
|
||||
},
|
||||
"ad" : {},
|
||||
"maps" : {},
|
||||
"maps" : {
|
||||
"amap" : {
|
||||
"appkey_ios" : "91b94ecb48605c4e048aa1971459eca7",
|
||||
"appkey_android" : "91b94ecb48605c4e048aa1971459eca7"
|
||||
}
|
||||
},
|
||||
"oauth" : {
|
||||
"univerify" : {}
|
||||
}
|
||||
},
|
||||
"share" : {}
|
||||
},
|
||||
"icons" : {
|
||||
"android" : {
|
||||
@@ -102,7 +106,7 @@
|
||||
"quickapp" : {},
|
||||
/* 快应用特有相关 */
|
||||
"mp-weixin" : {
|
||||
"appid" : "wxa53f990d87cb6cc3",
|
||||
"appid" : "wx6fc139d4de0b470f",
|
||||
"setting" : {
|
||||
"urlCheck" : true,
|
||||
"postcss" : true,
|
||||
@@ -127,7 +131,7 @@
|
||||
},
|
||||
"h5" : {
|
||||
"title" : "南山田舍",
|
||||
"domain" : "https://h5.demo.coreshop.cn",
|
||||
"domain" : "https://h5.coreshop.coreshop.net",
|
||||
"router" : {
|
||||
"base" : "./",
|
||||
"mode" : "hash"
|
||||
@@ -27,6 +27,17 @@
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/designDefault/designDefault",
|
||||
"style": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "设计页面",
|
||||
// #ifdef H5
|
||||
"titleNView": false,
|
||||
// #endif
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/cart/cart",
|
||||
"style": {
|
||||
@@ -71,7 +71,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-solid-bottom coreshop-margin-top-10 coreshop-margin-bottom-10" v-if="serviceDescription.delivery.length>0" />
|
||||
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-padding-top-10" @tap="selectTap(0)" v-if="isSpes">
|
||||
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-padding-top-10" @tap="openSkuPopup">
|
||||
<view class="coreshop-basis-1">
|
||||
<text class="coreshop-text-gray">规格</text>
|
||||
</view>
|
||||
@@ -262,7 +262,7 @@
|
||||
</view>
|
||||
|
||||
|
||||
<u-popup class="coreshop-bottom-popup-box" :show="bottomModal" mode="bottom" height="70%" @close="hideModal" :closeable="true">
|
||||
<u-popup class="coreshop-bottom-popup-box" :show="bottomModal" mode="bottom" height="70%" @close="hideModal" :closeable="true">
|
||||
<view class="radius coreshop-bg-white">
|
||||
<!--标题-->
|
||||
<view class="coreshop-text-black coreshop-text-center coreshop-margin-top-15 coreshop-margin-bottom-15 coreshop-font-lg coreshop-title-bar">
|
||||
@@ -281,7 +281,6 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!--促销区域-->
|
||||
<view class="coreshop-common-view-box promotion" v-if="modalType=='promotion'">
|
||||
<view class="text-view" v-for="(item, index) in promotion" :key="index">
|
||||
@@ -289,42 +288,6 @@
|
||||
<text class="coreshop-margin-left-10 u-line-5 coreshop-text-black">{{item.name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!--选择规格-->
|
||||
<view class="coreshop-common-view-box select hide" :class="modalType=='select' ?'show':''">
|
||||
<!--商品信息-->
|
||||
<view class="coreshop-list menu-avatar">
|
||||
<view class="coreshop-list-item">
|
||||
<view class="coreshop-avatar radius lg" :style="[{backgroundImage:'url('+ product.images +')'}] " />
|
||||
<view class="content">
|
||||
<view class="coreshop-text-price-view">
|
||||
<text class="coreshop-text-price coreshop-text-red coreshop-margin-right-10">{{ product.price || ''}}</text>
|
||||
<text class="coreshop-font-sm coreshop-text-gray coreshop-text-through">¥{{ product.mktprice || ''}}</text>
|
||||
<!--<u-tag text="秒杀中" mode="plain" type="error" shape="circle" size="mini" />-->
|
||||
</view>
|
||||
<view class="coreshop-text-black coreshop-font-sm flex">
|
||||
<view class="u-line-2">已选: {{ product.spesDesc || '无'}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!--规格数据-->
|
||||
<view class="coreshop-select-btn-list-box">
|
||||
<coreshop-spec :spesData="defaultSpesDesc" ref="spec" @changeSpes="changeSpes"></coreshop-spec>
|
||||
<view class="select-item">
|
||||
<view class="coreshop-text-black">数量</view>
|
||||
<view class="select-btn">
|
||||
<u-number-box v-model="buyNum" :min="minNums" :max="product.stock"></u-number-box>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!--公共按钮-->
|
||||
<view class="coreshop-padding-15 coreshop-text-center" v-if="modalType=='select'">
|
||||
<u-button type="error" :custom-style="customStyle" size="normal" @click="clickHandle()" :disabled='submitStatus' :loading='submitStatus' v-if="product.stock>0" shape="circle">确定</u-button>
|
||||
<u-button type="default" size="normal" v-else>已售罄</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
@@ -361,16 +324,26 @@
|
||||
</view>
|
||||
<view class="action" @click="redirectCart">
|
||||
<button class="noButtonStyle">
|
||||
<u-badge type="warning" :value="cartNums" showZero="false" absolute="true" :offset="[1, 4]"></u-badge>
|
||||
<u-icon name="shopping-cart" :size="20" label="购物车" :labelSize="12" labelPos="bottom"></u-icon>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn-group coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-basis-5">
|
||||
<u-button type="error" size="normal" @click="selectTap()" shape="circle" color="#f37b1d">立即{{ typeName || '' }}</u-button>
|
||||
<u-button type="error" size="normal" @click="openSkuPopup" shape="circle" color="#f37b1d">立即团购</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<vk-data-goods-sku-popup ref="skuPopup"
|
||||
v-model="skuKey"
|
||||
border-radius="20"
|
||||
:amount-type="0"
|
||||
:localdata="goodsSkuInfo"
|
||||
mode="3"
|
||||
@add-cart="addCart"
|
||||
@buy-now="buyNow"></vk-data-goods-sku-popup>
|
||||
|
||||
<!-- 右边浮动球 -->
|
||||
<coreshop-fab horizontal="right" vertical="bottom" direction="vertical"></coreshop-fab>
|
||||
<!-- 登录提示 -->
|
||||
@@ -384,9 +357,10 @@
|
||||
|
||||
data() {
|
||||
return {
|
||||
background: {
|
||||
backgroundColor: '#f37b1d'
|
||||
},
|
||||
// 是否打开SKU弹窗
|
||||
skuKey: false,
|
||||
// 后端返回的商品信息
|
||||
goodsSkuInfo: {},
|
||||
goodsId: 0, // 商品id
|
||||
groupId: 0, // 团购ID
|
||||
goodsInfo: {}, // 商品详情
|
||||
@@ -396,8 +370,6 @@
|
||||
goodsComments: [], // 商品评论信息
|
||||
shopRecommendData: [], // 本店推荐数据
|
||||
otherRecommendData: [], // 其他数据
|
||||
buyNum: 1, // 选定的购买数量
|
||||
minBuyNum: 1, // 最小可购买数量
|
||||
type: 2,
|
||||
cartType: this.$globalConstVars.paymentType.group,
|
||||
isfav: false, // 商品是否收藏
|
||||
@@ -470,23 +442,6 @@
|
||||
shopMobile() {
|
||||
return this.$store.state.config.shopMobile || 0;
|
||||
},
|
||||
// 规格切换计算规格商品的 可购买数量
|
||||
minNums() {
|
||||
var num = this.product.stock > 0 ? this.product.stock : 0;
|
||||
return num > this.minBuyNum ? this.minBuyNum : num;
|
||||
},
|
||||
// 判断商品是否是多规格商品 (为了兼容小程序 只能写在计算属性里面了)
|
||||
isSpes() {
|
||||
if (this.product.hasOwnProperty('defaultSpecificationDescription') && this.product.defaultSpecificationDescription != null && Object.keys(this.product.defaultSpecificationDescription).length) {
|
||||
if (this.product.defaultSpecificationDescription != null && this.product.defaultSpecificationDescription != "" && this.product.defaultSpecificationDescription != undefined) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
// 优惠信息重新组装
|
||||
promotion() {
|
||||
let arr = [];
|
||||
@@ -497,9 +452,6 @@
|
||||
}
|
||||
return arr;
|
||||
},
|
||||
typeName() {
|
||||
return this.goodsInfo.groupType == 3 ? '团购' : '秒杀';
|
||||
},
|
||||
shareHref() {
|
||||
let pages = getCurrentPages();
|
||||
let page = pages[pages.length - 1];
|
||||
@@ -509,12 +461,48 @@
|
||||
// #ifdef MP-ALIPAY
|
||||
return this.$globalConstVars.apiBaseUrl + 'wap/' + page.__proto__.route + '?id=' + this.goodsId + '&groupId=' + this.groupId;
|
||||
// #endif
|
||||
},
|
||||
defaultSpesDesc() {
|
||||
return this.product.defaultSpecificationDescription;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 打开sku弹出
|
||||
openSkuPopup() {
|
||||
this.skuKey = true;
|
||||
},
|
||||
closeSkuPopup() {
|
||||
this.skuKey = false;
|
||||
},
|
||||
// 立即购买
|
||||
buyNow(selectShop) {
|
||||
var that = this;
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
if (!this.hasLogin) {
|
||||
uni.hideLoading();
|
||||
this.$store.commit('showLoginTip', true);
|
||||
return false;
|
||||
}
|
||||
if (selectShop.buy_num > 0) {
|
||||
let data = {
|
||||
ProductId: selectShop._id,
|
||||
Nums: selectShop.buy_num,
|
||||
type: this.type,
|
||||
cartType: this.cartType,
|
||||
objectId: this.groupId
|
||||
};
|
||||
this.$u.api.addCart(data).then(res => {
|
||||
if (res.status) {
|
||||
let cartIds = res.data;
|
||||
this.$u.route('/pages/placeOrder/index/index?cartIds=' + JSON.stringify(cartIds) + '&orderType=' + this.cartType + '&objectId=' + this.groupId);
|
||||
uni.hideLoading();
|
||||
} else {
|
||||
this.$u.toast(res.msg);
|
||||
uni.hideLoading();
|
||||
}
|
||||
});
|
||||
}
|
||||
that.closeSkuPopup();
|
||||
},
|
||||
getServiceDescription() {
|
||||
let _this = this;
|
||||
this.$u.api.getServiceDescription().then(res => {
|
||||
@@ -538,12 +526,14 @@
|
||||
getGoodsInfo() {
|
||||
let data = {
|
||||
id: this.goodsId,
|
||||
groupId: this.groupId
|
||||
groupId: this.groupId,
|
||||
type: "group",
|
||||
needSku: true,
|
||||
};
|
||||
// 如果用户已经登录 要传用户token
|
||||
let userToken = this.$db.get('userToken');
|
||||
if (userToken) {
|
||||
data['token'] = userToken;
|
||||
data.token = userToken;
|
||||
}
|
||||
let _this = this;
|
||||
this.$u.api.groupInfo(data).then(res => {
|
||||
@@ -566,8 +556,9 @@
|
||||
});
|
||||
} else {
|
||||
let info = res.data;
|
||||
let products = res.data.product;
|
||||
_this.product = res.data.product;
|
||||
_this.goodsInfo = info;
|
||||
this.goodsSkuInfo = res.data.skuList;
|
||||
|
||||
if (_this.goodsInfo.album) {
|
||||
var albums = [];
|
||||
@@ -592,9 +583,6 @@
|
||||
|
||||
_this.isfav = _this.goodsInfo.isfav;
|
||||
_this.type = _this.goodsInfo.groupType;
|
||||
_this.product = _this.spesClassHandle(products);
|
||||
|
||||
_this.buyNum = _this.product.stock >= _this.minBuyNum ? _this.minBuyNum : 0;
|
||||
|
||||
// 判断如果登录用户添加商品浏览足迹
|
||||
if (userToken) {
|
||||
@@ -630,8 +618,6 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
// 获取购物车数量
|
||||
getCartNums() {
|
||||
let userToken = this.$db.get('userToken');
|
||||
@@ -644,61 +630,6 @@
|
||||
});
|
||||
}
|
||||
},
|
||||
// 切换商品规格
|
||||
changeSpes(obj) {
|
||||
let index = obj.v;
|
||||
let key = obj.k;
|
||||
let tmp_defaultSpecificationDescription = JSON.parse(this.product.defaultSpecificationDescription);
|
||||
if (tmp_defaultSpecificationDescription[index][key].hasOwnProperty('productId') && tmp_defaultSpecificationDescription[index][key].productId) {
|
||||
let data = {
|
||||
id: tmp_defaultSpecificationDescription[index][key].productId,
|
||||
type: 'group', //商品类型
|
||||
groupId: this.groupId
|
||||
};
|
||||
let userToken = this.$db.get('userToken');
|
||||
if (userToken) {
|
||||
data['token'] = userToken;
|
||||
}
|
||||
this.$u.api.getProductInfo(data).then(res => {
|
||||
if (res.status == true) {
|
||||
// 切换规格判断可购买数量
|
||||
this.buyNum = res.data.stock > this.minBuyNum ? this.minBuyNum : res.data.stock;
|
||||
this.product = this.spesClassHandle(res.data);
|
||||
}
|
||||
});
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
setTimeout(function () {
|
||||
uni.hideLoading();
|
||||
}, 1000);
|
||||
}
|
||||
},
|
||||
// 多规格样式统一处理
|
||||
spesClassHandle(products) {
|
||||
// 判断是否是多规格 (是否有默认规格)
|
||||
if (products.hasOwnProperty('defaultSpecificationDescription')) {
|
||||
let spes = products.defaultSpecificationDescription;
|
||||
for (let key in spes) {
|
||||
for (let i in spes[key]) {
|
||||
if (spes[key][i].hasOwnProperty('isDefault') && spes[key][i].isDefault === true) {
|
||||
this.$set(spes[key][i], 'cla', 'selected');
|
||||
} else if (spes[key][i].hasOwnProperty('productId') && spes[key][i].productId) {
|
||||
this.$set(spes[key][i], 'cla', 'not-selected');
|
||||
} else {
|
||||
this.$set(spes[key][i], 'cla', 'none');
|
||||
}
|
||||
}
|
||||
}
|
||||
spes = JSON.stringify(spes)
|
||||
products.defaultSpecificationDescription = spes;
|
||||
}
|
||||
return products;
|
||||
},
|
||||
// 购买数量加减操作
|
||||
bindChange(e) {
|
||||
this.buyNum = e.val;
|
||||
},
|
||||
// 商品收藏/取消
|
||||
collection() {
|
||||
let data = {
|
||||
@@ -743,7 +674,6 @@
|
||||
});
|
||||
this.goodsComments = [...this.goodsComments, ..._list];
|
||||
} else {
|
||||
console.log("错误2");
|
||||
this.$u.toast(res.msg);
|
||||
}
|
||||
})
|
||||
@@ -764,42 +694,6 @@
|
||||
this.submitStatus = true;
|
||||
this.buyNow();
|
||||
},
|
||||
// 立即购买
|
||||
buyNow() {
|
||||
if (this.buyNum > 0) {
|
||||
let data = {
|
||||
ProductId: this.product.id,
|
||||
Nums: this.buyNum,
|
||||
type: this.type,
|
||||
cartType: this.cartType,
|
||||
objectId: this.groupId
|
||||
};
|
||||
this.$u.api.addCart(data).then(res => {
|
||||
if (res.status) {
|
||||
this.hideModal(); // 关闭弹出层
|
||||
let cartIds = res.data;
|
||||
this.$u.route('/pages/placeOrder/index/index?cartIds=' + JSON.stringify(cartIds) + '&orderType=' + this.cartType + '&objectId=' + this.groupId);
|
||||
|
||||
} else {
|
||||
this.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 购物车页面跳转
|
||||
redirectCart() {
|
||||
this.$u.route({
|
||||
type: 'switchTab',
|
||||
url: '/pages/index/cart/cart'
|
||||
});
|
||||
},
|
||||
trigger(e) {
|
||||
this.content[e.index].active = !e.item.active;
|
||||
this.$u.route({
|
||||
type: 'switchTab',
|
||||
url: e.item.url
|
||||
});
|
||||
},
|
||||
// 跳转到h5分享页面
|
||||
goShare() {
|
||||
this.shareBox = true;
|
||||
@@ -815,47 +709,13 @@
|
||||
});
|
||||
}
|
||||
},
|
||||
//在线客服,只有手机号的,请自己替换为手机号
|
||||
//在线客服
|
||||
showChat() {
|
||||
// #ifdef H5
|
||||
let _this = this;
|
||||
window._AIHECONG('ini', {
|
||||
entId: this.config.entId,
|
||||
button: false,
|
||||
appearance: {
|
||||
panelMobile: {
|
||||
tone: '#FF7159',
|
||||
sideMargin: 30,
|
||||
ratio: 'part',
|
||||
headHeight: 50
|
||||
}
|
||||
}
|
||||
});
|
||||
//传递客户信息
|
||||
window._AIHECONG('customer', {
|
||||
head: _this.userInfo.avatar,
|
||||
名称: _this.userInfo.nickname,
|
||||
手机: _this.userInfo.mobile
|
||||
});
|
||||
window._AIHECONG('showChat');
|
||||
// #endif
|
||||
// 客服页面
|
||||
// #ifdef APP-PLUS || APP-PLUS-NVUE
|
||||
this.$u.route('/pages/member/customerService/index');
|
||||
// #endif
|
||||
// 头条系客服
|
||||
// #ifdef MP-TOUTIAO
|
||||
if (this.shopMobile != 0) {
|
||||
let _this = this;
|
||||
tt.makePhoneCall({
|
||||
phoneNumber: this.shopMobile.toString(),
|
||||
success(res) { },
|
||||
fail(res) { }
|
||||
});
|
||||
} else {
|
||||
_this.$u.toast('暂无设置客服电话');
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
//获取分享URL
|
||||
getShareUrl() {
|
||||
@@ -887,12 +747,6 @@
|
||||
this.modalType = 'promotion';
|
||||
this.showModal();
|
||||
},
|
||||
// 显示modal弹出框
|
||||
selectTap() {
|
||||
this.modalTitle = "选择规格";
|
||||
this.modalType = 'select';
|
||||
this.showModal();
|
||||
},
|
||||
showModal() {
|
||||
this.bottomModal = true;
|
||||
},
|
||||
@@ -1,6 +1,3 @@
|
||||
.goods-item { margin-bottom: 1px;
|
||||
.progress-text { color: #999999; font-size: 10px; margin-left: 12px; }
|
||||
}
|
||||
.activity-goods-box {
|
||||
.goods-right { width: 240px; }
|
||||
}
|
||||
}
|
||||
@@ -19,12 +19,12 @@
|
||||
</view>
|
||||
<view class="group-box">
|
||||
<view class="goods-item" v-for="(item, index) in goodsList" :key="item.id" v-if="goodsList.length>0">
|
||||
<view class="activity-goods-box coreshop-flex coreshop-justify-between">
|
||||
<view class="activity-goods-box coreshop-flex coreshop-justify-start">
|
||||
<view class="img-box">
|
||||
<view class="tag" v-if="index < 3">TOP{{ index + 1 }}</view>
|
||||
<u--image :src="item.image" mode="widthFix" width="100%" height="104px" radius="10"></u--image>
|
||||
</view>
|
||||
<view class="goods-right coreshop-flex coreshop-justify-between coreshop-flex-direction">
|
||||
<view class="goods-right coreshop-flex coreshop-flex-direction">
|
||||
<view class="title u-line-2">{{ item.name }}</view>
|
||||
<view class="tip u-line-1">{{ item.brief }}</view>
|
||||
<view class="slod-end">
|
||||
@@ -36,13 +36,13 @@
|
||||
<text class="group-num">{{ item.pinTuanRule.peopleNumber || 0 }}人团</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-justify-between coreshop-margin-top-10">
|
||||
<view class="coreshop-flex coreshop-justify-between coreshop-margin-top-2">
|
||||
<view class="coreshop-flex coreshop-align-center">
|
||||
<view class="current">¥{{ item.pinTuanPrice }}</view>
|
||||
<view class="original">¥{{ item.price }}</view>
|
||||
</view>
|
||||
<button class="cu-btn buy-btn" @tap="goPinTuanDetail(item.id,item.pinTuanRule.id)">马上拼</button>
|
||||
</view>
|
||||
<button class="cu-btn buy-btn" @tap="goPinTuanDetail(item.id,item.pinTuanRule.id)">马上拼</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -401,7 +401,7 @@
|
||||
|
||||
<view class="action" @click="redirectCart">
|
||||
<button class="noButtonStyle">
|
||||
<u-badge class="car-num" :count="cartNums?cartNums:0" type="error" :offset="[-3, -6]"></u-badge>
|
||||
<u-badge type="warning" :value="cartNums" showZero="false" absolute="true" :offset="[1, 4]"></u-badge>
|
||||
<u-icon name="shopping-cart" :size="20" label="购物车" :labelSize="12" labelPos="bottom"></u-icon>
|
||||
</button>
|
||||
</view>
|
||||
@@ -436,7 +436,7 @@
|
||||
</view>
|
||||
|
||||
<!--弹出框-->
|
||||
<u-popup class="coreshop-bottom-popup-box" :show="bottomModal" mode="bottom" height="70%" @close="hideModal" :closeable="true">
|
||||
<u-popup class="coreshop-bottom-popup-box" :show="bottomModal" mode="bottom" height="70%" @close="hideModal" :closeable="true">
|
||||
<view class="radius coreshop-bg-white">
|
||||
<!--标题-->
|
||||
<view class="coreshop-text-black coreshop-text-center coreshop-margin-top-15 coreshop-margin-bottom-15 coreshop-font-lg coreshop-title-bar">
|
||||
@@ -463,41 +463,17 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!--选择规格-->
|
||||
<view class="coreshop-common-view-box select hide" :class="modalType=='select' ?'show':''">
|
||||
<!--商品信息-->
|
||||
<view class="coreshop-list menu-avatar">
|
||||
<view class="coreshop-list-item">
|
||||
<view class="coreshop-avatar radius lg" :style="[{backgroundImage:'url('+ product.images +')'}] " />
|
||||
<view class="content">
|
||||
<view class="coreshop-text-price-view">
|
||||
<text class="coreshop-text-price coreshop-text-red coreshop-margin-right-10">{{ product.price || ''}}</text>
|
||||
<text class="coreshop-font-sm coreshop-text-gray coreshop-text-through">¥{{ product.mktprice || ''}}</text>
|
||||
</view>
|
||||
<view class="coreshop-text-black coreshop-font-sm flex">
|
||||
<view class="u-line-2">已选: {{ product.spesDesc || product.name}} 库存:{{product.stock > 0 ? product.stock :0 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!--规格数据-->
|
||||
<view class="coreshop-select-btn-list-box">
|
||||
<coreshop-spec :spesData="defaultSpesDesc" ref="spec" @changeSpes="changeSpes"></coreshop-spec>
|
||||
<view class="coreshop-text-black coreshop-padding-top-10 coreshop-padding-bottom-10">数量</view>
|
||||
<view class="select-btn">
|
||||
<u-number-box v-model="buyNum" :min="minNums" :max="product.stock"></u-number-box>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!--公共按钮-->
|
||||
<view class="coreshop-padding-15 coreshop-text-center" v-if="modalType=='select'">
|
||||
<u-button type="error" size="default" @click="clickHandle()" :disabled='submitStatus' :loading='submitStatus' v-if="product.stock > 0" shape="circle">确定</u-button>
|
||||
<u-button type="default" size="normal" v-else>已售罄</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
|
||||
|
||||
<vk-data-goods-sku-popup v-model="skuKey" border-radius="20" :amount-type="0" :localdata="goodsSkuInfo" mode="3" @open="openSkuPopup" @close="closeSkuPopup" @buy-now="buyNow"></vk-data-goods-sku-popup>
|
||||
<vk-data-goods-sku-popup v-model="skuSingleKey" border-radius="20" :amount-type="0" :localdata="discountsGoodsSkuInfo" mode="3" @open="openSkuSinglePopup" @close="closeSkuSinglePopup" @buy-now="buyNow"></vk-data-goods-sku-popup>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- 右边浮动球 -->
|
||||
<coreshop-fab horizontal="right" vertical="bottom" direction="vertical"></coreshop-fab>
|
||||
<!-- 登录提示 -->
|
||||
@@ -513,7 +489,13 @@
|
||||
|
||||
data() {
|
||||
return {
|
||||
current: 0, // init tab位
|
||||
// 是否打开SKU弹窗
|
||||
skuKey: false,
|
||||
skuSingleKey: false,
|
||||
// 后端返回的商品信息
|
||||
goodsSkuInfo: {},
|
||||
discountsGoodsSkuInfo: {},
|
||||
|
||||
goodsId: 0, // 商品id
|
||||
pinTuanId: 0, // 团购ID
|
||||
goodsInfo: {}, // 商品详情
|
||||
@@ -523,8 +505,6 @@
|
||||
otherRecommendData: [], // 其他数据
|
||||
goodsParams: [], // 商品参数信息
|
||||
goodsComments: [], // 商品评论信息
|
||||
buyNum: 1, // 选定的购买数量
|
||||
minBuyNum: 1, // 最小可购买数量
|
||||
pinTuanType: 2, // 1单独购买 2拼团
|
||||
type: 2,
|
||||
cartType: this.$globalConstVars.paymentType.pinTuan,
|
||||
@@ -563,7 +543,6 @@
|
||||
};
|
||||
},
|
||||
onLoad(e) {
|
||||
console.log(e);
|
||||
this.goodsId = e.id;
|
||||
this.pinTuanId = e.pinTuanId;
|
||||
if (e.teamId && e.teamId > 0) {
|
||||
@@ -615,11 +594,6 @@
|
||||
shopMobile() {
|
||||
return this.$store.state.config.shopMobile || 0;
|
||||
},
|
||||
// 规格切换计算规格商品的 可购买数量
|
||||
minNums() {
|
||||
var num = this.product.stock > 0 ? this.product.stock : 0;
|
||||
return num > this.minBuyNum ? this.minBuyNum : num;
|
||||
},
|
||||
// 判断商品是否是多规格商品 (为了兼容小程序 只能写在计算属性里面了)
|
||||
isSpes() {
|
||||
if (this.product.hasOwnProperty('defaultSpecificationDescription') && this.product.defaultSpecificationDescription && Object.keys(this.product.defaultSpecificationDescription).length) {
|
||||
@@ -653,6 +627,56 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 打开sku弹出
|
||||
openSkuPopup() {
|
||||
this.skuKey = true;
|
||||
},
|
||||
closeSkuPopup() {
|
||||
this.skuKey = false;
|
||||
},
|
||||
openSkuSinglePopup() {
|
||||
this.skuSingleKey = true;
|
||||
},
|
||||
closeSkuSinglePopup() {
|
||||
this.skuSingleKey = false;
|
||||
},
|
||||
// 立即购买
|
||||
buyNow(selectShop) {
|
||||
var that = this;
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
if (!this.hasLogin) {
|
||||
uni.hideLoading();
|
||||
this.$store.commit('showLoginTip', true);
|
||||
return false;
|
||||
}
|
||||
if (selectShop.buy_num > 0) {
|
||||
let data = {
|
||||
ProductId: selectShop._id,
|
||||
Nums: selectShop.buy_num,
|
||||
type: 2,
|
||||
cartType: this.cartType,
|
||||
objectId: this.pinTuanId,
|
||||
teamId: this.teamId
|
||||
};
|
||||
this.$u.api.addCart(data).then(res => {
|
||||
if (res.status) {
|
||||
let cartIds = res.data;
|
||||
if (this.teamId == 0) {
|
||||
this.$u.route('/pages/placeOrder/index/index?cartIds=' + JSON.stringify(cartIds) + '&orderType=' + this.cartType + '&objectId=' + this.pinTuanId);
|
||||
} else {
|
||||
this.$u.route('/pages/placeOrder/index/index?cartIds=' + JSON.stringify(cartIds) + '&orderType=' + this.cartType + '&objectId=' + this.pinTuanId + '&teamId=' + this.teamId);
|
||||
}
|
||||
uni.hideLoading();
|
||||
} else {
|
||||
this.$u.toast(res.msg);
|
||||
uni.hideLoading();
|
||||
}
|
||||
});
|
||||
}
|
||||
that.closeSkuPopup();
|
||||
},
|
||||
getServiceDescription() {
|
||||
let _this = this;
|
||||
this.$u.api.getServiceDescription().then(res => {
|
||||
@@ -704,9 +728,17 @@
|
||||
});
|
||||
} else {
|
||||
let info = res.data;
|
||||
let products = res.data.product;
|
||||
this.product = res.data.product;
|
||||
|
||||
_this.goodsInfo = info;
|
||||
this.goodsSkuInfo = res.data.skuList;
|
||||
|
||||
let sku = uni.$u.deepClone(res.data.skuList);
|
||||
let discountAmount = res.data.pinTuanRule.discountAmount;
|
||||
for (var i = 0; i < sku.sku_list.length; i++) {
|
||||
sku.sku_list[i].price = sku.sku_list[i].price - discountAmount;
|
||||
}
|
||||
this.discountsGoodsSkuInfo = sku;
|
||||
|
||||
if (_this.goodsInfo.album) {
|
||||
var albums = [];
|
||||
@@ -730,9 +762,6 @@
|
||||
}
|
||||
|
||||
_this.discountAmount = parseFloat(info.pinTuanRule.discountAmount).toFixed(2);
|
||||
_this.product = _this.spesClassHandle(products);
|
||||
|
||||
_this.buyNum = _this.product.stock >= _this.minBuyNum ? _this.minBuyNum : 0;
|
||||
|
||||
_this.isfav = _this.goodsInfo.isfav;
|
||||
_this.price = _this.pinTuanPrice = _this.$common.moneySub(_this.product.price, _this.discountAmount);
|
||||
@@ -818,31 +847,6 @@
|
||||
});
|
||||
}
|
||||
},
|
||||
// 多规格样式统一处理
|
||||
spesClassHandle(products) {
|
||||
// 判断是否是多规格 (是否有默认规格)
|
||||
if (products.hasOwnProperty('defaultSpecificationDescription')) {
|
||||
let spes = products.defaultSpecificationDescription;
|
||||
for (let key in spes) {
|
||||
for (let i in spes[key]) {
|
||||
if (spes[key][i].hasOwnProperty('isDefault') && spes[key][i].isDefault === true) {
|
||||
this.$set(spes[key][i], 'cla', 'selected');
|
||||
} else if (spes[key][i].hasOwnProperty('productId') && spes[key][i].productId) {
|
||||
this.$set(spes[key][i], 'cla', 'not-selected');
|
||||
} else {
|
||||
this.$set(spes[key][i], 'cla', 'none');
|
||||
}
|
||||
}
|
||||
}
|
||||
spes = JSON.stringify(spes)
|
||||
products.defaultSpecificationDescription = spes;
|
||||
}
|
||||
return products;
|
||||
},
|
||||
// 购买数量加减操作
|
||||
bindChange(val) {
|
||||
this.buyNum = e.val;
|
||||
},
|
||||
// 商品收藏/取消
|
||||
collection() {
|
||||
let data = {
|
||||
@@ -900,49 +904,6 @@
|
||||
};
|
||||
this.$u.api.addGoodsBrowsing(data).then(res => { });
|
||||
},
|
||||
// 点击弹出框确定按钮事件处理
|
||||
clickHandle() {
|
||||
if (!this.hasLogin) {
|
||||
this.$store.commit('showLoginTip', true);
|
||||
return false;
|
||||
}
|
||||
this.submitStatus = true;
|
||||
this.buyNow();
|
||||
},
|
||||
// 立即购买
|
||||
buyNow() {
|
||||
if (this.buyNum > 0) {
|
||||
let data = {
|
||||
ProductId: this.product.id,
|
||||
Nums: this.buyNum,
|
||||
type: this.type,
|
||||
cartType: this.cartType,
|
||||
objectId: this.pinTuanId,
|
||||
teamId: this.teamId
|
||||
};
|
||||
this.$u.api.addCart(data).then(res => {
|
||||
if (res.status) {
|
||||
this.hideModal(); // 关闭弹出层
|
||||
let cartIds = res.data;
|
||||
if (this.teamId == 0) {
|
||||
this.$u.route('/pages/placeOrder/index/index?cartIds=' + JSON.stringify(cartIds) + '&orderType=' + this.cartType + '&objectId=' + this.pinTuanId);
|
||||
} else {
|
||||
this.$u.route('/pages/placeOrder/index/index?cartIds=' + JSON.stringify(cartIds) + '&orderType=' + this.cartType + '&objectId=' + this.pinTuanId + '&teamId=' + this.teamId);
|
||||
}
|
||||
} else {
|
||||
this.hideModal(); // 关闭弹出层
|
||||
this.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 购物车页面跳转
|
||||
redirectCart() {
|
||||
this.$u.route({
|
||||
type: 'switchTab',
|
||||
url: '/pages/index/cart/cart'
|
||||
});
|
||||
},
|
||||
end(index, number) {
|
||||
this.pinTuanRecord[index][number].isOverdue = true;
|
||||
},
|
||||
@@ -965,47 +926,13 @@
|
||||
});
|
||||
}
|
||||
},
|
||||
//在线客服,只有手机号的,请自己替换为手机号
|
||||
//在线客服
|
||||
showChat() {
|
||||
// #ifdef H5
|
||||
let _this = this;
|
||||
window._AIHECONG('ini', {
|
||||
entId: this.config.entId,
|
||||
button: false,
|
||||
appearance: {
|
||||
panelMobile: {
|
||||
tone: '#FF7159',
|
||||
sideMargin: 30,
|
||||
ratio: 'part',
|
||||
headHeight: 50
|
||||
}
|
||||
}
|
||||
});
|
||||
//传递客户信息
|
||||
window._AIHECONG('customer', {
|
||||
head: _this.userInfo.avatar,
|
||||
名称: _this.userInfo.nickname,
|
||||
手机: _this.userInfo.mobile
|
||||
});
|
||||
window._AIHECONG('showChat');
|
||||
// #endif
|
||||
// 客服页面
|
||||
// #ifdef APP-PLUS || APP-PLUS-NVUE
|
||||
this.$u.route('/pages/member/customerService/index');
|
||||
// #endif
|
||||
// 头条系客服
|
||||
// #ifdef MP-TOUTIAO
|
||||
if (this.shopMobile != 0) {
|
||||
let _this = this;
|
||||
tt.makePhoneCall({
|
||||
phoneNumber: this.shopMobile.toString(),
|
||||
success(res) { },
|
||||
fail(res) { }
|
||||
});
|
||||
} else {
|
||||
_this.$u.toast('暂无设置客服电话');
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
//获取分享URL
|
||||
getShareUrl() {
|
||||
@@ -1037,53 +964,8 @@
|
||||
this.modalType = 'promotion';
|
||||
this.showModal();
|
||||
},
|
||||
// 切换商品规格
|
||||
changeSpes(obj) {
|
||||
let index = obj.v;
|
||||
let key = obj.k;
|
||||
console.log(obj);
|
||||
let tmp_defaultSpecificationDescription = JSON.parse(this.product.defaultSpecificationDescription);
|
||||
//type = 1是立即购买,2是拼团购买
|
||||
if (tmp_defaultSpecificationDescription[index][key].hasOwnProperty('productId') && tmp_defaultSpecificationDescription[index][key].productId) {
|
||||
let data = {
|
||||
id: tmp_defaultSpecificationDescription[index][key].productId,
|
||||
type: 'pinTuan' //商品类型
|
||||
};
|
||||
let userToken = this.$db.get('userToken');
|
||||
if (userToken) {
|
||||
data['token'] = userToken;
|
||||
}
|
||||
this.$u.api.pinTuanProductInfo(data).then(res => {
|
||||
if (res.status == true) {
|
||||
// 切换规格判断可购买数量
|
||||
this.buyNum = res.data.stock > this.minBuyNum ? this.minBuyNum : res.data.stock;
|
||||
this.product = this.spesClassHandle(res.data);
|
||||
//products.price = _this.$common.moneySub(products.price,_this.discountAmount);
|
||||
//this.pinTuanPrice = this.$common.moneySub(this.product.price, this.discountAmount);
|
||||
console.log("type=" + this.pinTuanType);
|
||||
if (this.pinTuanType == 2) {
|
||||
//拼团
|
||||
this.product.mktprice = this.product.price;//原价
|
||||
this.price = this.pinTuanPrice = this.$common.moneySub(this.product.price, this.discountAmount);
|
||||
} else {
|
||||
this.price = this.product.price;
|
||||
this.pinTuanPrice = this.$common.moneySub(this.product.price, this.discountAmount);
|
||||
}
|
||||
}
|
||||
});
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
setTimeout(function () {
|
||||
uni.hideLoading();
|
||||
}, 1000);
|
||||
}
|
||||
},
|
||||
// 显示modal弹出框
|
||||
selectTap(type, teamId) {
|
||||
console.log("pinTuanPrice:" + this.pinTuanPrice);
|
||||
console.log("product.price:" + this.product.price);
|
||||
console.log("price:" + this.price);
|
||||
this.pinTuanType = type;
|
||||
if (teamId) {
|
||||
this.teamId = teamId;
|
||||
@@ -1095,10 +977,11 @@
|
||||
} else {
|
||||
this.price = this.product.price;
|
||||
}
|
||||
this.selectType = type;
|
||||
this.modalTitle = "选择规格";
|
||||
this.modalType = 'select';
|
||||
this.showModal();
|
||||
if (type == 1) {
|
||||
this.openSkuPopup();
|
||||
} else if (type == 2) {
|
||||
this.openSkuSinglePopup();
|
||||
}
|
||||
},
|
||||
showModal() {
|
||||
this.bottomModal = true;
|
||||
@@ -7,7 +7,4 @@
|
||||
|
||||
.goods-item { margin-bottom: 1px;
|
||||
.progress-text { color: #999999; font-size: 10px; margin-left: 12px; }
|
||||
}
|
||||
.activity-goods-box {
|
||||
.goods-right { width: 240px; }
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-solid-bottom coreshop-margin-top-10 coreshop-margin-bottom-10" v-if="serviceDescription.delivery.length>0" />
|
||||
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-padding-top-10" @tap="selectTap(0)" v-if="isSpes">
|
||||
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-padding-top-10" @tap="openSkuPopup()" v-if="isSpes">
|
||||
<view class="coreshop-basis-1">
|
||||
<text class="coreshop-text-gray">规格</text>
|
||||
</view>
|
||||
@@ -294,41 +294,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!--选择规格-->
|
||||
<view class="coreshop-common-view-box select hide" :class="modalType=='select' ?'show':''">
|
||||
<!--商品信息-->
|
||||
<view class="coreshop-list menu-avatar">
|
||||
<view class="coreshop-list-item">
|
||||
<view class="coreshop-avatar radius lg" :style="[{backgroundImage:'url('+ product.images +')'}] " />
|
||||
<view class="content">
|
||||
<view class="coreshop-text-price-view">
|
||||
<text class="coreshop-text-price coreshop-text-red coreshop-margin-right-10">{{ product.price || ''}}</text>
|
||||
<text class="coreshop-font-sm coreshop-text-gray coreshop-text-through">¥{{ product.mktprice || ''}}</text>
|
||||
<!--<u-tag text="秒杀中" mode="plain" type="error" shape="circle" size="mini" />-->
|
||||
</view>
|
||||
<view class="coreshop-text-black coreshop-font-sm flex">
|
||||
<view class="u-line-2">已选: {{ product.spesDesc || '无'}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!--规格数据-->
|
||||
<view class="coreshop-select-btn-list-box">
|
||||
<coreshop-spec :spesData="defaultSpesDesc" ref="spec" @changeSpes="changeSpes"></coreshop-spec>
|
||||
<view class="select-item">
|
||||
<view class="coreshop-text-black">数量</view>
|
||||
<view class="select-btn">
|
||||
<u-number-box v-model="buyNum" :min="minNums" :max="product.stock"></u-number-box>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!--公共按钮-->
|
||||
<view class="coreshop-padding-15 coreshop-text-center" v-if="modalType=='select'">
|
||||
<u-button type="error" :custom-style="customStyle" size="normal" @click="clickHandle()" :disabled='submitStatus' :loading='submitStatus' v-if="product.stock>0" shape="circle">确定</u-button>
|
||||
<u-button type="default" size="normal" v-else>已售罄</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
@@ -364,16 +329,26 @@
|
||||
|
||||
<view class="action" @click="redirectCart">
|
||||
<button class="noButtonStyle">
|
||||
<u-badge type="warning" :value="cartNums" showZero="false" absolute="true" :offset="[1, 4]"></u-badge>
|
||||
<u-icon name="shopping-cart" :size="20" label="购物车" :labelSize="12" labelPos="bottom"></u-icon>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn-group coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-basis-5">
|
||||
<u-button type="error" size="normal" @click="selectTap()" shape="circle" color="#9c26b0">立即{{ typeName || '' }}</u-button>
|
||||
<u-button type="error" size="normal" @click="openSkuPopup()" shape="circle" color="#9c26b0">立即秒杀</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<vk-data-goods-sku-popup ref="skuPopup"
|
||||
v-model="skuKey"
|
||||
border-radius="20"
|
||||
:amount-type="0"
|
||||
:localdata="goodsSkuInfo"
|
||||
mode="3"
|
||||
@add-cart="addCart"
|
||||
@buy-now="buyNow"></vk-data-goods-sku-popup>
|
||||
|
||||
<!-- 右边浮动球 -->
|
||||
<coreshop-fab horizontal="right" vertical="bottom" direction="vertical"></coreshop-fab>
|
||||
<!-- 登录提示 -->
|
||||
@@ -383,12 +358,14 @@
|
||||
</template>
|
||||
<script>
|
||||
import { mapMutations, mapActions, mapState } from 'vuex';
|
||||
|
||||
|
||||
export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
// 是否打开SKU弹窗
|
||||
skuKey: false,
|
||||
// 后端返回的商品信息
|
||||
goodsSkuInfo: {},
|
||||
goodsId: 0, // 商品id
|
||||
groupId: 0, // 团购ID
|
||||
goodsInfo: {}, // 商品详情
|
||||
@@ -398,10 +375,8 @@
|
||||
goodsComments: [], // 商品评论信息
|
||||
shopRecommendData: [], // 本店推荐数据
|
||||
otherRecommendData: [], // 其他数据
|
||||
buyNum: 1, // 选定的购买数量
|
||||
minBuyNum: 1, // 最小可购买数量
|
||||
type: 2,
|
||||
cartType: this.$globalConstVars.paymentType.skill,
|
||||
cartType: this.$globalConstVars.paymentType.seckill,
|
||||
isfav: false, // 商品是否收藏
|
||||
//拼团列表滑动数据
|
||||
swiperSet: {
|
||||
@@ -473,23 +448,6 @@
|
||||
shopMobile() {
|
||||
return this.$store.state.config.shopMobile || 0;
|
||||
},
|
||||
// 规格切换计算规格商品的 可购买数量
|
||||
minNums() {
|
||||
var num = this.product.stock > 0 ? this.product.stock : 0;
|
||||
return num > this.minBuyNum ? this.minBuyNum : num;
|
||||
},
|
||||
// 判断商品是否是多规格商品 (为了兼容小程序 只能写在计算属性里面了)
|
||||
isSpes() {
|
||||
if (this.product.hasOwnProperty('defaultSpecificationDescription') && this.product.defaultSpecificationDescription != null && Object.keys(this.product.defaultSpecificationDescription).length) {
|
||||
if (this.product.defaultSpecificationDescription != null && this.product.defaultSpecificationDescription != "" && this.product.defaultSpecificationDescription != undefined) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
// 优惠信息重新组装
|
||||
promotion() {
|
||||
let arr = [];
|
||||
@@ -500,9 +458,6 @@
|
||||
}
|
||||
return arr;
|
||||
},
|
||||
typeName() {
|
||||
return this.goodsInfo.groupType == 3 ? '团购' : '秒杀';
|
||||
},
|
||||
shareHref() {
|
||||
let pages = getCurrentPages();
|
||||
let page = pages[pages.length - 1];
|
||||
@@ -513,11 +468,47 @@
|
||||
return this.$globalConstVars.apiBaseUrl + 'wap/' + page.__proto__.route + '?id=' + this.goodsId + '&groupId=' + this.groupId;
|
||||
// #endif
|
||||
},
|
||||
defaultSpesDesc() {
|
||||
return this.product.defaultSpecificationDescription;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 打开sku弹出
|
||||
openSkuPopup() {
|
||||
this.skuKey = true;
|
||||
},
|
||||
closeSkuPopup() {
|
||||
this.skuKey = false;
|
||||
},
|
||||
// 立即购买
|
||||
buyNow(selectShop) {
|
||||
var that = this;
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
if (!this.hasLogin) {
|
||||
uni.hideLoading();
|
||||
this.$store.commit('showLoginTip', true);
|
||||
return false;
|
||||
}
|
||||
if (selectShop.buy_num > 0) {
|
||||
let data = {
|
||||
ProductId: selectShop._id,
|
||||
Nums: selectShop.buy_num,
|
||||
type: this.type,
|
||||
cartType: this.cartType,
|
||||
objectId: this.groupId
|
||||
};
|
||||
this.$u.api.addCart(data).then(res => {
|
||||
if (res.status) {
|
||||
let cartIds = res.data;
|
||||
this.$u.route('/pages/placeOrder/index/index?cartIds=' + JSON.stringify(cartIds) + '&orderType=' + this.cartType + '&objectId=' + this.groupId);
|
||||
uni.hideLoading();
|
||||
} else {
|
||||
this.$u.toast(res.msg);
|
||||
uni.hideLoading();
|
||||
}
|
||||
});
|
||||
}
|
||||
that.closeSkuPopup();
|
||||
},
|
||||
getServiceDescription() {
|
||||
let _this = this;
|
||||
this.$u.api.getServiceDescription().then(res => {
|
||||
@@ -541,7 +532,9 @@
|
||||
getGoodsInfo() {
|
||||
let data = {
|
||||
id: this.goodsId,
|
||||
groupId: this.groupId
|
||||
groupId: this.groupId,
|
||||
type: "seckill",
|
||||
needSku: true
|
||||
};
|
||||
// 如果用户已经登录 要传用户token
|
||||
let userToken = this.$db.get('userToken');
|
||||
@@ -559,6 +552,7 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
uni.hideLoading();
|
||||
} else if (res.data.isMarketable == false) {
|
||||
_this.$refs.uToast.show({
|
||||
message: '该商品已下架,请返回重新选择商品。', type: 'error', complete: function () {
|
||||
@@ -569,10 +563,10 @@
|
||||
});
|
||||
} else {
|
||||
let info = res.data;
|
||||
let products = res.data.product;
|
||||
this.product = res.data.product;
|
||||
|
||||
_this.goodsInfo = info;
|
||||
|
||||
this.goodsSkuInfo = res.data.skuList;
|
||||
if (_this.goodsInfo.album) {
|
||||
var albums = [];
|
||||
for (var i = 0; i < _this.goodsInfo.album.length; i++) {
|
||||
@@ -596,15 +590,13 @@
|
||||
|
||||
_this.isfav = _this.goodsInfo.isfav;
|
||||
_this.type = _this.goodsInfo.groupType;
|
||||
_this.product = _this.spesClassHandle(products);
|
||||
|
||||
_this.buyNum = _this.product.stock >= _this.minBuyNum ? _this.minBuyNum : 0;
|
||||
|
||||
// 判断如果登录用户添加商品浏览足迹
|
||||
if (userToken) {
|
||||
_this.goodsBrowsing();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -634,7 +626,6 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 获取购物车数量
|
||||
getCartNums() {
|
||||
let userToken = this.$db.get('userToken');
|
||||
@@ -647,61 +638,6 @@
|
||||
});
|
||||
}
|
||||
},
|
||||
// 切换商品规格
|
||||
changeSpes(obj) {
|
||||
let index = obj.v;
|
||||
let key = obj.k;
|
||||
let tmp_defaultSpecificationDescription = JSON.parse(this.product.defaultSpecificationDescription);
|
||||
if (tmp_defaultSpecificationDescription[index][key].hasOwnProperty('productId') && tmp_defaultSpecificationDescription[index][key].productId) {
|
||||
let data = {
|
||||
id: tmp_defaultSpecificationDescription[index][key].productId,
|
||||
type: 'group', //商品类型
|
||||
groupId: this.groupId
|
||||
};
|
||||
let userToken = this.$db.get('userToken');
|
||||
if (userToken) {
|
||||
data['token'] = userToken;
|
||||
}
|
||||
this.$u.api.getProductInfo(data).then(res => {
|
||||
if (res.status == true) {
|
||||
// 切换规格判断可购买数量
|
||||
this.buyNum = res.data.stock > this.minBuyNum ? this.minBuyNum : res.data.stock;
|
||||
this.product = this.spesClassHandle(res.data);
|
||||
}
|
||||
});
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
setTimeout(function () {
|
||||
uni.hideLoading();
|
||||
}, 1000);
|
||||
}
|
||||
},
|
||||
// 多规格样式统一处理
|
||||
spesClassHandle(products) {
|
||||
// 判断是否是多规格 (是否有默认规格)
|
||||
if (products.hasOwnProperty('defaultSpecificationDescription')) {
|
||||
let spes = products.defaultSpecificationDescription;
|
||||
for (let key in spes) {
|
||||
for (let i in spes[key]) {
|
||||
if (spes[key][i].hasOwnProperty('isDefault') && spes[key][i].isDefault === true) {
|
||||
this.$set(spes[key][i], 'cla', 'selected');
|
||||
} else if (spes[key][i].hasOwnProperty('productId') && spes[key][i].productId) {
|
||||
this.$set(spes[key][i], 'cla', 'not-selected');
|
||||
} else {
|
||||
this.$set(spes[key][i], 'cla', 'none');
|
||||
}
|
||||
}
|
||||
}
|
||||
spes = JSON.stringify(spes)
|
||||
products.defaultSpecificationDescription = spes;
|
||||
}
|
||||
return products;
|
||||
},
|
||||
// 购买数量加减操作
|
||||
bindChange(e) {
|
||||
this.buyNum = e.val;
|
||||
},
|
||||
// 商品收藏/取消
|
||||
collection() {
|
||||
let data = {
|
||||
@@ -758,51 +694,6 @@
|
||||
};
|
||||
this.$u.api.addGoodsBrowsing(data).then(res => { });
|
||||
},
|
||||
// 点击弹出框确定按钮事件处理
|
||||
clickHandle() {
|
||||
if (!this.hasLogin) {
|
||||
this.$store.commit('showLoginTip', true);
|
||||
return false;
|
||||
}
|
||||
this.submitStatus = true;
|
||||
this.buyNow();
|
||||
},
|
||||
// 立即购买
|
||||
buyNow() {
|
||||
if (this.buyNum > 0) {
|
||||
let data = {
|
||||
ProductId: this.product.id,
|
||||
Nums: this.buyNum,
|
||||
type: this.type,
|
||||
cartType: this.cartType,
|
||||
objectId: this.groupId
|
||||
};
|
||||
this.$u.api.addCart(data).then(res => {
|
||||
if (res.status) {
|
||||
this.hideModal(); // 关闭弹出层
|
||||
let cartIds = res.data;
|
||||
this.$u.route('/pages/placeOrder/index/index?cartIds=' + JSON.stringify(cartIds) + '&orderType=' + this.cartType + '&objectId=' + this.groupId);
|
||||
|
||||
} else {
|
||||
this.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 购物车页面跳转
|
||||
redirectCart() {
|
||||
this.$u.route({
|
||||
type: 'switchTab',
|
||||
url: '/pages/index/cart/cart'
|
||||
});
|
||||
},
|
||||
trigger(e) {
|
||||
this.content[e.index].active = !e.item.active;
|
||||
this.$u.route({
|
||||
type: 'switchTab',
|
||||
url: e.item.url
|
||||
});
|
||||
},
|
||||
// 跳转到h5分享页面
|
||||
goShare() {
|
||||
this.shareBox = true;
|
||||
@@ -818,47 +709,13 @@
|
||||
});
|
||||
}
|
||||
},
|
||||
//在线客服,只有手机号的,请自己替换为手机号
|
||||
//在线客服
|
||||
showChat() {
|
||||
// #ifdef H5
|
||||
let _this = this;
|
||||
window._AIHECONG('ini', {
|
||||
entId: this.config.entId,
|
||||
button: false,
|
||||
appearance: {
|
||||
panelMobile: {
|
||||
tone: '#FF7159',
|
||||
sideMargin: 30,
|
||||
ratio: 'part',
|
||||
headHeight: 50
|
||||
}
|
||||
}
|
||||
});
|
||||
//传递客户信息
|
||||
window._AIHECONG('customer', {
|
||||
head: _this.userInfo.avatar,
|
||||
名称: _this.userInfo.nickname,
|
||||
手机: _this.userInfo.mobile
|
||||
});
|
||||
window._AIHECONG('showChat');
|
||||
// #endif
|
||||
// 客服页面
|
||||
// #ifdef APP-PLUS || APP-PLUS-NVUE
|
||||
this.$u.route('/pages/member/customerService/index');
|
||||
// #endif
|
||||
// 头条系客服
|
||||
// #ifdef MP-TOUTIAO
|
||||
if (this.shopMobile != 0) {
|
||||
let _this = this;
|
||||
tt.makePhoneCall({
|
||||
phoneNumber: this.shopMobile.toString(),
|
||||
success(res) { },
|
||||
fail(res) { }
|
||||
});
|
||||
} else {
|
||||
_this.$u.toast('暂无设置客服电话');
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
//获取分享URL
|
||||
getShareUrl() {
|
||||
@@ -874,7 +731,7 @@
|
||||
};
|
||||
let userToken = this.$db.get('userToken');
|
||||
if (userToken && userToken != '') {
|
||||
data['token'] = userToken;
|
||||
data.token = userToken;
|
||||
}
|
||||
this.$u.api.share(data).then(res => {
|
||||
this.shareUrl = res.data
|
||||
@@ -890,15 +747,6 @@
|
||||
this.modalType = 'promotion';
|
||||
this.showModal();
|
||||
},
|
||||
// 显示modal弹出框
|
||||
selectTap() {
|
||||
this.modalTitle = "选择规格";
|
||||
this.modalType = 'select';
|
||||
this.showModal();
|
||||
},
|
||||
showModal() {
|
||||
this.bottomModal = true;
|
||||
},
|
||||
hideModal(e) {
|
||||
this.bottomModal = false;
|
||||
this.modalTitle = "";
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
<view class="coreshop-padding-10" v-if="CateStyle==1">
|
||||
<view v-for="(item,index) in tabbar" :key="index" @click="goClass(item.id)">
|
||||
<u--image width="100%" height="125px" :src="item.imageUrl"></u--image>
|
||||
<u--image width="100%" height="195px" :src="item.imageUrl" :showLoading="false"></u--image>
|
||||
<view class="coreshop-text-center coreshop-padding-top-10 coreshop-padding-bottom-10">
|
||||
{{item.name}}
|
||||
</view>
|
||||
@@ -19,7 +19,7 @@
|
||||
<view class="coreshop-padding-10" v-if="CateStyle==2">
|
||||
<u-row gutter="16">
|
||||
<u-col span="4" v-for="(item,index) in tabbar" :key="index" @click="goClass(item.id)">
|
||||
<u--image width="100%" height="80px" :src="item.imageUrl"></u--image>
|
||||
<u--image width="100%" height="80px" :src="item.imageUrl" :showLoading="false"></u--image>
|
||||
<view class="coreshop-text-center coreshop-padding-top-15 coreshop-padding-bottom-15 coreshop-font-sm">
|
||||
{{item.name}}
|
||||
</view>
|
||||
@@ -43,7 +43,7 @@
|
||||
</view>
|
||||
<view class="item-container coreshop-flex-direction-row">
|
||||
<view class="thumb-box" v-for="(item1, index1) in item.child" :key="index1" @click="goClass(item1.id)">
|
||||
<u--image width="60px" height="60px" :src="item1.imageUrl"></u--image>
|
||||
<u--image width="60px" height="60px" :src="item1.imageUrl" :showLoading="false"></u--image>
|
||||
<view class="item-menu-name">{{item1.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -270,6 +270,7 @@
|
||||
},
|
||||
//加载执行
|
||||
onLoad: function (options) {
|
||||
uni.showTabBar();
|
||||
//console.log(options);
|
||||
var where = {};
|
||||
if (options.id) {
|
||||
@@ -12,10 +12,59 @@
|
||||
</u-navbar>
|
||||
<!--幻灯片-->
|
||||
<u-swiper height="calc(750rpx * 6 / 6)" radius="0" :list="goodsInfo.album" :autoplay="autoplay" indicator indicatorMode="line" circular @click="clickImg"></u-swiper>
|
||||
|
||||
<view class="coreshop-margin-left-16 coreshop-margin-right-16 coreshop-margin-top-12 coreshop-padding-16 coreshop-border-radius-18 coreshop-bg-white">
|
||||
<view class="coreshop-flex coreshop-justify-between coreshop-align-center">
|
||||
<view class="coreshop-text-red coreshop-font-weight-bold">
|
||||
<text class="coreshop-font-16">¥</text>
|
||||
<text class="coreshop-font-24">{{ product.price || '0.00' }}</text>
|
||||
</view>
|
||||
<view class="coreshop-flex-sub coreshop-text-left coreshop-margin-left-12 coreshop-margin-top-6">
|
||||
<text class="coreshop-font-16 coreshop-text-gray coreshop-text-through">{{ priceSection }}</text>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-align-center">
|
||||
<u-icon name="star-fill" :size="20" label="收藏" :labelSize="14" labelPos="right" @click="collection" v-if="isfav"></u-icon>
|
||||
<u-icon name="star" :size="20" label="收藏" :labelSize="14" labelPos="right" @click="collection" v-else></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-margin-top-12 coreshop-multiple-line-clamp">
|
||||
<text class="coreshop-font-16 coreshop-font-weight-bold">{{ goodsInfo.name || '' }}</text>
|
||||
</view>
|
||||
<view class="coreshop-margin-top-8 coreshop-single-line-clamp">
|
||||
<text class="coreshop-font-14 coreshop-text-gray">{{ goodsInfo.brief || '' }}</text>
|
||||
</view>
|
||||
|
||||
<view class="coreshop-flex coreshop-margin-top-8">
|
||||
<u-tag :text="goodsInfo.brand.name" v-if="goodsInfo.brand"></u-tag>
|
||||
<view class="tag-64 cp832" wx:if="{{$root.m1}}">
|
||||
<text class="font-color-orange">832产品</text>
|
||||
</view>
|
||||
<view class="tag-64 shitang" wx:if="{{$root.m2}}">
|
||||
<text class="font-color-blue">食堂专供</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-margin-top-16 coreshop-padding-top-16 coreshop-solid-top coreshop-flex coreshop-justify-between coreshop-align-center coreshop-text-gray">
|
||||
<view class="coreshop-font-12">
|
||||
<text>运费:</text>
|
||||
<text class="font-color-orange">包邮</text>
|
||||
</view>
|
||||
<view class="coreshop-font-12">
|
||||
<text>销量:</text>
|
||||
<text>{{ goodsInfo.buyCount || '0' }}</text>
|
||||
</view>
|
||||
<view class="coreshop-font-12">
|
||||
<text>库存:</text>
|
||||
<text>{{product.stock}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
<!--限时秒杀-->
|
||||
<view class="coreshop-limited-seckill-box coreshop-bg-red coreshop-flex coreshop-justify-start">
|
||||
<!--<view class="coreshop-limited-seckill-box coreshop-bg-red coreshop-flex coreshop-justify-start">-->
|
||||
<!--<text class="coreshop-text-price coreshop-font-20">{{ product.price || '0.00' }}</text>-->
|
||||
<text class="coreshop-text-price coreshop-font-20">{{ priceSection }}</text>
|
||||
<!--<text class="coreshop-text-price coreshop-font-20">{{ priceSection }}</text>
|
||||
<view class="coreshop-font-xs price-4 coreshop-margin-left-20">
|
||||
<view v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && product.pointsDeduction > 0">
|
||||
<view class="coreshop-padding-bottom-5 coreshop-font-14">
|
||||
@@ -38,18 +87,18 @@
|
||||
<view class="coreshop-text-right coreshop-share-right">
|
||||
<u-icon name="share" @click="goShare()" label="分享" size="20" labelSize="11" color="#fff" labelColor="#fff" labelPos="bottom"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>-->
|
||||
|
||||
<!--标题-->
|
||||
<view class="coreshop-bg-white coreshop-common-view-box coreshop-good-title-view-box">
|
||||
<!--<view class="coreshop-bg-white coreshop-common-view-box coreshop-good-title-view-box">
|
||||
<view class="title-view coreshop-text-black coreshop-font-lg coreshop-text-bold">
|
||||
<view class="brand-tag" v-if="goodsInfo.brand"><u-tag :text="goodsInfo.brand.name" type="error" size="mini" /></view>
|
||||
{{ product.name || '' }}
|
||||
{{ goodsInfo.name || '' }}
|
||||
</view>
|
||||
<view class="coreshop-bg-red-light radius coreshop-margin-top-10 coreshop-title-tip-box">
|
||||
<text class="coreshop-font-sm">{{ goodsInfo.brief || '' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>-->
|
||||
|
||||
<!--促销-->
|
||||
<view class="coreshop-margin-top-10 coreshop-bg-white coreshop-common-view-box" v-if="promotion.length > 0" @tap="promotionTap">
|
||||
@@ -100,7 +149,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-solid-bottom coreshop-margin-top-10 coreshop-margin-bottom-10" v-if="serviceDescription.delivery.length>0" />
|
||||
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-padding-top-10" @tap="selectTap(0)" v-if="isSpes">
|
||||
<view class="coreshop-flex coreshop-flex-wrap coreshop-font-sm coreshop-padding-top-10" @tap="openSkuPopup">
|
||||
<view class="coreshop-basis-1">
|
||||
<text class="coreshop-text-gray">规格</text>
|
||||
</view>
|
||||
@@ -149,49 +198,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!--商家及推荐-->
|
||||
<view class="coreshop-margin-top-10 coreshop-bg-white coreshop-common-view-box coreshop-goods-shop-info-view-box">
|
||||
<view class="coreshop-shop-view">
|
||||
<view class="coreshop-position-absolute">
|
||||
<u-avatar :src="shopLogo"></u-avatar>
|
||||
</view>
|
||||
<view class="coreshop-margin-left-10 coreshop-padding-left-40 coreshop-padding-right-40">
|
||||
<view class="coreshop-margin-bottom-5">{{shopName}}</view>
|
||||
<view class="coreshop-font-sm u-line-1">{{shareTitle}}</view>
|
||||
</view>
|
||||
<u-button type="error" size="mini" :plain="true" @click="doPhoneCall">联系商家</u-button>
|
||||
</view>
|
||||
<view class="coreshop-solid-bottom coreshop-padding-top-5 coreshop-padding-bottom-5" />
|
||||
<view class="live-tag-view coreshop-margin-top-10 coreshop-margin-bottom-10">
|
||||
<view class="text-view">
|
||||
<view class="location-tag"><u-tag text="已定位" mode="plain" size="mini" type="warning" /></view>
|
||||
<text class="coreshop-margin-left-10 u-line-1">可直接获取商家地理位置信息</text>
|
||||
</view>
|
||||
<view class="coreshop-font-sm coreshop-text-red go-map-box" @tap="goShopMap">
|
||||
<text class="coreshop-margin-right-10">去地图</text>
|
||||
<u-icon name="arrow-right"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-solid-bottom coreshop-margin-top-10 coreshop-margin-bottom-10" />
|
||||
<view class="coreshop-good-shop-recommend-list-box">
|
||||
<view class="coreshop-font-sm coreshop-padding-top-10 ">本店推荐</view>
|
||||
<!--滑动列表-->
|
||||
<view class="recommend-scroll-box">
|
||||
<scroll-view class="recommend-scroll" scroll-x>
|
||||
<block v-for="(items,indexs) in shopRecommendData" :key="indexs">
|
||||
<view :id="['scroll' + (indexs + 1 )]" class="recommend-scroll-item" @tap="goGoodsDetail(items.id)">
|
||||
<u--image :src="items.image" mode="widthFix" width="91px" height="91px" radius="10"></u--image>
|
||||
<view class="u-line-2 coreshop-font-sm coreshop-text-black coreshop-margin-top-10 coreshop-margin-bottom-10 coreshop-min-height-34">{{items.name}}</view>
|
||||
<view class="coreshop-text-red coreshop-text-price coreshop-margin-top-10 coreshop-margin-bottom-10 coreshop-font-md coreshop-flex-direction-row">
|
||||
{{items.price}}元
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!--内容区-->
|
||||
<view class="coreshop-margin-top-10 coreshop-bg-white">
|
||||
<view class="coreshop-font-md coreshop-padding-top-10 coreshop-padding-bottom-10 coreshop-padding-left-10 coreshop-padding-right-10 coreshop-flex-direction-row">
|
||||
@@ -251,6 +257,49 @@
|
||||
<view class="coreshop-text-center coreshop-text-blue coreshop-padding-top-10" @tap="goArticleList()">查看更多问题</view>
|
||||
</view>
|
||||
|
||||
<!--商家及推荐-->
|
||||
<view class="coreshop-margin-top-10 coreshop-bg-white coreshop-common-view-box coreshop-goods-shop-info-view-box">
|
||||
<view class="coreshop-shop-view">
|
||||
<view class="coreshop-position-absolute">
|
||||
<u-avatar :src="shopLogo"></u-avatar>
|
||||
</view>
|
||||
<view class="coreshop-margin-left-10 coreshop-padding-left-40 coreshop-padding-right-40">
|
||||
<view class="coreshop-margin-bottom-5">{{shopName}}</view>
|
||||
<view class="coreshop-font-sm u-line-1">{{shareTitle}}</view>
|
||||
</view>
|
||||
<u-button type="error" size="mini" :plain="true" @click="doPhoneCall">联系商家</u-button>
|
||||
</view>
|
||||
<view class="coreshop-solid-bottom coreshop-padding-top-5 coreshop-padding-bottom-5" />
|
||||
<view class="live-tag-view coreshop-margin-top-10 coreshop-margin-bottom-10">
|
||||
<view class="text-view">
|
||||
<view class="location-tag"><u-tag text="已定位" mode="plain" size="mini" type="warning" /></view>
|
||||
<text class="coreshop-margin-left-10 u-line-1">可直接获取商家地理位置信息</text>
|
||||
</view>
|
||||
<view class="coreshop-font-sm coreshop-text-red go-map-box" @tap="goShopMap">
|
||||
<text class="coreshop-margin-right-10">去地图</text>
|
||||
<u-icon name="arrow-right"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-solid-bottom coreshop-margin-top-10 coreshop-margin-bottom-10" />
|
||||
<view class="coreshop-good-shop-recommend-list-box">
|
||||
<view class="coreshop-font-sm coreshop-padding-top-10 ">本店推荐</view>
|
||||
<!--滑动列表-->
|
||||
<view class="recommend-scroll-box">
|
||||
<scroll-view class="recommend-scroll" scroll-x>
|
||||
<block v-for="(items,indexs) in shopRecommendData" :key="indexs">
|
||||
<view :id="['scroll' + (indexs + 1 )]" class="recommend-scroll-item" @tap="goGoodsDetail(items.id)">
|
||||
<u--image :src="items.image" mode="widthFix" width="91px" height="91px" radius="10"></u--image>
|
||||
<view class="u-line-2 coreshop-font-sm coreshop-text-black coreshop-margin-top-10 coreshop-margin-bottom-10 coreshop-min-height-34">{{items.name}}</view>
|
||||
<view class="coreshop-text-red coreshop-text-price coreshop-margin-top-10 coreshop-margin-bottom-10 coreshop-font-md coreshop-flex-direction-row">
|
||||
{{items.price}}元
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!--为您推荐-->
|
||||
<view class="coreshop-recommended-title-view">
|
||||
<view class="coreshop-flex coreshop-flex-wrap coreshop-flex-direction-row">
|
||||
@@ -265,7 +314,6 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!--推荐列表-->
|
||||
<view class="coreshop-goods-group" v-if="otherRecommendData.length>0">
|
||||
<u-grid col="2" :border="false" align="left">
|
||||
@@ -288,7 +336,6 @@
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
</view>
|
||||
|
||||
<!--占位底部距离-->
|
||||
<view class="coreshop-tabbar-height" />
|
||||
|
||||
@@ -319,15 +366,16 @@
|
||||
</view>
|
||||
<view class="action" @click="redirectCart">
|
||||
<button class="noButtonStyle">
|
||||
<u-badge type="warning" :value="cartNums" showZero="false" absolute="true" :offset="[1, 4]"></u-badge>
|
||||
<u-icon name="shopping-cart" :size="20" label="购物车" :labelSize="12" labelPos="bottom"></u-icon>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn-group coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-basis-5">
|
||||
<u-button type="primary" size="normal" shape="circle" @click="selectTap(1)">
|
||||
<u-button type="primary" size="normal" shape="circle" @click="openSkuPopup">
|
||||
<text class="coreshop-font-12">加购物车</text>
|
||||
</u-button>
|
||||
<u-button type="success" size="normal" shape="circle" @click="selectTap(2)">
|
||||
<u-button type="success" size="normal" shape="circle" @click="openSkuPopup">
|
||||
<text class="coreshop-font-12">立即购买</text>
|
||||
</u-button>
|
||||
</view>
|
||||
@@ -336,7 +384,7 @@
|
||||
|
||||
|
||||
<!--弹出框-->
|
||||
<u-popup class="coreshop-bottom-popup-box" :show="bottomModal" mode="bottom" @close="hideModal" :closeable="true" safeAreaInsetTop>
|
||||
<u-popup class="coreshop-bottom-popup-box" :show="bottomModal" mode="bottom" @close="hideModal" :closeable="true" safeAreaInsetTop>
|
||||
<view class="radius coreshop-bg-white">
|
||||
<!--标题-->
|
||||
<view class="coreshop-text-black coreshop-text-center coreshop-margin-top-15 coreshop-margin-bottom-15 coreshop-font-lg coreshop-title-bar">
|
||||
@@ -363,46 +411,22 @@
|
||||
<text class="coreshop-margin-left-10 u-line-5 coreshop-text-black">{{item.name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!--选择规格-->
|
||||
<view class="coreshop-common-view-box select hide" :class="modalType=='select' ?'show':''">
|
||||
<!--商品信息-->
|
||||
<view class="coreshop-list menu-avatar">
|
||||
<view class="coreshop-list-item">
|
||||
<view class="coreshop-avatar radius lg" :style="[{backgroundImage:'url('+ product.images +')'}] " />
|
||||
<view class="content">
|
||||
<view class="coreshop-text-price-view">
|
||||
<text class="coreshop-text-price coreshop-text-red coreshop-margin-right-10">{{ product.price || ''}}</text>
|
||||
<text class="coreshop-font-sm coreshop-text-gray coreshop-text-through">¥{{ product.mktprice || ''}}</text>
|
||||
<!--<text class="cu-tag bg-gradual-red radius sm">
|
||||
<text class="cuIcon-hotfill"/>
|
||||
<text>秒杀中</text>
|
||||
</text>-->
|
||||
</view>
|
||||
<view class="coreshop-text-black coreshop-font-sm flex">
|
||||
<view class="u-line-2">已选: {{ product.spesDesc || product.name}} 库存:{{product.stock > 0 ? product.stock :0 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!--规格数据-->
|
||||
<view class="coreshop-select-btn-list-box">
|
||||
<coreshop-spec :spesData="defaultSpesDesc" ref="spec" @changeSpes="changeSpes"></coreshop-spec>
|
||||
<view class="coreshop-text-black coreshop-padding-top-10 coreshop-padding-bottom-10">数量</view>
|
||||
<view class="select-btn">
|
||||
<u-number-box v-model="buyNum" :min="minNums" :max="product.stock"></u-number-box>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!--公共按钮-->
|
||||
<view class="coreshop-padding-15 coreshop-text-center" v-if="modalType=='select'">
|
||||
<u-button type="error" size="default" @click="clickHandle()" :disabled='submitStatus' :loading='submitStatus' v-if="product.stock > 0" shape="circle">确定</u-button>
|
||||
<u-button type="default" size="normal" v-else>已售罄</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
|
||||
|
||||
<vk-data-goods-sku-popup ref="skuPopup"
|
||||
v-model="skuKey"
|
||||
border-radius="20"
|
||||
:amount-type="0"
|
||||
:localdata="goodsSkuInfo"
|
||||
:mode="skuMode"
|
||||
@open="onOpenSkuPopup"
|
||||
@close="onCloseSkuPopup"
|
||||
@add-cart="addCart"
|
||||
@buy-now="buyNow"></vk-data-goods-sku-popup>
|
||||
|
||||
<!-- 右边浮动球 -->
|
||||
<coreshop-fab horizontal="right" vertical="bottom" direction="vertical"></coreshop-fab>
|
||||
<!-- 登录提示 -->
|
||||
@@ -418,26 +442,24 @@
|
||||
|
||||
data() {
|
||||
return {
|
||||
background: {
|
||||
backgroundColor: '#e54d42'
|
||||
},
|
||||
bannerCur: 0,
|
||||
current: 0, // init tab位
|
||||
// 是否打开SKU弹窗
|
||||
skuKey: false,
|
||||
// SKU弹窗模式
|
||||
skuMode: 1,
|
||||
// 后端返回的商品信息
|
||||
goodsSkuInfo: {},
|
||||
goodsId: 0, // 商品id
|
||||
goodsInfo: {}, // 商品详情
|
||||
cartNums: 0, // 购物车数量
|
||||
product: {}, // 货品详情
|
||||
priceSection:'',
|
||||
priceSection: '',
|
||||
shopRecommendData: [], // 本店推荐数据
|
||||
otherRecommendData: [], // 其他数据
|
||||
goodsParams: [], // 商品参数信息
|
||||
goodsComments: [], // 商品评论信息
|
||||
buyNum: 1, // 选定的购买数量
|
||||
minBuyNum: 1, // 最小可购买数量
|
||||
type: 2, // 1加入购物车 2购买
|
||||
cartType: this.$globalConstVars.paymentType.common,
|
||||
isfav: false, // 商品是否收藏
|
||||
submitStatus: false,
|
||||
bottomModal: false,
|
||||
modalTitle: '',
|
||||
modalType: 'promotion',
|
||||
@@ -494,7 +516,6 @@
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
this.submitStatus = false;
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
@@ -537,19 +558,6 @@
|
||||
shopMobile() {
|
||||
return this.$store.state.config.shopMobile || 0;
|
||||
},
|
||||
// 规格切换计算规格商品的 可购买数量
|
||||
minNums() {
|
||||
var num = this.product.stock > 0 ? this.product.stock : 0;
|
||||
return num > this.minBuyNum ? this.minBuyNum : num;
|
||||
},
|
||||
// 判断商品是否是多规格商品 (为了兼容小程序 只能写在计算属性里面了)
|
||||
isSpes() {
|
||||
if (this.product.hasOwnProperty('defaultSpecificationDescription') && Object.keys(this.product.defaultSpecificationDescription).length) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
// 优惠信息重新组装
|
||||
promotion() {
|
||||
let arr = [];
|
||||
@@ -570,11 +578,89 @@
|
||||
return this.$globalConstVars.apiBaseUrl + 'wap/' + page.__proto__.route + '?id=' + this.goodsId;
|
||||
// #endif
|
||||
},
|
||||
defaultSpesDesc() {
|
||||
return this.product.defaultSpecificationDescription;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 打开sku弹出
|
||||
openSkuPopup() {
|
||||
this.skuKey = true;
|
||||
},
|
||||
closeSkuPopup() {
|
||||
this.skuKey = false;
|
||||
},
|
||||
// sku组件监听
|
||||
onOpenSkuPopup() {
|
||||
//console.log("监听 - 打开sku组件");
|
||||
},
|
||||
onCloseSkuPopup() {
|
||||
//console.log("监听 - 关闭sku组件");
|
||||
},
|
||||
// 加入购物车按钮
|
||||
addCart(selectShop) {
|
||||
//console.log("监听 - 加入购物车");
|
||||
//console.log(selectShop);
|
||||
var that = this;
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
if (!this.hasLogin) {
|
||||
uni.hideLoading();
|
||||
this.$store.commit('showLoginTip', true);
|
||||
return false;
|
||||
}
|
||||
if (selectShop.buy_num > 0) {
|
||||
let data = {
|
||||
productId: selectShop._id,
|
||||
nums: selectShop.buy_num,
|
||||
type: 1,
|
||||
}
|
||||
this.$u.api.addCart(data).then(res => {
|
||||
if (res.status) {
|
||||
uni.hideLoading();
|
||||
that.getCartNums(); // 获取购物车数量
|
||||
that.$refs.uToast.show({ message: res.msg, type: 'success' });
|
||||
} else {
|
||||
that.$u.toast(res.msg);
|
||||
uni.hideLoading();
|
||||
}
|
||||
});
|
||||
}
|
||||
that.closeSkuPopup();
|
||||
},
|
||||
// 立即购买
|
||||
buyNow(selectShop) {
|
||||
//console.log("监听 - 立即购买");
|
||||
//console.log(selectShop);
|
||||
var that = this;
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
if (!this.hasLogin) {
|
||||
uni.hideLoading();
|
||||
this.$store.commit('showLoginTip', true);
|
||||
return false;
|
||||
}
|
||||
if (selectShop.buy_num > 0) {
|
||||
let data = {
|
||||
productId: selectShop._id,
|
||||
nums: selectShop.buy_num,
|
||||
type: 2,
|
||||
cartType: this.cartType
|
||||
}
|
||||
this.$u.api.addCart(data).then(res => {
|
||||
if (res.status) {
|
||||
let cartIds = res.data;
|
||||
that.$u.route('/pages/placeOrder/index/index?cartIds=' + JSON.stringify(cartIds));
|
||||
uni.hideLoading();
|
||||
} else {
|
||||
this.$u.toast(res.msg);
|
||||
uni.hideLoading();
|
||||
}
|
||||
});
|
||||
}
|
||||
that.closeSkuPopup();
|
||||
},
|
||||
|
||||
//获取服务项
|
||||
getServiceDescription() {
|
||||
let _this = this;
|
||||
this.$u.api.getServiceDescription().then(res => {
|
||||
@@ -598,7 +684,8 @@
|
||||
getGoodsDetail() {
|
||||
let _this = this;
|
||||
let data = {
|
||||
id: parseInt(this.goodsId)
|
||||
id: parseInt(this.goodsId),
|
||||
data: true
|
||||
}
|
||||
// 如果用户已经登录 要传用户token
|
||||
let userToken = this.$db.get("userToken");
|
||||
@@ -606,16 +693,18 @@
|
||||
this.$u.api.goodsDetailByToken(data).then(res => {
|
||||
if (res.status == true) {
|
||||
let info = res.data;
|
||||
let products = res.data.product;
|
||||
_this.product = res.data.product;
|
||||
_this.goodsInfo = info;
|
||||
_this.goodsSkuInfo = res.data.skuList;
|
||||
|
||||
|
||||
//价格区间
|
||||
if (res.data.minPrice != res.data.maxPrice) {
|
||||
this.priceSection = res.data.minPrice + '~' + res.data.maxPrice;
|
||||
_this.priceSection = res.data.minPrice + '~' + res.data.maxPrice;
|
||||
} else {
|
||||
this.priceSection = products.price;
|
||||
_this.priceSection = res.data.product.price;
|
||||
}
|
||||
|
||||
|
||||
if (_this.goodsInfo.album) {
|
||||
var albums = [];
|
||||
for (var i = 0; i < _this.goodsInfo.album.length; i++) {
|
||||
@@ -636,11 +725,7 @@
|
||||
_this.autoplay = false;
|
||||
}
|
||||
}
|
||||
|
||||
_this.isfav = res.data.isFav;
|
||||
_this.product = _this.spesClassHandle(products);
|
||||
|
||||
_this.buyNum = _this.product.stock >= _this.minBuyNum ? _this.minBuyNum : 0;
|
||||
// 判断如果登录用户添加商品浏览足迹
|
||||
if (userToken) {
|
||||
_this.goodsBrowsing();
|
||||
@@ -658,15 +743,15 @@
|
||||
} else {
|
||||
this.$u.api.goodsDetail(data).then(res => {
|
||||
if (res.status == true) {
|
||||
let info = res.data;
|
||||
let products = res.data.product;
|
||||
_this.goodsInfo = info;
|
||||
_this.goodsInfo = res.data;
|
||||
_this.product = res.data.product;
|
||||
_this.goodsSkuInfo = res.data.skuList;
|
||||
|
||||
//价格区间
|
||||
if (res.data.minPrice != res.data.maxPrice) {
|
||||
this.priceSection = res.data.minPrice + '~' + res.data.maxPrice;
|
||||
_this.priceSection = res.data.minPrice + '~' + res.data.maxPrice;
|
||||
} else {
|
||||
this.priceSection = products.price;
|
||||
_this.priceSection = res.data.product.price;
|
||||
}
|
||||
|
||||
if (_this.goodsInfo.album) {
|
||||
@@ -689,11 +774,7 @@
|
||||
_this.autoplay = false;
|
||||
}
|
||||
}
|
||||
|
||||
_this.isfav = res.data.isFav;
|
||||
_this.product = _this.spesClassHandle(products);
|
||||
|
||||
_this.buyNum = _this.product.stock >= _this.minBuyNum ? _this.minBuyNum : 0;
|
||||
// 判断如果登录用户添加商品浏览足迹
|
||||
if (userToken) {
|
||||
_this.goodsBrowsing();
|
||||
@@ -748,58 +829,6 @@
|
||||
})
|
||||
}
|
||||
},
|
||||
// 切换商品规格
|
||||
changeSpes(obj) {
|
||||
let index = obj.v;
|
||||
let key = obj.k;
|
||||
let userToken = this.$db.get('userToken');
|
||||
let tmp_defaultSpecificationDescription = JSON.parse(this.product.defaultSpecificationDescription);
|
||||
if (tmp_defaultSpecificationDescription[index][key].hasOwnProperty('productId') && tmp_defaultSpecificationDescription[index][key].productId) {
|
||||
this.$refs.spec.changeSpecData();
|
||||
this.$u.api.getProductInfo({ id: tmp_defaultSpecificationDescription[index][key].productId, token: userToken }).then(res => {
|
||||
if (res.status == true) {
|
||||
// 切换规格判断可购买数量
|
||||
this.buyNum = res.data.stock >= this.minBuyNum ? this.minBuyNum : res.data.stock;
|
||||
this.product = this.spesClassHandle(res.data);
|
||||
this.priceSection = this.product.price;
|
||||
|
||||
}
|
||||
});
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
setTimeout(function () {
|
||||
uni.hideLoading();
|
||||
}, 1000);
|
||||
}
|
||||
},
|
||||
// 多规格样式统一处理
|
||||
spesClassHandle(products) {
|
||||
// 判断是否是多规格 (是否有默认规格)
|
||||
if (products.hasOwnProperty('defaultSpecificationDescription')) {
|
||||
let spes = products.defaultSpecificationDescription;
|
||||
for (let key in spes) {
|
||||
for (let i in spes[key]) {
|
||||
if (spes[key][i].hasOwnProperty('isDefault') && spes[key][i].isDefault === true) {
|
||||
this.$set(spes[key][i], 'cla', 'selected');
|
||||
} else if (spes[key][i].hasOwnProperty('productId') && spes[key][i].productId) {
|
||||
this.$set(spes[key][i], 'cla', 'not-selected');
|
||||
} else {
|
||||
this.$set(spes[key][i], 'cla', 'none');
|
||||
}
|
||||
}
|
||||
}
|
||||
spes = JSON.stringify(spes)
|
||||
products.defaultSpecificationDescription = spes;
|
||||
}
|
||||
return products;
|
||||
},
|
||||
// 购买数量加减操作
|
||||
//bindChange(val) {
|
||||
// this.buyNum = val.value;
|
||||
// console.log(val);
|
||||
// console.log(this.buyNum);
|
||||
//},
|
||||
// 商品收藏/取消
|
||||
collection() {
|
||||
let data = {
|
||||
@@ -814,12 +843,6 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
// tab点击切换
|
||||
onClickItem(index) {
|
||||
if (this.current !== index) {
|
||||
this.current = index;
|
||||
}
|
||||
},
|
||||
// 获取商品参数信息
|
||||
getGoodsParams() {
|
||||
this.$u.api.goodsParams({
|
||||
@@ -860,69 +883,6 @@
|
||||
}
|
||||
this.$u.api.addGoodsBrowsing(data).then(res => { });
|
||||
},
|
||||
// 加入购物车
|
||||
addToCart() {
|
||||
if (this.buyNum > 0) {
|
||||
let data = {
|
||||
productId: this.product.id,
|
||||
nums: this.buyNum
|
||||
}
|
||||
this.$u.api.addCart(data).then(res => {
|
||||
this.submitStatus = false;
|
||||
if (res.status) {
|
||||
this.hideModal(); // 关闭弹出层
|
||||
this.getCartNums(); // 获取购物车数量
|
||||
this.$refs.uToast.show({ message: res.msg, type: 'success', back: false });
|
||||
} else {
|
||||
this.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 立即购买
|
||||
buyNow() {
|
||||
if (this.buyNum > 0) {
|
||||
let data = {
|
||||
productId: this.product.id,
|
||||
nums: this.buyNum,
|
||||
type: this.type, // 区分加入购物车和购买
|
||||
cartType: this.cartType // 区分加入购物车和购买
|
||||
}
|
||||
this.$u.api.addCart(data).then(res => {
|
||||
this.submitStatus = false;
|
||||
if (res.status) {
|
||||
this.hideModal();
|
||||
let cartIds = res.data;
|
||||
this.$u.route('/pages/placeOrder/index/index?cartIds=' + JSON.stringify(cartIds));
|
||||
} else {
|
||||
this.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 购物车页面跳转
|
||||
redirectCart() {
|
||||
this.$u.route({
|
||||
type: 'switchTab',
|
||||
url: '/pages/index/cart/cart'
|
||||
});
|
||||
},
|
||||
// 点击弹出框确定按钮事件处理
|
||||
clickHandle() {
|
||||
if (!this.hasLogin) {
|
||||
this.$store.commit('showLoginTip', true);
|
||||
return false;
|
||||
}
|
||||
this.submitStatus = true;
|
||||
this.type === 1 ? this.addToCart() : this.buyNow();
|
||||
},
|
||||
trigger(e) {
|
||||
this.content[e.index].active = !e.item.active;
|
||||
this.$u.route({
|
||||
type: 'switchTab',
|
||||
url: e.item.url
|
||||
})
|
||||
},
|
||||
// 跳转到h5分享页面
|
||||
goShare() {
|
||||
this.shareBox = true;
|
||||
@@ -932,53 +892,19 @@
|
||||
},
|
||||
// 图片点击放大
|
||||
clickImg(index) {
|
||||
if (this.goodsInfo.album[index].type =='image') {
|
||||
if (this.goodsInfo.album[index].type == 'image') {
|
||||
uni.previewImage({
|
||||
urls: [this.goodsInfo.album[index].url],
|
||||
});
|
||||
}
|
||||
},
|
||||
//在线客服,只有手机号的,请自己替换为手机号
|
||||
//在线客服
|
||||
showChat() {
|
||||
let _this = this;
|
||||
// #ifdef H5
|
||||
window._AIHECONG('ini', {
|
||||
entId: this.config.entId,
|
||||
button: false,
|
||||
appearance: {
|
||||
panelMobile: {
|
||||
tone: '#FF7159',
|
||||
sideMargin: 30,
|
||||
ratio: 'part',
|
||||
headHeight: 50
|
||||
}
|
||||
}
|
||||
})
|
||||
//传递客户信息
|
||||
window._AIHECONG('customer', {
|
||||
head: _this.userInfo.avatar,
|
||||
'名称': _this.userInfo.nickname,
|
||||
'手机': _this.userInfo.mobile
|
||||
})
|
||||
window._AIHECONG('showChat')
|
||||
// #endif
|
||||
// 客服页面
|
||||
// #ifdef APP-PLUS || APP-PLUS-NVUE
|
||||
this.$u.route('/pages/member/customerService/index');
|
||||
// #endif
|
||||
// 头条系客服
|
||||
// #ifdef MP-TOUTIAO
|
||||
if (this.shopMobile != 0) {
|
||||
let _this = this;
|
||||
tt.makePhoneCall({
|
||||
phoneNumber: this.shopMobile.toString(),
|
||||
success(res) { },
|
||||
fail(res) { }
|
||||
});
|
||||
} else {
|
||||
_this.$u.toast('暂无设置客服电话');
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
//获取分享URL
|
||||
getShareUrl() {
|
||||
@@ -1009,13 +935,6 @@
|
||||
this.modalType = 'promotion';
|
||||
this.showModal();
|
||||
},
|
||||
selectTap(type) {
|
||||
this.selectType = type;
|
||||
this.type = type;
|
||||
this.modalTitle = "选择规格";
|
||||
this.modalType = 'select';
|
||||
this.showModal();
|
||||
},
|
||||
showModal() {
|
||||
this.bottomModal = true;
|
||||
console.log("打开弹窗");
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user