parent
4a9c829d6f
commit
4e465b7e72
|
@ -0,0 +1,11 @@
|
||||||
|
import request from "@/utils/request.js";
|
||||||
|
|
||||||
|
export function getOrder(id) {
|
||||||
|
return request.get("app-api/pay/order/get", {
|
||||||
|
id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function submitOrder(data) {
|
||||||
|
return request.post("app-api/pay/order/submit", data);
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
import request from "@/utils/request.js";
|
||||||
|
|
||||||
|
// 查询分类列表
|
||||||
|
export function getCategoryList() {
|
||||||
|
return request.get('app-api/product/category/list', {});
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
import request from "@/utils/request.js";
|
||||||
|
|
||||||
|
// 获得商品 SPU 分页
|
||||||
|
export function getSpuPage(data) {
|
||||||
|
return request.get('app-api/product/spu/page', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询商品
|
||||||
|
export function getSpuDetail(id) {
|
||||||
|
return request.get('app-api/product/spu/get-detail', {
|
||||||
|
id
|
||||||
|
}, {
|
||||||
|
noAuth: true // TODO 芋艿:后续要做调整
|
||||||
|
});
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
import request from "@/utils/request.js";
|
||||||
|
|
||||||
|
export function getAfterSalePage(data) {
|
||||||
|
return request.get("app-api/trade/after-sale/page", data);
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
import request from "@/utils/request.js";
|
||||||
|
|
||||||
|
export function addCart(data) {
|
||||||
|
return request.post("app-api/trade/cart/add", data);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateCart(data) {
|
||||||
|
return request.put("app-api/trade/cart/update", data);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function resetCart(data) {
|
||||||
|
return request.put("app-api/trade/cart/reset", data);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCartCount() {
|
||||||
|
return request.get("app-api/trade/cart/get-count");
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCartCountMap() {
|
||||||
|
return request.get("app-api/trade/cart/get-count-map");
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCartList() {
|
||||||
|
return request.get("app-api/trade/cart/list");
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteCart(ids) {
|
||||||
|
return request.delete("app-api/trade/cart/delete?ids=" + ids.join(','));
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
import request from "@/utils/request.js";
|
||||||
|
|
||||||
|
export function settlementOrder(data) {
|
||||||
|
return request.get("app-api/trade/order/settlement", data);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createOrder(data) {
|
||||||
|
return request.post("app-api/trade/order/create", data);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getOrderDetail(id) {
|
||||||
|
return request.get("app-api/trade/order/get-detail", {
|
||||||
|
id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getOrderCount() {
|
||||||
|
return request.get("app-api/trade/order/get-count");
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getOrderPage(data) {
|
||||||
|
return request.get("app-api/trade/order/page", data);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getOrderItem(id) {
|
||||||
|
return request.get("app-api/trade/order/item/get", {
|
||||||
|
id
|
||||||
|
});
|
||||||
|
}
|
|
@ -1,12 +1,12 @@
|
||||||
|
|
||||||
let domain = 'http://127.0.0.1:8081'
|
let domain = 'http://apif.java.crmeb.net'
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// 请求域名 格式: https://您的域名
|
// 请求域名 格式: https://您的域名
|
||||||
// #ifdef MP
|
// #ifdef MP
|
||||||
HTTP_REQUEST_URL: domain,
|
HTTP_REQUEST_URL: domain,
|
||||||
// #endif
|
// #endif
|
||||||
HTTP_ADMIN_URL:'http://127.0.0.1:8080', //PC后台的API请求地址,上传图片用
|
HTTP_ADMIN_URL:'http://apif.java.crmeb.net', //PC后台的API请求地址,上传图片用
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
//H5接口是浏览器地址
|
//H5接口是浏览器地址
|
||||||
// HTTP_REQUEST_URL: window.location.protocol+"//"+window.location.host,
|
// HTTP_REQUEST_URL: window.location.protocol+"//"+window.location.host,
|
||||||
|
|
|
@ -20,27 +20,26 @@
|
||||||
<scroll-view :scroll-top="scrollTop" scroll-y='true' scroll-with-animation="true"
|
<scroll-view :scroll-top="scrollTop" scroll-y='true' scroll-with-animation="true"
|
||||||
:style='"height:"+height+"px;"' @scroll="scroll">
|
:style='"height:"+height+"px;"' @scroll="scroll">
|
||||||
<view id="past0">
|
<view id="past0">
|
||||||
<productConSwiper :imgUrls="sliderImage" :videoline="productInfo.videoLink">
|
<productConSwiper :imgUrls="spu.sliderPicUrls" :videoline="spu.videoUrl">
|
||||||
</productConSwiper>
|
</productConSwiper>
|
||||||
<view class="pad30">
|
<view class="pad30">
|
||||||
|
<!-- 价格、库存、销量 -->
|
||||||
<view class='wrapper mb30 borRadius14'>
|
<view class='wrapper mb30 borRadius14'>
|
||||||
<view class='share acea-row row-between row-bottom'>
|
<view class='share acea-row row-between row-bottom'>
|
||||||
<view class='money font-color'>
|
<view class='money font-color'>
|
||||||
¥
|
¥
|
||||||
<text class='num'>{{productInfo.price}}</text>
|
<text class='num'>{{ fen2yuan(spu.price) }}</text>
|
||||||
<text class='vip-money'
|
<text class='vip-money' v-if="spu.vipPrice && spu.vipPrice > 0">¥{{ fen2yuan(spu.vipPrice) }}</text>
|
||||||
v-if="productInfo.vipPrice && productInfo.vipPrice > 0">¥{{productInfo.vipPrice}}</text>
|
<image v-if="spu.vipPrice && spu.vipPrice > 0" src="../../static/images/vip.png" />
|
||||||
<image v-if="productInfo.vipPrice && productInfo.vipPrice > 0"
|
|
||||||
src="../../static/images/vip.png"></image>
|
|
||||||
</view>
|
</view>
|
||||||
<view class='iconfont icon-fenxiang' @click="listenerActionSheet"></view>
|
<view class='iconfont icon-fenxiang' @click="listenerActionSheet"></view>
|
||||||
</view>
|
</view>
|
||||||
<view class='introduce'>{{productInfo.storeName}}</view>
|
<view class='introduce'>{{ spu.name }}</view>
|
||||||
<view class='label acea-row row-between-wrapper'>
|
<view class='label acea-row row-between-wrapper'>
|
||||||
<view>原价:¥{{productInfo.otPrice || 0}}</view>
|
<view>原价:¥{{ fen2yuan(spu.marketPrice) }}</view>
|
||||||
<view>库存:{{productInfo.stock || 0}}{{productInfo.unitName || ''}}</view>
|
<view>库存:{{ spu.stock }} {{ spu.unitName}}</view>
|
||||||
<view>
|
<view>
|
||||||
销量:{{Math.floor(productInfo.sales) + Math.floor(productInfo.ficti) || 0}}{{productInfo.unitName || ''}}
|
销量:{{ spu.salesCount}} {{ spu.unitName }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class='coupon acea-row row-between-wrapper' v-if="productInfo.give_integral > 0">
|
<!-- <view class='coupon acea-row row-between-wrapper' v-if="productInfo.give_integral > 0">
|
||||||
|
@ -49,12 +48,14 @@
|
||||||
<view class='activity'>赠送 {{productInfo.give_integral}} 积分</view>
|
<view class='activity'>赠送 {{productInfo.give_integral}} 积分</view>
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view> -->
|
||||||
<view v-if="coupon.list.length>0 && type=='normal'"
|
<!-- TODO 芋艿:卡在这个位置 -->
|
||||||
|
<view v-if="coupon.list.length > 0 && type==='normal'"
|
||||||
class='coupon acea-row row-between-wrapper' @click='couponTap'>
|
class='coupon acea-row row-between-wrapper' @click='couponTap'>
|
||||||
<view class='hide line1 acea-row'>
|
<view class='hide line1 acea-row'>
|
||||||
优惠券:
|
优惠券:
|
||||||
<view class='activity'>
|
<view class='activity'>
|
||||||
满{{coupon.list[0].minPrice}}减{{coupon.list[0].money}}</view>
|
满{{ coupon.list[0].minPrice }}减{{ coupon.list[0].money }}
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class='iconfont icon-jiantou'></view>
|
<view class='iconfont icon-jiantou'></view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -146,9 +147,8 @@
|
||||||
<image src="../../static/images/xyou.png"></image>
|
<image src="../../static/images/xyou.png"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class='conter'>
|
<view class='conter'>
|
||||||
<jyf-parser :html="description" ref="article" :tag-style="tagStyle"></jyf-parser>
|
<jyf-parser :html="spu.description" ref="article" :tag-style="tagStyle"></jyf-parser>
|
||||||
</view>
|
</view>
|
||||||
<!-- <rich-text :nodes="description" class="conter"></rich-text> -->
|
|
||||||
</view>
|
</view>
|
||||||
<view style='height:120rpx;'></view>
|
<view style='height:120rpx;'></view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
@ -203,9 +203,17 @@
|
||||||
<shareRedPackets :sharePacket="sharePacket" @listenerActionSheet="listenerActionSheet"
|
<shareRedPackets :sharePacket="sharePacket" @listenerActionSheet="listenerActionSheet"
|
||||||
@closeChange="closeChange"></shareRedPackets>
|
@closeChange="closeChange"></shareRedPackets>
|
||||||
<!-- 组件 -->
|
<!-- 组件 -->
|
||||||
<productWindow :attr="attr" :isShow='1' :iSplus='1' @myevent="onMyEvent" @ChangeAttr="ChangeAttr"
|
<productWindow
|
||||||
@ChangeCartNum="ChangeCartNum" @attrVal="attrVal" @iptCartNum="iptCartNum" id='product-window'>
|
:attr="attr"
|
||||||
</productWindow>
|
:isShow='1'
|
||||||
|
:iSplus='1'
|
||||||
|
@myevent="onMyEvent"
|
||||||
|
@ChangeAttr="ChangeAttr"
|
||||||
|
@ChangeCartNum="ChangeCartNum"
|
||||||
|
@attrVal="attrVal"
|
||||||
|
@iptCartNum="iptCartNum"
|
||||||
|
id='product-window'
|
||||||
|
/>
|
||||||
<home></home>
|
<home></home>
|
||||||
<couponListWindow :coupon='coupon' @ChangCouponsClone="ChangCouponsClone" @ChangCoupons="ChangCoupons"
|
<couponListWindow :coupon='coupon' @ChangCouponsClone="ChangCouponsClone" @ChangCoupons="ChangCoupons"
|
||||||
@ChangCouponsUseState="ChangCouponsUseState" @tabCouponType="tabCouponType"></couponListWindow>
|
@ChangCouponsUseState="ChangCouponsUseState" @tabCouponType="tabCouponType"></couponListWindow>
|
||||||
|
@ -257,14 +265,10 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js'
|
import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js'
|
||||||
// import yzf_chat from '@/plugin/chat/yzf_chat.js'
|
|
||||||
import store from '@/store';
|
|
||||||
import {
|
import {
|
||||||
getProductDetail,
|
|
||||||
collectAdd,
|
collectAdd,
|
||||||
collectDel,
|
collectDel,
|
||||||
postCartAdd,
|
postCartAdd,
|
||||||
getReplyList,
|
|
||||||
getReplyConfig,
|
getReplyConfig,
|
||||||
getProductGood,
|
getProductGood,
|
||||||
getReplyProduct
|
getReplyProduct
|
||||||
|
@ -292,11 +296,10 @@
|
||||||
import userEvaluation from '@/components/userEvaluation';
|
import userEvaluation from '@/components/userEvaluation';
|
||||||
import shareRedPackets from '@/components/shareRedPackets';
|
import shareRedPackets from '@/components/shareRedPackets';
|
||||||
import home from '@/components/home';
|
import home from '@/components/home';
|
||||||
import {
|
|
||||||
silenceBindingSpread
|
|
||||||
} from "@/utils";
|
|
||||||
import parser from "@/components/jyf-parser/jyf-parser";
|
import parser from "@/components/jyf-parser/jyf-parser";
|
||||||
// #ifdef MP
|
import * as ProductSpuApi from '@/api/product/spu.js';
|
||||||
|
import * as Util from '@/utils/util.js';
|
||||||
|
// #ifdef MP
|
||||||
import {
|
import {
|
||||||
base64src
|
base64src
|
||||||
} from '@/utils/base64src.js'
|
} from '@/utils/base64src.js'
|
||||||
|
@ -320,7 +323,6 @@
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
let that = this;
|
|
||||||
return {
|
return {
|
||||||
//属性是否打开
|
//属性是否打开
|
||||||
coupon: {
|
coupon: {
|
||||||
|
@ -335,8 +337,9 @@
|
||||||
id: 0, //商品id
|
id: 0, //商品id
|
||||||
replyCount: 0, //总评论数量
|
replyCount: 0, //总评论数量
|
||||||
reply: [], //评论列表
|
reply: [], //评论列表
|
||||||
productInfo: {}, //商品详情
|
productInfo: {}, // 商品详情 TODO 芋艿:准备移除
|
||||||
productValue: [], //系统属性
|
spu: {}, // 商品 SPU 详情
|
||||||
|
skuMap: [], // 商品 SKU Map
|
||||||
couponList: [], //优惠券
|
couponList: [], //优惠券
|
||||||
cart_num: 1, //购买数量
|
cart_num: 1, //购买数量
|
||||||
isAuto: false, //没有授权的不会自动授权
|
isAuto: false, //没有授权的不会自动授权
|
||||||
|
@ -362,12 +365,12 @@
|
||||||
isDown: true,
|
isDown: true,
|
||||||
posters: false,
|
posters: false,
|
||||||
weixinStatus: false,
|
weixinStatus: false,
|
||||||
attr: {
|
attr: { // productWindow 组件,使用该属性
|
||||||
cartAttr: false,
|
cartAttr: false, // TODO 芋艿,还没搞懂
|
||||||
|
// ↓↓↓ 属性数组,结构为:id = 属性编号;name = 属性编号的名字;values[].id = 属性值的编号,values[].name = 属性值的名字;index = 选中的属性值的名字
|
||||||
productAttr: [],
|
productAttr: [],
|
||||||
productSelect: {}
|
productSelect: {} // 选中的 SKU
|
||||||
},
|
},
|
||||||
description: '',
|
|
||||||
navActive: 0,
|
navActive: 0,
|
||||||
H5ShareBox: false, //公众号分享图片
|
H5ShareBox: false, //公众号分享图片
|
||||||
activityH5: [],
|
activityH5: [],
|
||||||
|
@ -387,7 +390,6 @@
|
||||||
table: 'width:100%',
|
table: 'width:100%',
|
||||||
video: 'width:100%'
|
video: 'width:100%'
|
||||||
},
|
},
|
||||||
sliderImage: [],
|
|
||||||
qrcodeSize: 600,
|
qrcodeSize: 600,
|
||||||
canvasStatus: false, //是否显示海报
|
canvasStatus: false, //是否显示海报
|
||||||
imagePath: '', //海报路径
|
imagePath: '', //海报路径
|
||||||
|
@ -405,25 +407,18 @@
|
||||||
isLogin: {
|
isLogin: {
|
||||||
handler: function(newV, oldV) {
|
handler: function(newV, oldV) {
|
||||||
let that = this;
|
let that = this;
|
||||||
if (newV == true) {
|
if (newV === true) {
|
||||||
that.getCouponList();
|
that.getCouponList();
|
||||||
that.getCartCount();
|
that.getCartCount();
|
||||||
//that.downloadFilePromotionCode();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
},
|
|
||||||
productInfo: {
|
|
||||||
handler: function() {
|
|
||||||
this.$nextTick(() => {});
|
|
||||||
},
|
|
||||||
immediate: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
let that = this
|
let that = this
|
||||||
var pages = getCurrentPages();
|
var pages = getCurrentPages();
|
||||||
that.returnShow = pages.length === 1 ? false : true;
|
that.returnShow = pages.length !== 1;
|
||||||
if (pages.length <= 1) {
|
if (pages.length <= 1) {
|
||||||
that.retunTop = false
|
that.retunTop = false
|
||||||
}
|
}
|
||||||
|
@ -463,7 +458,7 @@
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
spread(mapeMpQrCodeValue.spread).then(res => {}).catch(res => {})
|
spread(mapeMpQrCodeValue.spread).then(res => {}).catch(res => {})
|
||||||
},2000)
|
},2000)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.id = options.id;
|
this.id = options.id;
|
||||||
}
|
}
|
||||||
|
@ -560,7 +555,7 @@
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 购物车手动填写
|
* 购物车手动填写
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
iptCartNum: function(e) {
|
iptCartNum: function(e) {
|
||||||
this.$set(this.attr.productSelect, 'cart_num', e ? e : 1);
|
this.$set(this.attr.productSelect, 'cart_num', e ? e : 1);
|
||||||
|
@ -597,8 +592,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/*
|
/**
|
||||||
*去商品详情页
|
* 去商品详情页
|
||||||
*/
|
*/
|
||||||
goDetail(item) {
|
goDetail(item) {
|
||||||
if (!item.activityH5) {
|
if (!item.activityH5) {
|
||||||
|
@ -633,7 +628,6 @@
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: `/pages/activity/goods_seckill_details/index?id=${item.activityH5.id}`
|
url: `/pages/activity/goods_seckill_details/index?id=${item.activityH5.id}`
|
||||||
})
|
})
|
||||||
return
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 微信登录回调
|
// 微信登录回调
|
||||||
|
@ -646,12 +640,12 @@
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 购物车数量加和数量减
|
* 购物车数量加和数量减
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
ChangeCartNum: function(changeValue) {
|
ChangeCartNum: function(changeValue) {
|
||||||
//changeValue:是否 加|减
|
//changeValue:是否 加|减
|
||||||
//获取当前变动属性
|
//获取当前变动属性
|
||||||
let productSelect = this.productValue[this.attrValue];
|
let productSelect = this.skuMap[this.attrValue];
|
||||||
//如果没有属性,赋值给商品默认库存
|
//如果没有属性,赋值给商品默认库存
|
||||||
if (productSelect === undefined && !this.attr.productAttr.length)
|
if (productSelect === undefined && !this.attr.productAttr.length)
|
||||||
productSelect = this.attr.productSelect;
|
productSelect = this.attr.productSelect;
|
||||||
|
@ -679,10 +673,10 @@
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 属性变动赋值
|
* 属性变动赋值
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
ChangeAttr: function(res) {
|
ChangeAttr: function(res) {
|
||||||
let productSelect = this.productValue[res];
|
let productSelect = this.skuMap[res];
|
||||||
if (productSelect) {
|
if (productSelect) {
|
||||||
this.$set(this.attr.productSelect, "image", productSelect.image);
|
this.$set(this.attr.productSelect, "image", productSelect.image);
|
||||||
this.$set(this.attr.productSelect, "price", productSelect.price);
|
this.$set(this.attr.productSelect, "price", productSelect.price);
|
||||||
|
@ -723,7 +717,7 @@
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 优品推荐
|
* 优品推荐
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
getGoods() {
|
getGoods() {
|
||||||
getProductGood().then(res => {
|
getProductGood().then(res => {
|
||||||
|
@ -749,26 +743,25 @@
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取产品详情
|
* 获取产品详情
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
getGoodsDetails: function() {
|
getGoodsDetails: function() {
|
||||||
let that = this;
|
let that = this;
|
||||||
getProductDetail(that.id, that.type).then(res => {
|
ProductSpuApi.getSpuDetail(that.id).then(res => {
|
||||||
let productInfo = res.data.productInfo;
|
let productInfo = res.data;
|
||||||
// 字符串数组转数组;
|
let spu = res.data;
|
||||||
let arrayImg = productInfo.sliderImage;
|
|
||||||
let sliderImage = JSON.parse(arrayImg);
|
|
||||||
that.$set(that, 'sliderImage', sliderImage);
|
|
||||||
that.$set(that, 'productInfo', productInfo);
|
that.$set(that, 'productInfo', productInfo);
|
||||||
that.$set(that, 'description', productInfo.content);
|
that.$set(that, 'spu', spu);
|
||||||
that.$set(that, 'userCollect', res.data.userCollect);
|
that.$set(that, 'userCollect', res.data.userCollect); // TODO 芋艿:需要改造下,异步加载收藏状态
|
||||||
|
if (true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
that.$set(that.attr, 'productAttr', res.data.productAttr);
|
that.$set(that.attr, 'productAttr', res.data.productAttr);
|
||||||
that.$set(that, 'productValue', res.data.productValue);
|
that.$set(that, 'skuMap', res.data.skuMap);
|
||||||
that.$set(that.sharePacket, 'priceName', res.data.priceName);
|
that.$set(that.sharePacket, 'priceName', res.data.priceName);
|
||||||
that.$set(that.sharePacket, 'isState', Math.floor(res.data.priceName) != 0 ?
|
that.$set(that.sharePacket, 'isState', Math.floor(res.data.priceName) === 0);
|
||||||
false : true);
|
|
||||||
that.$set(that, 'activityH5', res.data.activityAllH5 ? res.data.activityAllH5 : []);
|
that.$set(that, 'activityH5', res.data.activityAllH5 ? res.data.activityAllH5 : []);
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: productInfo.storeName.substring(0, 7) + "..."
|
title: productInfo.storeName.substring(0, 7) + "..."
|
||||||
|
@ -794,7 +787,7 @@
|
||||||
// #ifdef MP
|
// #ifdef MP
|
||||||
that.getQrcode();
|
that.getQrcode();
|
||||||
// #endif
|
// #endif
|
||||||
};
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
that.infoScroll();
|
that.infoScroll();
|
||||||
}, 500);
|
}, 500);
|
||||||
|
@ -806,6 +799,9 @@
|
||||||
// #endif
|
// #endif
|
||||||
that.DefaultSelect();
|
that.DefaultSelect();
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
if (true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
//状态异常返回上级页面
|
//状态异常返回上级页面
|
||||||
return that.$util.Tips({
|
return that.$util.Tips({
|
||||||
title: err.toString()
|
title: err.toString()
|
||||||
|
@ -859,7 +855,7 @@
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 打开地图
|
* 打开地图
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
showMaoLocation: function() {
|
showMaoLocation: function() {
|
||||||
if (!this.systemStore.latitude || !this.systemStore.longitude) return this.$util.Tips({
|
if (!this.systemStore.latitude || !this.systemStore.longitude) return this.$util.Tips({
|
||||||
|
@ -876,13 +872,13 @@
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 默认选中属性
|
* 默认选中属性
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
DefaultSelect: function() {
|
DefaultSelect: function() {
|
||||||
let productAttr = this.attr.productAttr;
|
let productAttr = this.attr.productAttr;
|
||||||
let value = [];
|
let value = [];
|
||||||
for (let key in this.productValue) {
|
for (let key in this.skuMap) {
|
||||||
if (this.productValue[key].stock > 0) {
|
if (this.skuMap[key].stock > 0) {
|
||||||
value = this.attr.productAttr.length ? key.split(",") : [];
|
value = this.attr.productAttr.length ? key.split(",") : [];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -891,7 +887,7 @@
|
||||||
this.$set(productAttr[i], "index", value[i]);
|
this.$set(productAttr[i], "index", value[i]);
|
||||||
}
|
}
|
||||||
//sort();排序函数:数字-英文-汉字;
|
//sort();排序函数:数字-英文-汉字;
|
||||||
let productSelect = this.productValue[value.join(",")];
|
let productSelect = this.skuMap[value.join(",")];
|
||||||
if (productSelect && productAttr.length) {
|
if (productSelect && productAttr.length) {
|
||||||
this.$set(
|
this.$set(
|
||||||
this.attr.productSelect,
|
this.attr.productSelect,
|
||||||
|
@ -939,7 +935,7 @@
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 获取优惠券
|
* 获取优惠券
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
getCouponList(type) {
|
getCouponList(type) {
|
||||||
let that = this,
|
let that = this,
|
||||||
|
@ -969,9 +965,9 @@
|
||||||
that.$set(that.coupon, 'list', that.coupon.list);
|
that.$set(that.coupon, 'list', that.coupon.list);
|
||||||
that.$set(that.coupon, 'coupon', false);
|
that.$set(that.coupon, 'coupon', false);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* 收藏商品
|
* 收藏商品
|
||||||
*/
|
*/
|
||||||
setCollect: function() {
|
setCollect: function() {
|
||||||
|
@ -1015,7 +1011,7 @@
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 打开属性加入购物车
|
* 打开属性加入购物车
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
joinCart: function(e) {
|
joinCart: function(e) {
|
||||||
//是否登录
|
//是否登录
|
||||||
|
@ -1030,7 +1026,7 @@
|
||||||
*/
|
*/
|
||||||
goCat: function(num) {
|
goCat: function(num) {
|
||||||
let that = this,
|
let that = this,
|
||||||
productSelect = that.productValue[this.attrValue];
|
productSelect = that.skuMap[this.attrValue];
|
||||||
//打开属性
|
//打开属性
|
||||||
if (that.attrValue) {
|
if (that.attrValue) {
|
||||||
//默认选中了属性,但是没有打开过属性弹窗还是自动打开让用户查看默认选中的属性
|
//默认选中了属性,但是没有打开过属性弹窗还是自动打开让用户查看默认选中的属性
|
||||||
|
@ -1125,7 +1121,7 @@
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 分享打开
|
* 分享打开
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
listenerActionSheet: function() {
|
listenerActionSheet: function() {
|
||||||
if (this.isLogin === false) {
|
if (this.isLogin === false) {
|
||||||
|
@ -1370,6 +1366,9 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
fen2yuan(price) {
|
||||||
|
return Util.fen2yuan(price)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
// ========== 商品相关的 Util ==========
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从商品 SKU 数组中,转换出商品属性的数组
|
||||||
|
*
|
||||||
|
* 类似结构:[{
|
||||||
|
* id: // 属性的编号
|
||||||
|
* name: // 属性的名字
|
||||||
|
* values: [{
|
||||||
|
* id: // 属性值的编号
|
||||||
|
* name: // 属性值的名字
|
||||||
|
* }]
|
||||||
|
* }]
|
||||||
|
*
|
||||||
|
* @param skus 商品 SKU 数组
|
||||||
|
*/
|
||||||
|
export function convertProductPropertyList(skus) {
|
||||||
|
let result = [];
|
||||||
|
for (const sku of skus) {
|
||||||
|
if (!sku.properties) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for (const property of sku.properties) {
|
||||||
|
// ① 先处理属性
|
||||||
|
let resultProperty = result.find(item => item.id === property.propertyId)
|
||||||
|
if (!resultProperty) {
|
||||||
|
resultProperty = {
|
||||||
|
id: property.propertyId,
|
||||||
|
name: property.propertyName,
|
||||||
|
values: []
|
||||||
|
}
|
||||||
|
result.push(resultProperty)
|
||||||
|
}
|
||||||
|
// ② 再处理属性值
|
||||||
|
let resultValue = resultProperty.values.find(item => item.id === property.valueId)
|
||||||
|
if (!resultValue) {
|
||||||
|
resultProperty.values.push({
|
||||||
|
id: property.valueId,
|
||||||
|
name: property.valueName
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从商品 SKU 数组中,转换出商品 SKU Map
|
||||||
|
*
|
||||||
|
* key: 属性值的拼接,使用 , 间隔,例如说 黑色,CH510
|
||||||
|
*
|
||||||
|
* @param skus 商品 SKU Map
|
||||||
|
*/
|
||||||
|
export function convertProductSkuMap(skus) {
|
||||||
|
let result = {};
|
||||||
|
for (const sku of skus) {
|
||||||
|
let key = '';
|
||||||
|
if (!sku.properties) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for (const property of sku.properties) {
|
||||||
|
if (key !== '') {
|
||||||
|
key += ','
|
||||||
|
}
|
||||||
|
key += property.valueName
|
||||||
|
}
|
||||||
|
result[key] = sku
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
|
@ -31,17 +31,28 @@ function baseRequest(url, method, data, {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO 补个 header 多租户
|
||||||
|
if (url.indexOf('app-api') >= 0) {
|
||||||
|
header = {
|
||||||
|
...header
|
||||||
|
}
|
||||||
|
header['tenant-id'] = 1
|
||||||
|
header['Authorization'] = 'Bearer test247'
|
||||||
|
}
|
||||||
|
|
||||||
if (store.state.app.token) header[TOKENNAME] = store.state.app.token;
|
if (store.state.app.token) header[TOKENNAME] = store.state.app.token;
|
||||||
return new Promise((reslove, reject) => {
|
return new Promise((reslove, reject) => {
|
||||||
uni.request({
|
uni.request({
|
||||||
url: Url + '/api/front/' + url,
|
url: url.indexOf('app-api') < 0 ? Url + '/api/front/' + url
|
||||||
|
: 'http://127.0.0.1:48080/' + url, // TODO 芋艿:搞个 url 的配置
|
||||||
method: method || 'GET',
|
method: method || 'GET',
|
||||||
header: header,
|
header: header,
|
||||||
data: data || {},
|
data: data || {},
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (noVerify)
|
if (noVerify)
|
||||||
reslove(res.data, res);
|
reslove(res.data, res);
|
||||||
else if (res.data.code == 200)
|
else if (res.data.code === 200 || res.data.code === 0)
|
||||||
reslove(res.data, res);
|
reslove(res.data, res);
|
||||||
else if ([410000, 410001, 410002, 401].indexOf(res.data.code) !== -1) {
|
else if ([410000, 410001, 410002, 401].indexOf(res.data.code) !== -1) {
|
||||||
toLogin();
|
toLogin();
|
||||||
|
|
|
@ -108,7 +108,7 @@ export default {
|
||||||
* @param int index 需要移除的数组的键值
|
* @param int index 需要移除的数组的键值
|
||||||
* @param string | int 值
|
* @param string | int 值
|
||||||
* @return array
|
* @return array
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
ArrayRemove: function(array, index, value) {
|
ArrayRemove: function(array, index, value) {
|
||||||
const valueArray = [];
|
const valueArray = [];
|
||||||
|
@ -127,7 +127,7 @@ export default {
|
||||||
* 生成海报获取文字
|
* 生成海报获取文字
|
||||||
* @param string text 为传入的文本
|
* @param string text 为传入的文本
|
||||||
* @param int num 为单行显示的字节长度
|
* @param int num 为单行显示的字节长度
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
textByteLength: function(text, num) {
|
textByteLength: function(text, num) {
|
||||||
|
|
||||||
|
@ -164,8 +164,8 @@ export default {
|
||||||
* @param string price 价格
|
* @param string price 价格
|
||||||
* @param string ot_price 原始价格
|
* @param string ot_price 原始价格
|
||||||
* @param function successFn 回调函数
|
* @param function successFn 回调函数
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
PosterCanvas: function(arr2, store_name, price, ot_price, successFn) {
|
PosterCanvas: function(arr2, store_name, price, ot_price, successFn) {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
@ -173,7 +173,7 @@ export default {
|
||||||
ctx.clearRect(0, 0, 0, 0);
|
ctx.clearRect(0, 0, 0, 0);
|
||||||
/**
|
/**
|
||||||
* 只能获取合法域名下的图片信息,本地调试无法获取
|
* 只能获取合法域名下的图片信息,本地调试无法获取
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
ctx.fillStyle = '#fff';
|
ctx.fillStyle = '#fff';
|
||||||
ctx.fillRect(0, 0, 750, 1150);
|
ctx.fillRect(0, 0, 750, 1150);
|
||||||
|
@ -331,7 +331,7 @@ export default {
|
||||||
context.clearRect(0, 0, 0, 0);
|
context.clearRect(0, 0, 0, 0);
|
||||||
/**
|
/**
|
||||||
* 只能获取合法域名下的图片信息,本地调试无法获取
|
* 只能获取合法域名下的图片信息,本地调试无法获取
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
context.fillStyle = '#fff';
|
context.fillStyle = '#fff';
|
||||||
context.fillRect(0, 0, 594, 850);
|
context.fillRect(0, 0, 594, 850);
|
||||||
|
@ -425,8 +425,8 @@ export default {
|
||||||
/*
|
/*
|
||||||
* 单图上传
|
* 单图上传
|
||||||
* @param object opt
|
* @param object opt
|
||||||
* @param callable successCallback 成功执行方法 data
|
* @param callable successCallback 成功执行方法 data
|
||||||
* @param callable errorCallback 失败执行方法
|
* @param callable errorCallback 失败执行方法
|
||||||
*/
|
*/
|
||||||
uploadImageOne: function(opt, successCallback, errorCallback) {
|
uploadImageOne: function(opt, successCallback, errorCallback) {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
@ -445,11 +445,11 @@ export default {
|
||||||
model = opt.model;
|
model = opt.model;
|
||||||
|
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: count, //最多可以选择的图片总数
|
count: count, //最多可以选择的图片总数
|
||||||
sizeType: sizeType, // 可以指定是原图还是压缩图,默认二者都有
|
sizeType: sizeType, // 可以指定是原图还是压缩图,默认二者都有
|
||||||
sourceType: sourceType, // 可以指定来源是相册还是相机,默认二者都有
|
sourceType: sourceType, // 可以指定来源是相册还是相机,默认二者都有
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
//启动上传等待中...
|
//启动上传等待中...
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '图片上传中',
|
title: '图片上传中',
|
||||||
});
|
});
|
||||||
|
@ -509,7 +509,7 @@ export default {
|
||||||
* @param string k 整体分割符 默认为:&
|
* @param string k 整体分割符 默认为:&
|
||||||
* @param string p 单个分隔符 默认为:=
|
* @param string p 单个分隔符 默认为:=
|
||||||
* @return object
|
* @return object
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// #ifdef MP
|
// #ifdef MP
|
||||||
getUrlParams: function(param, k, p) {
|
getUrlParams: function(param, k, p) {
|
||||||
|
@ -781,13 +781,21 @@ export default {
|
||||||
else return url.replace('http://', 'https://');
|
else return url.replace('http://', 'https://');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 姓名除了姓显示其他
|
* 姓名除了姓显示其他
|
||||||
*/
|
*/
|
||||||
formatName: function(str) {
|
formatName: function(str) {
|
||||||
return str.substr(0, 1) + new Array(str.length).join('*');
|
return str.substr(0, 1) + new Array(str.length).join('*');
|
||||||
}
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将分转成元
|
||||||
|
*
|
||||||
|
* @param price 分,例如说 100 分
|
||||||
|
* @returns {string} 元,例如说 1.00 元
|
||||||
|
*/
|
||||||
|
export function fen2yuan(price) {
|
||||||
|
return (price / 100.0).toFixed(2)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue