mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 19:23:25 +08:00
【新增】移除旧版uniapp前端,新增新版uniapp前端,使用vue3框架全新编写。
This commit is contained in:
@@ -5,14 +5,15 @@
|
||||
</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>
|
||||
<Content Include="CoreShop\.hbuilderx\launch.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
|
||||
"version": "0.0",
|
||||
"configurations": [{
|
||||
"app-plus" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"default" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
|
||||
@@ -1,178 +1,37 @@
|
||||
<script setup lang="ts">
|
||||
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app';
|
||||
import { queryShopConfigV2 } from '@/core/api';
|
||||
import { Response, ShopConfigType } from '@/core/models';
|
||||
import { useShopConfigStore } from '@/core/store';
|
||||
|
||||
<script>
|
||||
import Vue from 'vue'
|
||||
export default {
|
||||
//使用方法
|
||||
//getApp().globalData.showLoginTip = false
|
||||
//console.log(getApp().globalData.text)
|
||||
// 获取项目配置
|
||||
const shopConfigStore = useShopConfigStore();
|
||||
const getShopConfigV2 = async () => {
|
||||
const shopConfig : Response<ShopConfigType> = await queryShopConfigV2();
|
||||
shopConfigStore.setConfig(shopConfig.data);
|
||||
}
|
||||
|
||||
globalData: {
|
||||
showLoginTip: false,
|
||||
},
|
||||
onLaunch() {
|
||||
//版本设置
|
||||
const version = '0.7.4'
|
||||
// 开发环境才提示,生产环境不会提示
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
console.log(`\n %c \u6838\u5fc3\u5546\u57ce\u7cfb\u7edf\u0020\u0043\u006f\u0072\u0065\u0053\u0068\u006f\u0070 V${version} %c \u0068\u0074\u0074\u0070\u0073\u003a\u002f\u002f\u0077\u0077\u0077\u002e\u0063\u006f\u0072\u0065\u0073\u0068\u006f\u0070\u002e\u0063\u006e\u002f \n\n`, 'color: #ffffff; background: #3c9cff; padding:5px 0;', 'color: #3c9cff;background: #f1f1f1; padding:5px 0;');
|
||||
}
|
||||
// #ifdef MP-WEIXIN
|
||||
this.autoUpdate();
|
||||
// #endif
|
||||
|
||||
// #ifdef APP-PLUS || APP-PLUS-NVUE
|
||||
this.checkVersion()
|
||||
// #endif
|
||||
|
||||
// 获取店铺配置信息 全局只请求一次
|
||||
this.$u.api.shopConfigV2().then(res => {
|
||||
this.$store.commit('config', res.data)
|
||||
})
|
||||
//获取三级联动城市信息
|
||||
this.$u.api.getAreaList().then(res => {
|
||||
if (res.status) {
|
||||
this.$db.set('areaList', res.data)
|
||||
}
|
||||
});
|
||||
},
|
||||
onShow: function (obj) {
|
||||
// #ifdef MP-WEIXIN
|
||||
this.$store.commit('scene', obj.scene)
|
||||
//console.log(obj);
|
||||
// #endif
|
||||
//console.log('App Show')
|
||||
},
|
||||
onHide: function () {
|
||||
//console.log('App Hide')
|
||||
},
|
||||
methods: {
|
||||
// #ifdef MP-WEIXIN
|
||||
//微信小程序检测更新措施,方式更新功能后,要等待24小时内才刷新的问题。
|
||||
autoUpdate() {
|
||||
var self = this
|
||||
// 获取小程序更新机制兼容
|
||||
if (wx.canIUse('getUpdateManager')) {
|
||||
//console.log("进入小程序自动更新检测");
|
||||
const updateManager = wx.getUpdateManager()
|
||||
//1. 检查小程序是否有新版本发布
|
||||
updateManager.onCheckForUpdate(function (res) {
|
||||
//console.log("进入小程序检测是否需要自动更新");
|
||||
//console.log(res);
|
||||
// 请求完新版本信息的回调
|
||||
if (res.hasUpdate) {
|
||||
//检测到新版本,需要更新,给出提示
|
||||
wx.showModal({
|
||||
title: '更新提示',
|
||||
content: '检测到新版本,是否下载新版本并重启小程序?',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
//2. 用户确定下载更新小程序,小程序下载及更新静默进行
|
||||
self.downLoadAndUpdate(updateManager)
|
||||
} else if (res.cancel) {
|
||||
//用户点击取消按钮,需要强制更新,二次弹窗
|
||||
wx.showModal({
|
||||
title: '温馨提示~',
|
||||
content: '本次版本更新涉及到新的功能添加,旧版本无法正常访问的哦~',
|
||||
showCancel: false,
|
||||
confirmText: "确定更新",
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
//下载新版本,并重新应用
|
||||
self.downLoadAndUpdate(updateManager)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示
|
||||
wx.showModal({
|
||||
title: '提示',
|
||||
content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
|
||||
})
|
||||
}
|
||||
},
|
||||
downLoadAndUpdate(updateManager) {
|
||||
var self = this
|
||||
wx.showLoading();
|
||||
//静默下载更新小程序新版本
|
||||
updateManager.onUpdateReady(function () {
|
||||
wx.hideLoading()
|
||||
//新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||||
updateManager.applyUpdate()
|
||||
})
|
||||
updateManager.onUpdateFailed(function () {
|
||||
// 新的版本下载失败
|
||||
wx.showModal({
|
||||
title: '已经有新版本了哟~',
|
||||
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
|
||||
})
|
||||
})
|
||||
},
|
||||
// #endif
|
||||
// #ifdef APP-PLUS || APP-PLUS-NVUE
|
||||
// app更新检测
|
||||
checkVersion() {
|
||||
// 获取应用版本号
|
||||
let _this = this;
|
||||
let version = plus.runtime.version;
|
||||
console.log('版本号:' + version);
|
||||
//检测当前平台,如果是安卓则启动安卓更新
|
||||
uni.getSystemInfo({
|
||||
success: res => {
|
||||
console.log('当前平台:' + res.platform);
|
||||
if (res.platform =='android') {
|
||||
_this.updateHandler(version);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 更新操作
|
||||
updateHandler(version) {
|
||||
let _this = this;
|
||||
this.$u.api.getAppVersion().then(res => {
|
||||
console.log(res);
|
||||
if (res.status && res.data) {
|
||||
if (res.data.version !== '' && res.data.version > version) {
|
||||
uni.showModal({
|
||||
//提醒用户更新
|
||||
title: '更新提示',
|
||||
content: res.data.note,
|
||||
success: function (resOpen) {
|
||||
if (resOpen.confirm) {
|
||||
plus.runtime.openURL(res.data.android)
|
||||
console.log('用户点击确定');
|
||||
} else if (resOpen.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
onLaunch(() => {
|
||||
getShopConfigV2();
|
||||
//版本设置
|
||||
const version = '0.7.4'
|
||||
// 开发环境才提示,生产环境不会提示
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
console.log(`\n %c \u6838\u5fc3\u5546\u57ce\u7cfb\u7edf\u0020\u0043\u006f\u0072\u0065\u0053\u0068\u006f\u0070 V${version} %c \u0068\u0074\u0074\u0070\u0073\u003a\u002f\u002f\u0077\u0077\u0077\u002e\u0063\u006f\u0072\u0065\u0073\u0068\u006f\u0070\u002e\u0063\u006e\u002f \n\n`, 'color: #ffffff; background: #3c9cff; padding:5px 0;', 'color: #3c9cff;background: #f1f1f1; padding:5px 0;');
|
||||
}
|
||||
})
|
||||
onShow(() => {
|
||||
console.log('App Show')
|
||||
})
|
||||
onHide(() => {
|
||||
console.log('App Hide')
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
|
||||
@import "@/uni_modules/uview-ui/index.scss";
|
||||
/*公共css */
|
||||
@import '@/static/style/coreCommon.scss';
|
||||
@import "@/static/style/tags";
|
||||
|
||||
// vue App的样式
|
||||
/* #ifdef APP-PLUS */
|
||||
@import "@/static/style/style.app.scss";
|
||||
/* #endif */
|
||||
|
||||
// 小程序特有的样式
|
||||
/* #ifdef MP */
|
||||
@import "@/static/style/style.mp.scss";
|
||||
/* #endif */
|
||||
page {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@import './static/css/common.scss';
|
||||
</style>
|
||||
@@ -1,387 +0,0 @@
|
||||
import { navLinkType } from '@/common/setting/constVarsHelper.js';
|
||||
|
||||
/**
|
||||
* 全局混入型
|
||||
*/
|
||||
module.exports = {
|
||||
beforeCreate() {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
/**
|
||||
* 页面加载
|
||||
*/
|
||||
pageLoading: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* //常用链接操作
|
||||
*/
|
||||
|
||||
//返回首页
|
||||
goHome() {
|
||||
uni.switchTab({ url: '/pages/index/default/default' });
|
||||
},
|
||||
//返回上一页
|
||||
goNavigateBack() {
|
||||
uni.navigateBack();
|
||||
},
|
||||
|
||||
//路由跳转
|
||||
goRoute(url) {
|
||||
// 无参数
|
||||
this.$u.route(url);
|
||||
},
|
||||
goRoute(url, params) {
|
||||
// 带参数,传递的对象形式的参数,如{name: 'lisa', age: 18}
|
||||
this.$u.route(url, params);
|
||||
},
|
||||
//查看所在坐标地图位置
|
||||
goShopMap() {
|
||||
var reshipCoordinate = this.$store.state.config.reshipCoordinate;
|
||||
if (reshipCoordinate && reshipCoordinate.indexOf(",") != -1) {
|
||||
var arr = reshipCoordinate.split(',')
|
||||
this.$u.route('/pages/map/map', { id: 1, latitude: arr[0], longitude: arr[1], });
|
||||
}
|
||||
},
|
||||
//查看所在坐标地图位置
|
||||
goMapDetails(id, latitude, longitude) {
|
||||
this.$u.route('/pages/map/map', { id: id, latitude: latitude, longitude: longitude, });
|
||||
},
|
||||
goUserCenter() {
|
||||
this.$u.route({ url: '/pages/index/member/member', type: 'switchTab' });
|
||||
},
|
||||
goSearch() {
|
||||
this.$u.route({ url: '/pages/search/search', });
|
||||
},
|
||||
// 返回上一页
|
||||
toBackBtn() {
|
||||
var pages = getCurrentPages();
|
||||
if (pages.length > 1) {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
} else {
|
||||
this.$u.route({ type: 'switchTab', url: '/pages/index/default/default' });
|
||||
}
|
||||
},
|
||||
//返回操作处理
|
||||
toOnBackPress(options) {
|
||||
if (options.from === 'navigateBack') {
|
||||
return false
|
||||
}
|
||||
let loginPages = ['/pages/index/cart/cart', '/pages/index/member/member']
|
||||
let backPage = this.$store.state.redirectPage
|
||||
if (loginPages.indexOf(backPage) > -1) {
|
||||
this.$store.commit({
|
||||
type: 'redirect',
|
||||
page: ''
|
||||
})
|
||||
this.$u.route({ type: 'switchTab', url: '/pages/index/default/default' })
|
||||
return true
|
||||
}
|
||||
},
|
||||
//登录成功统一跳转处理
|
||||
toLoginSuccessHandleBack() {
|
||||
let redirect = this.$store.state.redirectPage
|
||||
this.$store.commit({
|
||||
type: 'redirect',
|
||||
page: ''
|
||||
})
|
||||
let switchTabs = ['/pages/index/default/default', '/pages/index/member/member']
|
||||
if (switchTabs.indexOf(redirect) > -1) {
|
||||
this.$u.route({ type: 'switchTab', url: redirect })
|
||||
} else if (redirect) {
|
||||
this.$u.route({ type: 'switchTab', url: redirect })
|
||||
} else {
|
||||
this.$u.route({ type: 'switchTab', url: '/pages/index/default/default' })
|
||||
}
|
||||
},
|
||||
|
||||
// 购物车页面跳转
|
||||
redirectCart() {
|
||||
this.$u.route({
|
||||
type: 'switchTab',
|
||||
url: '/pages/index/cart/cart'
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 订单接口信息
|
||||
*/
|
||||
|
||||
// 查看订单详情
|
||||
goOrderDetail(orderId) {
|
||||
this.$u.route('/pages/member/order/detail/detail', { orderId: orderId });
|
||||
},
|
||||
// 取消订单
|
||||
|
||||
// 去支付
|
||||
goToPay(orderId) {
|
||||
this.$u.route('/pages/payment/pay/pay', { orderId: orderId, type: 1 });
|
||||
},
|
||||
// 确认收货
|
||||
|
||||
// 去评价
|
||||
toEvaluate(orderId) {
|
||||
this.$u.route('/pages/member/order/evaluate/evaluate', { orderId: orderId });
|
||||
},
|
||||
// 申请售后
|
||||
|
||||
// 查看物流信息
|
||||
goShowExpress(code, no, address = '', mobile = '') {
|
||||
let params = encodeURIComponent(
|
||||
'code=' + code + '&no=' + no + '&add=' + address + '&mobile=' + mobile
|
||||
)
|
||||
this.$u.route('/pages/member/order/expressDelivery/expressDelivery', { params: params });
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 商品接口信息
|
||||
*/
|
||||
|
||||
// 查看商品详情
|
||||
goGoodsDetail(goodsId) {
|
||||
this.$u.route('/pages/goods/goodDetails/goodDetails', { id: goodsId });
|
||||
},
|
||||
// 查看商品评论详情
|
||||
goGoodComments(goodsId) {
|
||||
this.$u.route('/pages/goods/goodComments/goodComments', { id: goodsId });
|
||||
},
|
||||
// 跳转商品列表页
|
||||
goGoodsList(obj = {}) {
|
||||
let url = '/pages/category/list/list'
|
||||
if (Object.keys(obj).length) {
|
||||
url = url + this.$u.queryParams(obj)
|
||||
}
|
||||
this.$u.route(url)
|
||||
},
|
||||
// 秒杀详情
|
||||
goSeckillDetail(id) {
|
||||
this.$u.route('/pages/activity/seckill/seckillDetails/seckillDetails', { id: id });
|
||||
},
|
||||
// 团购详情
|
||||
goGroupBuyingDetail(id) {
|
||||
this.$u.route('/pages/activity/groupBuying/groupBuyingDetails/groupBuyingDetails', { id: id });
|
||||
},
|
||||
//拼团详情页
|
||||
goPinTuanDetail(id, teamId) {
|
||||
if (teamId) {
|
||||
this.$u.route('/pages/activity/pinTuan/pinTuanDetails/pinTuanDetails', { id: id, teamId: teamId, });
|
||||
} else {
|
||||
this.$u.route('/pages/activity/pinTuan/pinTuanDetails/pinTuanDetails', { id: id });
|
||||
}
|
||||
},
|
||||
// 查看团购列表
|
||||
goGroupPurchase() {
|
||||
this.$u.route('/pages/activity/groupBuying/list/list')
|
||||
},
|
||||
// 查看秒杀列表
|
||||
goSeckillList() {
|
||||
this.$u.route('/pages/activity/seckill/list/list')
|
||||
},
|
||||
// 查看拼团列表
|
||||
goPinTuanList() {
|
||||
this.$u.route('/pages/activity/pinTuan/list/list')
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 文章接口
|
||||
*/
|
||||
|
||||
// 查看文章分类
|
||||
goArticleClassify(id) {
|
||||
this.$u.route('/pages/article/category/category', { id: id });
|
||||
},
|
||||
goArticleList() {
|
||||
this.$u.route('/pages/article/list/list')
|
||||
},
|
||||
// 查看文章详情
|
||||
goArticleDetail(id) {
|
||||
this.$u.route('/pages/article/details/details', { idType: 1, id: id });
|
||||
},
|
||||
|
||||
/**
|
||||
* 公告接口
|
||||
*/
|
||||
|
||||
// 查看公告列表
|
||||
goNoticeList() {
|
||||
this.$u.route('/pages/notice/list/list')
|
||||
},
|
||||
// 查看公告详情
|
||||
goNoticeDetail(id) {
|
||||
this.$u.route('/pages/notice/details/details', { id: id });
|
||||
},
|
||||
|
||||
// 前往用户协议
|
||||
goUserAgreementPage() {
|
||||
var id = this.$store.state.config.userAgreementId;
|
||||
this.$u.route('/pages/article/details/details', { idType: 1, id: id });
|
||||
},
|
||||
// 前往隐私协议
|
||||
goUserPrivacyPolicy() {
|
||||
var id = this.$store.state.config.privacyPolicyId;
|
||||
this.$u.route('/pages/article/details/details', { idType: 1, id: id });
|
||||
},
|
||||
// 关于我们
|
||||
goAboutUs() {
|
||||
let id = this.$store.state.config.aboutArticleId;
|
||||
this.$u.route('/pages/article/details/details', { idType: 1, id: id });
|
||||
},
|
||||
|
||||
/**
|
||||
* 接龙接口信息
|
||||
*/
|
||||
|
||||
// 查看接龙详情
|
||||
goSolitaireDetail(id) {
|
||||
this.$u.route('/pages/activity/solitaire/solitaireDetails/solitaireDetails', { id: id });
|
||||
},
|
||||
// 查看服务列表
|
||||
goSolitaireList() {
|
||||
this.$u.route('/pages/activity/solitaire/list/list')
|
||||
},
|
||||
|
||||
//服务接口信息
|
||||
goServicesDetail(serviceId) {
|
||||
this.$u.route('/pages/serviceGoods/details/details', { id: serviceId });
|
||||
},
|
||||
// 查看服务列表
|
||||
goServicesList() {
|
||||
this.$u.route('/pages/serviceGoods/index/index')
|
||||
},
|
||||
// 查看个人详情
|
||||
goServicesUserDetail(serviceId) {
|
||||
this.$u.route('/pages/member/serviceOrder/details/details', { id: serviceId });
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 广告相关
|
||||
*/
|
||||
|
||||
// 广告点击查看详情
|
||||
showSliderInfo(type, val) {
|
||||
if (!val) {
|
||||
return;
|
||||
}
|
||||
if (type == navLinkType.urlLink) {
|
||||
if (val.indexOf('http') != -1) {
|
||||
// #ifdef APP-PLUS || APP-PLUS-NVUE || MP
|
||||
this.$u.route('/pages/webview/webview', { src: val });
|
||||
// #endif
|
||||
} else {
|
||||
// #ifdef APP-PLUS || APP-PLUS-NVUE || MP
|
||||
if (val == '/pages/index/default/default' || val == '/pages/category/index/index' || val == '/pages/index/cart/cart' || val == '/pages/index/member/member') {
|
||||
this.$u.route({ type: 'switchTab', url: val });
|
||||
return;
|
||||
} else if (val.indexOf('/pages/coupon/coupon?id=') > -1) {
|
||||
var id = val.replace('/pages/coupon/coupon?id=', "");
|
||||
this.receiveCoupon(id)
|
||||
} else {
|
||||
this.$u.route(val);
|
||||
return;
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
} else if (type == navLinkType.shop) {
|
||||
// 商品详情
|
||||
this.$u.route('/pages/goods/goodDetails/goodDetails', { id: val });
|
||||
} else if (type == navLinkType.article) {
|
||||
// 文章详情
|
||||
this.$u.route('/pages/article/details/details', { idType: 1, id: val });
|
||||
} else if (type == navLinkType.articleCategory) {
|
||||
// 文章列表
|
||||
//this.$u.route('/pages/article/list/list')
|
||||
this.$u.route('/pages/article/category/category', { id: val });
|
||||
} else if (type == navLinkType.intelligentForms) {
|
||||
//自定义表单
|
||||
this.$u.route('/pages/form/details/details', { id: val });
|
||||
} else if (type == navLinkType.shopCategory) {
|
||||
//商品分类
|
||||
this.$u.route('/pages/category/list/list', { id: val });
|
||||
} else if (type == navLinkType.wxMiNiProgram) {
|
||||
//跳转微信小程序
|
||||
console.log("跳转微信小程序");
|
||||
uni.navigateToMiniProgram({
|
||||
appId: val,
|
||||
path: '',
|
||||
extraData: {},
|
||||
success(res) {
|
||||
console.log("跳转小程序成功", res);
|
||||
}, fail(res) {
|
||||
console.log("跳转小程序失败", res);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$u.route(val);
|
||||
}
|
||||
},
|
||||
// 用户领取优惠券
|
||||
receiveCoupon(couponId) {
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
mask: true
|
||||
});
|
||||
let _this = this;
|
||||
let coreshopdata = {
|
||||
id: couponId
|
||||
}
|
||||
this.$u.api.getCoupon(coreshopdata).then(res => {
|
||||
if (res.status) {
|
||||
uni.hideLoading();
|
||||
_this.$refs.uToast.show({ message: res.msg, type: 'success', back: false })
|
||||
} else {
|
||||
uni.hideLoading();
|
||||
_this.$u.toast(res.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 工具函数
|
||||
*/
|
||||
|
||||
doCopyData(data) {
|
||||
var _this = this;
|
||||
uni.setClipboardData({
|
||||
data: data,
|
||||
success: function () {
|
||||
_this.$u.toast('复制成功')
|
||||
}
|
||||
});
|
||||
},
|
||||
doPhoneCall() {
|
||||
var phome = this.$store.state.config.shopMobile || 0;
|
||||
if (phome != 0) {
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: phome
|
||||
});
|
||||
}
|
||||
},
|
||||
goBack() {
|
||||
//处理兼容,如果没有上一级界面则返回首页
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length === 2) {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
} else if (pages.length === 1) {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/default/default',
|
||||
})
|
||||
} else {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,658 +0,0 @@
|
||||
const http = uni.$u.http
|
||||
|
||||
// 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作,更多内容详见uView对拦截器的介绍部分:
|
||||
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
|
||||
const install = (Vue, vm) => {
|
||||
|
||||
// 获取店铺配置
|
||||
let shopConfigV2 = (params, config = {}) => http.post('/Api/Common/GetConfigV2', params, { custom: { methodName: 'common.shopConfigV2', needToken: false } });
|
||||
//获取商城关键词说明
|
||||
let getServiceDescription = (params, config = {}) => http.post('/Api/Common/GetServiceDescription', params, { custom: { methodName: 'common.getServiceDescription', needToken: false } });
|
||||
// 用户信息
|
||||
let userInfo = (params, config = {}) => http.post('/Api/User/GetUserInfo', params, { custom: { methodName: 'user.info', needToken: true } });
|
||||
// 上传头像
|
||||
let changeAvatar = (params, config = {}) => http.post('/Api/User/ChangeAvatar', params, { custom: { methodName: 'user.changeavatar', needToken: true } });
|
||||
// 编辑用户信息
|
||||
let editInfo = (params, config = {}) => http.post('/Api/User/EditInfo', params, { custom: { methodName: 'user.editinfo', needToken: true } });
|
||||
// 发送短信验证码
|
||||
let sms = (params, config = {}) => http.post('/Api/User/SendSms', params, { custom: { methodName: 'user.sms', needToken: false } });
|
||||
// 短信验证码登录
|
||||
let smsLogin = (params, config = {}) => http.post('/Api/User/SmsLogin', params, { custom: { methodName: 'user.smslogin', needToken: false } });
|
||||
// 退出登录
|
||||
let logout = (params, config = {}) => http.post('/Api/User/LogOut', params, { custom: { methodName: 'user.logout', needToken: true } });
|
||||
// 获取首页幻灯片
|
||||
let slider = (params, config = {}) => http.post('/Api/Advert/GetAdvertList', params, { custom: { methodName: 'advert.getAdvertList', needToken: false } });
|
||||
// 获取广告
|
||||
let advert = (params, config = {}) => http.post('/Api/Advert/GetPositionList', params, { custom: { methodName: 'advert.getcarousellists', needToken: false } });
|
||||
// 获取公告列表
|
||||
let notice = (params, config = {}) => http.post('/Api/Notice/NoticeList', params, { custom: { methodName: 'notice.noticeList', needToken: false } });
|
||||
// 获取公告详情
|
||||
let noticeInfo = (params, config = {}) => http.post('/Api/Notice/NoticeInfo', params, { custom: { methodName: 'notice.noticeInfo', needToken: false } });
|
||||
// 获取文章详情
|
||||
let articleInfo = (params, config = {}) => http.post('/Api/Article/GetArticleDetail', params, { custom: { methodName: 'articles.getArticleDetail', needToken: false } });
|
||||
// 获取文章列表
|
||||
let articleList = (params, config = {}) => http.post('/Api/Article/GetArticleList', params, { custom: { methodName: 'articles.getArticleList', needToken: false } });
|
||||
// 获取文章分类
|
||||
let articleClassify = (params, config = {}) => http.post('/Api/Article/GetArticleClassify', params, { custom: { methodName: 'articles.GetArticleClassify', needToken: false } });
|
||||
|
||||
|
||||
// 获取商品分类
|
||||
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 getGoodsRecommendList = (params, config = {}) => http.post('/Api/Good/GetGoodsRecommendList', params, { custom: { methodName: 'goods.getGoodsRecommendList', needToken: false } });
|
||||
// 获取商品参数信息
|
||||
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 } });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 添加购物车
|
||||
let addCart = (params, config = {}) => http.post('/Api/Cart/AddCart', params, { custom: { methodName: 'cart.add', needToken: true } });
|
||||
// 移除购物车
|
||||
let removeCart = (params, config = {}) => http.post('/Api/Cart/DoDelete', params, { custom: { methodName: 'cart.del', needToken: true } });
|
||||
// 获取购物车列表
|
||||
let cartList = (params, config = {}) => http.post('/Api/Cart/GetList', params, { custom: { methodName: 'cart.getlist', needToken: true } });
|
||||
// 设置购物车商品数量
|
||||
let setCartNum = (params, config = {}) => http.post('/Api/Cart/SetCartNum', params, { custom: { methodName: 'cart.setnums', needToken: true } });
|
||||
// 获取购物车数量
|
||||
let getCartNum = (params, config = {}) => http.post('/Api/User/GetCartNumber', params, { custom: { methodName: 'cart.getnumber', needToken: true } });
|
||||
// 获取购物车数量和商品总价格
|
||||
let getCartNumAndMoney = (params, config = {}) => http.post('/Api/User/GetCartNumberAndMoney', params, { custom: { methodName: 'cart.getnumber', needToken: true } });
|
||||
// 根据购物车已有数据获取能够使用的优惠券
|
||||
let getCartCoupon = (params, config = {}) => http.post('/Api/Cart/GetCartAvailableCoupon', params, { custom: { methodName: 'cart.getCartCoupon', needToken: true } });
|
||||
|
||||
// 获取用户的收货地址列表
|
||||
let userShip = (params, config = {}) => http.post('/Api/User/GetUserShip', params, { custom: { methodName: 'user.getusership', needToken: true } });
|
||||
// 获取用户默认收货地址
|
||||
let userDefaultShip = (params, config = {}) => http.post('/Api/User/GetUserDefaultShip', params, { custom: { methodName: 'user.getuserdefaultship', needToken: true } });
|
||||
// 存储用户收货地址
|
||||
let saveUserShip = (params, config = {}) => http.post('/Api/User/SaveUserShip', params, { custom: { methodName: 'user.vuesaveusership', needToken: true } });
|
||||
// 微信存储收货地址
|
||||
let saveUserShipWx = (params, config = {}) => http.post('/Api/User/SaveUserShip', params, { custom: { methodName: 'user.saveusership', needToken: true } });
|
||||
//获取区域ID
|
||||
let getAreaId = (params, config = {}) => http.post('/Api/User/GetAreaId', params, { custom: { methodName: 'user.getareaid', needToken: false } });
|
||||
//根据区/县名称获取城市id信息
|
||||
let getAreaIdByName = (params, config = {}) => http.post('/Api/User/GetAreaIdByName', params, { custom: { methodName: 'user.getareaid', needToken: false } });
|
||||
// 获取收货地址详情
|
||||
let shipDetail = (params, config = {}) => http.post('/Api/User/GetShipDetail', params, { custom: { methodName: 'user.getshipdetail', needToken: true } });
|
||||
// 收货地址编辑
|
||||
let editShip = (params, config = {}) => http.post('/Api/User/SaveUserShip', params, { custom: { methodName: 'user.editship', needToken: true } });
|
||||
// 收货地址删除
|
||||
let removeShip = (params, config = {}) => http.post('/Api/User/RemoveShip', params, { custom: { methodName: 'user.removeship', needToken: true } });
|
||||
// 设置默认收货地址
|
||||
let setDefShip = (params, config = {}) => http.post('/Api/User/SetDefShip', params, { custom: { methodName: 'user.setdefship', needToken: true } });
|
||||
|
||||
// 生成订单
|
||||
let createOrder = (params, config = {}) => http.post('/Api/Order/CreateOrder', params, { custom: { methodName: 'order.create', needToken: true } });
|
||||
// 取消订单
|
||||
let cancelOrder = (params, config = {}) => http.post('/Api/Order/CancelOrder', params, { custom: { methodName: 'order.cancel', needToken: true } });
|
||||
// 删除订单
|
||||
let delOrder = (params, config = {}) => http.post('/Api/Order/DeleteOrder', params, { custom: { methodName: 'order.del', needToken: true } });
|
||||
// 获取订单详情
|
||||
let orderDetail = (params, config = {}) => http.post('/Api/Order/OrderDetails', params, { custom: { methodName: 'order.details', needToken: true } });
|
||||
// 确认收货
|
||||
let confirmOrder = (params, config = {}) => http.post('/Api/Order/OrderConfirm', params, { custom: { methodName: 'order.confirm', needToken: true } });
|
||||
// 获取配送方式
|
||||
let orderShip = (params, config = {}) => http.post('/Api/Order/GetShip', params, { custom: { methodName: 'order.getship', needToken: true } });
|
||||
// 获取全部订单列表
|
||||
let orderList = (params, config = {}) => http.post('/Api/Order/GetOrderList', params, { custom: { methodName: 'order.getorderlist', needToken: true } });
|
||||
// 获取订单不同状态的数量
|
||||
let getOrderStatusSum = (params, config = {}) => http.post('/Api/Order/GetOrderStatusNum', params, { custom: { methodName: 'order.getorderstatusnum', needToken: true } });
|
||||
// 获取不同类型营销下单支持的配送方式
|
||||
let getOrderDistributionModel = (params, config = {}) => http.post('/Api/Order/GetOrderDistributionModel', params, { custom: { methodName: 'order.getOrderdistributionmodel', needToken: true } });
|
||||
|
||||
// 售后单列表
|
||||
let afterSalesList = (params, config = {}) => http.post('/Api/Order/AftersalesList', params, { custom: { methodName: 'order.aftersaleslist', needToken: true } });
|
||||
// 售后单详情
|
||||
let afterSalesInfo = (params, config = {}) => http.post('/Api/Order/Aftersalesinfo', params, { custom: { methodName: 'order.aftersalesinfo', needToken: true } });
|
||||
// 添加售后单
|
||||
let addAfterSales = (params, config = {}) => http.post('/Api/Order/AddAftersales', params, { custom: { methodName: 'order.addaftersales', needToken: true } });
|
||||
// 用户发送退货包裹
|
||||
let sendShip = (params, config = {}) => http.post('/Api/Order/SendReship', params, { custom: { methodName: 'order.sendreship', needToken: true } });
|
||||
|
||||
// 添加商品浏览足迹
|
||||
let addGoodsBrowsing = (params, config = {}) => http.post('/Api/User/AddGoodsBrowsing', params, { custom: { methodName: 'user.addgoodsbrowsing', needToken: true } });
|
||||
// 删除商品浏览足迹
|
||||
let delGoodsBrowsing = (params, config = {}) => http.post('/Api/User/DelGoodsBrowsing', params, { custom: { methodName: 'user.delgoodsbrowsing', needToken: true } });
|
||||
// 获取商品浏览足迹
|
||||
let goodsBrowsing = (params, config = {}) => http.post('/Api/User/Goodsbrowsing', params, { custom: { methodName: 'user.goodsbrowsing', needToken: true } });
|
||||
// 商品收藏 关注/取消
|
||||
let goodsCollection = (params, config = {}) => http.post('/Api/User/GoodsCollectionCreateOrDelete', params, { custom: { methodName: 'user.goodscollection', needToken: true } });
|
||||
// 获取商品收藏关注列表
|
||||
let goodsCollectionList = (params, config = {}) => http.post('/Api/User/GoodscollectionList', params, { custom: { methodName: 'user.goodscollectionlist', needToken: true } });
|
||||
|
||||
// 获取店铺支付方式列表
|
||||
let paymentList = (params, config = {}) => http.post('/Api/Payments/GetList', params, { custom: { methodName: 'payments.getlist', needToken: false } });
|
||||
// 获取支付单详情
|
||||
let paymentInfo = (params, config = {}) => http.post('/Api/Payments/GetInfo', params, { custom: { methodName: 'payments.getinfo', needToken: true } });
|
||||
// 支付接口
|
||||
let pay = (params, config = {}) => http.post('/Api/User/Pay', params, { custom: { methodName: 'user.pay', needToken: true } });
|
||||
// 订单评价接口
|
||||
let orderEvaluate = (params, config = {}) => http.post('/Api/User/OrderEvaluate', params, { custom: { methodName: 'user.orderevaluate', needToken: true } });
|
||||
|
||||
// 判断是否签到(作废)
|
||||
//let isSign = (params, config = {}) => http.post('/Api/User/IsSign', params, { custom: { methodName: 'user.issign', needToken: true } });
|
||||
// 签到接口(作废)
|
||||
//let sign = (params, config = {}) => http.post('/Api/User/Sign', params, { custom: { methodName: 'user.sign', needToken: true } });
|
||||
|
||||
// 签到接口
|
||||
let userCheckIn = (params, config = {}) => http.post('/Api/CheckIn/DoUserCheckIn', params, { custom: { methodName: 'user.doUserCheckIn', needToken: true } });
|
||||
//获取用户按月签到数据
|
||||
let getUserCheckByMonth = (params, config = {}) => http.post('/Api/CheckIn/GetUserCheckByMonth', params, { custom: { methodName: 'user.getUserCheckByMonth', needToken: true } });
|
||||
//获取用户总签到次数
|
||||
let getUserCheckCount = (params, config = {}) => http.post('/Api/CheckIn/GetUserCheckCount', params, { custom: { methodName: 'user.getUserCheckCount', needToken: true } });
|
||||
|
||||
|
||||
// 积分记录
|
||||
let pointLog = (params, config = {}) => http.post('/Api/User/UserPointLog', params, { custom: { methodName: 'user.userpointlog', needToken: true } });
|
||||
// 物流信息接口
|
||||
let logistics = (params, config = {}) => http.post('/Api/Order/LogisticsByApi', params, { custom: { methodName: 'order.logisticbyapi', needToken: true } });
|
||||
// 优惠券列表
|
||||
let couponList = (params, config = {}) => http.post('/Api/Coupon/CouponList', params, { custom: { methodName: 'coupon.couponlist', needToken: false } });
|
||||
// 优惠券详情
|
||||
let couponDetail = (params, config = {}) => http.post('/Api/Coupon/CouponDetail', params, { custom: { methodName: 'coupon.coupondetail', needToken: false } });
|
||||
// 用户领取优惠券
|
||||
let getCoupon = (params, config = {}) => http.post('/Api/Coupon/GetCoupon', params, { custom: { methodName: 'coupon.getcoupon', needToken: true } });
|
||||
// 用户已领取的优惠券列表
|
||||
let userCoupon = (params, config = {}) => http.post('/Api/Coupon/UserCoupon', params, { custom: { methodName: 'coupon.usercoupon', needToken: true } });
|
||||
// 获取我的银行卡列表
|
||||
let getBankCardList = (params, config = {}) => http.post('/Api/User/GetMyBankcardsList', params, { custom: { methodName: 'user.getbankcardlist', needToken: true } });
|
||||
// 获取默认的银行卡
|
||||
let getDefaultBankCard = (params, config = {}) => http.post('/Api/User/GetDefaultBankCard', params, { custom: { methodName: 'user.getdefaultbankcard', needToken: true } });
|
||||
// 添加银行卡
|
||||
let addBankCard = (params, config = {}) => http.post('/Api/User/AddBankCards', params, { custom: { methodName: 'user.addbankcard', needToken: true } });
|
||||
// 删除银行卡
|
||||
let removeBankCard = (params, config = {}) => http.post('/Api/User/Removebankcard', params, { custom: { methodName: 'user.removebankcard', needToken: true } });
|
||||
// 设置默认银行卡
|
||||
let setDefaultBankCard = (params, config = {}) => http.post('/Api/User/SetDefaultBankCard', params, { custom: { methodName: 'user.setdefaultbankcard', needToken: true } });
|
||||
// 获取银行卡信息
|
||||
let getBankCardInfo = (params, config = {}) => http.post('/Api/User/GetBankCardInfo', params, { custom: { methodName: 'user.getbankcardinfo', needToken: true } });
|
||||
// 获取银行卡组织信息
|
||||
let getBankCardOrganization = (params, config = {}) => http.post('/Api/User/GetBankCardsOrganization', params, { custom: { methodName: 'user.getbankcardorganization', needToken: true } });
|
||||
// 用户修改密码
|
||||
let editPwd = (params, config = {}) => http.post('/Api/User/EditPwd', params, { custom: { methodName: 'user.editpwd', needToken: true } });
|
||||
// 用户找回密码
|
||||
let forgotPwd = (params, config = {}) => http.post('/Api/Common/InterFaceTest', params, { custom: { methodName: 'user.forgotpwd', needToken: true } });
|
||||
// 获取用户余额明细
|
||||
let getBalanceList = (params, config = {}) => http.post('/Api/User/UserBalance', params, { custom: { methodName: 'user.balancelist', needToken: true } });
|
||||
// 用户推荐列表
|
||||
let recommendUserList = (params, config = {}) => http.post('/Api/User/Recommend', params, { custom: { methodName: 'user.recommend', needToken: true } });
|
||||
// 邀请码
|
||||
let shareCode = (params, config = {}) => http.post('/Api/User/ShareCode', params, { custom: { methodName: 'user.sharecode', needToken: true } });
|
||||
// 用户提现
|
||||
let userToCash = (params, config = {}) => http.post('/Api/User/Cash', params, { custom: { methodName: 'user.cash', needToken: true } });
|
||||
// 用户提现列表
|
||||
let cashList = (params, config = {}) => http.post('/Api/User/CashList', params, { custom: { methodName: 'user.cashlist', needToken: true } });
|
||||
// 判断用户下单可以使用多少积分
|
||||
let usablePoint = (params, config = {}) => http.post('/Api/User/GetUserPoint', params, { custom: { methodName: 'user.getuserpoint', needToken: true } });
|
||||
|
||||
// 门店列表
|
||||
let storeList = (params, config = {}) => http.post('/Api/Store/GetStoreList', params, { custom: { methodName: 'store.getstorelist', needToken: false } });
|
||||
//根据用户序列获取门店数据
|
||||
let getStoreByUserId = (params, config = {}) => http.post('/Api/Store/GetStoreByUserId', params, { custom: { methodName: 'store.getStoreByUserId', needToken: true } });
|
||||
//获取单个用户能管理的门店列表
|
||||
let getStoreListForUser = (params, config = {}) => http.post('/Api/Store/GetStoreListForUser', params, { custom: { methodName: 'store.GetStoreListForUser', needToken: true } });
|
||||
//根据序列获取门店数据
|
||||
let getStoreById = (params, config = {}) => http.post('/Api/Store/GetStoreById', params, { custom: { methodName: 'store.getStoreByUserId', needToken: false } });
|
||||
//获取门店订单列表
|
||||
let getOrderPageByMerchant = (params, config = {}) => http.post('/Api/Store/GetOrderPageByMerchant', params, { custom: { methodName: 'store.getOrderPageByMerchant', needToken: true } });
|
||||
//获取门店订单列表
|
||||
let getOrderPageByMerchantSearch = (params, config = {}) => http.post('/Api/Store/GetOrderPageByMerchantSearch', params, { custom: { methodName: 'store.getOrderPageByMerchantSearch', needToken: true } });
|
||||
|
||||
// 判断是否开启门店自提
|
||||
let switchStore = (params, config = {}) => http.post('/Api/Store/GetStoreSwitch', params, { custom: { methodName: 'store.getstoreswitch', needToken: false } });
|
||||
// 获取默认的门店
|
||||
let defaultStore = (params, config = {}) => http.post('/Api/Store/GetDefaultStore', params, { custom: { methodName: 'store.getdefaultstore', needToken: false } });
|
||||
// 判断是否开启积分
|
||||
let isPoint = (params, config = {}) => http.post('/Api/User/isPoint', params, { custom: { methodName: 'user.ispoint', needToken: false } });
|
||||
// 用户输入code领取优惠券
|
||||
let couponKey = (params, config = {}) => http.post('/Api/Coupon/GetCouponKey', params, { custom: { methodName: 'coupon.getcouponkey', needToken: true } });
|
||||
// 判断是否是店员
|
||||
let isStoreUser = (params, config = {}) => http.post('/Api/Store/IsClerk', params, { custom: { methodName: 'store.isclerk', needToken: true } });
|
||||
// 获取店铺提货单列表
|
||||
let storeLadingList = (params, config = {}) => http.post('/Api/Store/StoreLadingList', params, { custom: { methodName: 'store.storeladinglist', needToken: true } });
|
||||
// 获取提货单详情
|
||||
let ladingInfo = (params, config = {}) => http.post('/Api/Store/LadingInfo', params, { custom: { methodName: 'store.ladinginfo', needToken: true } });
|
||||
// 店铺提单核销操作
|
||||
let ladingExec = (params, config = {}) => http.post('/Api/Store/Lading', params, { custom: { methodName: 'store.lading', needToken: true } });
|
||||
// 提货单删除
|
||||
let ladingDel = (params, config = {}) => http.post('/Api/Store/LadingDelete', params, { custom: { methodName: 'store.ladingdel', needToken: true } });
|
||||
|
||||
|
||||
|
||||
// 获取活动列表
|
||||
let activityList = (params, config = {}) => http.post('/Api/Group/GetList', params, { custom: { methodName: 'group.getlist', needToken: false } });
|
||||
// 获取活动详情
|
||||
let activityDetail = (params, config = {}) => http.post('/Api/Group/GetGoodsDetial', params, { custom: { methodName: 'group.getgoodsdetial', needToken: false } });
|
||||
//小程序解析code
|
||||
let onLogin = (params, config = {}) => http.post('/Api/User/OnLogin', params, { custom: { methodName: 'user.wxappOnlogin', needToken: false } });
|
||||
//小程序登录第二步(核验数据并获取用户详细资料)
|
||||
let loginByDecodeEncryptedData = (params, config = {}) => http.post('/Api/User/DecodeEncryptedData', params, { custom: { methodName: 'user.wxapploginByDecodeEncryptedData', needToken: false } });
|
||||
//小程序同步用户数据
|
||||
let syncWeChatInfo = (params, config = {}) => http.post('/Api/User/SyncWeChatInfo', params, { custom: { methodName: 'user.SyncWeChatInfo', needToken: true } });
|
||||
//小程序手机授权(拉取手机号码)
|
||||
let loginByGetPhoneNumber = (params, config = {}) => http.post('/Api/User/DecryptPhoneNumber', params, { custom: { methodName: 'user.wxapploginByGetPhoneNumber', needToken: false } });
|
||||
//取下级地址列表
|
||||
let getAreaList = (params, config = {}) => http.post('/Api/Common/GetAreas', params, { custom: { methodName: 'user.getarealist', needToken: false } });
|
||||
//取搜索页推荐关键字
|
||||
let getRecommendKeys = (params, config = {}) => http.post('/Api/Common/GetRecommendKeys', params, { custom: { methodName: 'common.getrecommendkeys', needToken: false } });
|
||||
// 获取我的邀请信息
|
||||
let myInvite = (params, config = {}) => http.post('/Api/User/MyInvite', params, { custom: { methodName: 'user.myinvite', needToken: true } });
|
||||
// 设置我的上级邀请人
|
||||
let setMyInvite = (params, config = {}) => http.post('/Api/User/SetMyInvite', params, { custom: { methodName: 'user.SetMyInvite', needToken: true } });
|
||||
// 获取我的上级邀请人
|
||||
let getMyInvite = (params, config = {}) => http.post('/Api/User/GetMyInvite', params, { custom: { methodName: 'user.GetMyInvite', needToken: true } });
|
||||
//获取我的下级发展用户数量
|
||||
let getMyChildSum = (params, config = {}) => http.post('/Api/User/GetMyChildSum', params, { custom: { methodName: 'user.GetMyChildSum', needToken: true } });
|
||||
// 获取秒杀团购
|
||||
let getGroup = (params, config = {}) => http.post('/Api/Group/GetList', params, { custom: { methodName: 'group.getlist', needToken: false } });
|
||||
// 获取秒杀团购详情
|
||||
let groupInfo = (params, config = {}) => http.post('/Api/Group/GetGoodsDetial', params, { custom: { methodName: 'group.getgoodsdetial', needToken: false } });
|
||||
// 自定义页面
|
||||
let getPageConfig = (params, config = {}) => http.post('/Api/Page/GetPageConfig', params, { custom: { methodName: 'pages.getpageconfig', needToken: false } });
|
||||
|
||||
|
||||
// 获取分销商进度状态
|
||||
let getDistributionInfo = (params, config = {}) => http.post('/Api/Distribution/Info', params, { custom: { methodName: 'distribution_center-api-info', needToken: true } });
|
||||
// 申请分销商
|
||||
let applyDistribution = (params, config = {}) => http.post('/Api/Distribution/ApplyDistribution', params, { custom: { methodName: 'distribution_center-api-applydistribution', needToken: true } });
|
||||
// 店铺设置
|
||||
let setDistributionStore = (params, config = {}) => http.post('/Api/Distribution/SetStore', params, { custom: { methodName: 'distribution_center-api-setstore', needToken: true } });
|
||||
//获取店铺信息
|
||||
let getDistributionStoreInfo = (params, config = {}) => http.post('/Api/Distribution/GetStoreInfo', params, { custom: { methodName: 'distribution_center-api-getstoreinfo', needToken: false } });
|
||||
//我的分销订单
|
||||
let getDistributionOrder = (params, config = {}) => http.post('/Api/Distribution/MyOrder', params, { custom: { methodName: 'distribution_center-api-myorder', needToken: true } });
|
||||
//分销团队统计
|
||||
let getDistributionTeamSum = (params, config = {}) => http.post('/Api/Distribution/GetTeamSum', params, { custom: { methodName: 'distribution.getTeamSum', needToken: true } });
|
||||
//分销订单统计
|
||||
let getDistributionOrderSum = (params, config = {}) => http.post('/Api/Distribution/GetOrderSum', params, { custom: { methodName: 'distribution.getOrderSum', needToken: true } });
|
||||
//获取分销商排行
|
||||
let getDistributionRanking = (params, config = {}) => http.post('/Api/Distribution/getDistributionRanking', params, { custom: { methodName: 'distribution.getDistributionRanking', needToken: true } });
|
||||
|
||||
// 获取代理商进度状态
|
||||
let getAgentInfo = (params, config = {}) => http.post('/Api/Agent/Info', params, { custom: { methodName: 'agent_center-api-info', needToken: true } });
|
||||
// 申请代理商
|
||||
let applyAgent = (params, config = {}) => http.post('/Api/Agent/ApplyAgent', params, { custom: { methodName: 'agent_center-api-applyAgent', needToken: true } });
|
||||
// 店铺设置
|
||||
let setAgentStore = (params, config = {}) => http.post('/Api/Agent/SetStore', params, { custom: { methodName: 'agent_center-api-setstore', needToken: true } });
|
||||
//获取店铺信息
|
||||
let getAgentStoreInfo = (params, config = {}) => http.post('/Api/Agent/GetStoreInfo', params, { custom: { methodName: 'agent_center-api-getstoreinfo', needToken: false } });
|
||||
//我的代理订单
|
||||
let getAgentOrder = (params, config = {}) => http.post('/Api/Agent/MyOrder', params, { custom: { methodName: 'agent_center-api-myorder', needToken: true } });
|
||||
//代理团队统计
|
||||
let getAgentTeamSum = (params, config = {}) => http.post('/Api/Agent/GetTeamSum', params, { custom: { methodName: 'agent.getTeamSum', needToken: true } });
|
||||
//代理订单统计
|
||||
let getAgentOrderSum = (params, config = {}) => http.post('/Api/Agent/GetOrderSum', params, { custom: { methodName: 'agent.getOrderSum', needToken: true } });
|
||||
//获取代理池商品数据
|
||||
let getAgentGoodsPageList = (params, config = {}) => http.post('/Api/Agent/GetGoodsPageList', params, { custom: { methodName: 'agent.getGoodsPageList', needToken: false } });
|
||||
//获取代理商排行
|
||||
let getAgentRanking = (params, config = {}) => http.post('/Api/Agent/GetAgentRanking', params, { custom: { methodName: 'agent.getAgentRanking', needToken: true } });
|
||||
|
||||
|
||||
// 拼团列表
|
||||
let pinTuanList = (params, config = {}) => http.post('/Api/PinTuan/GetList', params, { custom: { methodName: 'pinTuan.list', needToken: false } });
|
||||
// 拼团商品详情
|
||||
let pinTuanGoodsInfo = (params, config = {}) => http.post('/Api/PinTuan/GetGoodsInfo', params, { custom: { methodName: 'pinTuan.goodsinfo', needToken: false } });
|
||||
// 拼团货品详情
|
||||
let pinTuanProductInfo = (params, config = {}) => http.post('/Api/PinTuan/GetProductInfo', params, { custom: { methodName: 'pinTuan.productinfo', needToken: false } });
|
||||
//获取我的发票列表
|
||||
let myInvoiceList = (params, config = {}) => http.post('/Api/User/UserInvoiceList', params, { custom: { methodName: 'user.myinvoicelist', needToken: true } });
|
||||
//获取支付信息
|
||||
let paymentsCheckpay = (params, config = {}) => http.post('/Api/Payments/CheckPay', params, { custom: { methodName: 'payments.checkpay', needToken: true } });
|
||||
//忘记密码
|
||||
let userForgetpwd = (params, config = {}) => http.post('/Api/User/ForgetPwd', params, { custom: { methodName: 'user.forgetpwd', needToken: false } });
|
||||
// 根据订单id取拼团信息,用在订单详情页
|
||||
let getOrderPinTuanTeamInfo = (params, config = {}) => http.post('/Api/PinTuan/GetPinTuanTeam', params, { custom: { methodName: 'pinTuan.pinTuanteam', needToken: true } });
|
||||
//发票模糊查询
|
||||
let getTaxInfo = (params, config = {}) => http.post('/Api/Order/GetTaxCode', params, { custom: { methodName: 'order.gettaxcode', needToken: true } });
|
||||
|
||||
|
||||
// 获取店铺设置
|
||||
let getSetting = (params, config = {}) => http.post('/Api/User/GetSetting', params, { custom: { methodName: 'user.getsetting', needToken: false } });
|
||||
// 获取商户配置信息
|
||||
let getSellerSetting = (params, config = {}) => http.post('/Api/User/GetSellerSetting', params, { custom: { methodName: 'user.getsellersetting', needToken: false } });
|
||||
// 获取小程序二维码
|
||||
let getInviteQRCode = (params, config = {}) => http.post('/Api/Store/GetInviteQrCode', params, { custom: { methodName: 'store.getinviteqrcode', needToken: false } });
|
||||
// 生成海报
|
||||
let createPoster = (params, config = {}) => http.post('/Api/User/GetPoster', params, { custom: { methodName: 'user.getposter', needToken: false } });
|
||||
|
||||
//获取表单列表
|
||||
let getFormList = (params, config = {}) => http.post('/Api/Form/GetList', params, { custom: { methodName: 'form.getformdetial', needToken: false } });
|
||||
//获取表单详情
|
||||
let getFormDetial = (params, config = {}) => http.post('/Api/Form/GetFormDetial', params, { custom: { methodName: 'form.getformdetial', needToken: false } });
|
||||
//============================================================//提交表单
|
||||
let addSubmitForm = (params, config = {}) => http.post('/Api/Form/AddSubmit', params, { custom: { methodName: 'form.addsubmit', needToken: false } });
|
||||
|
||||
//================================================================////抽奖规则
|
||||
let lotteryConfig = (params, config = {}) => http.post('/Api/Lottery/GetLotteryConfig', params, { custom: { methodName: 'lottery-api-getLotteryConfig', needToken: true } });
|
||||
//================================================================////抽奖操作
|
||||
let lottery = (params, config = {}) => http.post('/Api/Lottery/Lottery', params, { custom: { methodName: 'lottery-api-lottery', needToken: true } });
|
||||
//================================================================////获取我的抽奖记录
|
||||
let myLottery = (params, config = {}) => http.post('/Api/Lottery/LotteryLog', params, { custom: { methodName: 'lottery-api-lotteryLog', needToken: true } });
|
||||
//================================================================////生成分享URL
|
||||
let createShareUrl = (params, config = {}) => http.post('/Api/User/ShareUrl', params, { custom: { methodName: 'user.shareurl', needToken: false } });
|
||||
//================================================================////微信图文消息
|
||||
let messageDetail = (params, config = {}) => http.post('/Api/Articles/GetWeChatMessage', params, { custom: { methodName: 'articles.getweixinmessage', needToken: false } });
|
||||
//================================================================////获取APP版本
|
||||
let getAppVersion = (params, config = {}) => http.post('/Api/Common/GetAppVersions', params, { custom: { methodName: 'Common.checkVersion', needToken: false } });
|
||||
|
||||
//============================================================//公众号授权获取openid(第三方登录)
|
||||
let getOpenId = (params, config = {}) => http.post('/Api/User/OfficialLogin', params, { custom: { methodName: 'user.officiallogin', needToken: false } });
|
||||
//============================================================// 获取授权登录方式(获取第三方登录列表)
|
||||
let getTrustLogin = (params, config = {}) => http.post('/Api/User/GetTrustLogin', params, { custom: { methodName: 'user.gettrustlogin', needToken: false } });
|
||||
//============================================================// APP信任登录(app第三方登录方式)
|
||||
let appTrustLogin = (params, config = {}) => http.post('/Api/User/UniAppLogin', params, { custom: { methodName: 'user.uniapplogin', needToken: false } });
|
||||
//================================================================//// 绑定授权登录
|
||||
let trustBind = (params, config = {}) => http.post('/Api/User/TrustBind', params, { custom: { methodName: 'user.trustbind', needToken: false } });
|
||||
//================================================================//支付宝小程序解析code(第三方支付宝登录方式)
|
||||
let alilogin1 = (params, config = {}) => http.post('/Api/User/AlipayAppLogin1', params, { custom: { methodName: 'user.alipayapplogin1', needToken: false } });
|
||||
//================================================================////头条小程序登录
|
||||
let ttlogin = (params, config = {}) => http.post('/Api/User/TtLogin', params, { custom: { methodName: 'user.ttlogin', needToken: false } });
|
||||
//获取订阅模板
|
||||
let getSubscriptionTmplIds = (params, config = {}) => http.post('/Api/WeChatAppletsMessage/Tmpl', params, { custom: { methodName: 'wechat_applets_message-api-tmpl', needToken: true } });
|
||||
//订阅状态修改
|
||||
let setSubscriptionStatus = (params, config = {}) => http.post('/Api/WeChatAppletsMessage/SetTip', params, { custom: { methodName: 'wechat_applets_message-api-settip', needToken: true } });
|
||||
//用户关闭订阅提醒
|
||||
let subscriptionCloseTip = (params, config = {}) => http.post('/Api/WeChatAppletsMessage/CloseTip', params, { custom: { methodName: 'wechat_applets_message-api-closetip', needToken: true } });
|
||||
//判断用户是否需要显示订阅提醒
|
||||
let subscriptionIsTip = (params, config = {}) => http.post('/Api/WeChatAppletsMessage/IsTip', params, { custom: { methodName: 'wechat_applets_message-api-istip', needToken: true } });
|
||||
//统一分享
|
||||
let share = (params, config = {}) => http.post('/Api/User/Share', params, { custom: { methodName: 'user.share', needToken: false } });
|
||||
//统一分享解码
|
||||
let deshare = (params, config = {}) => http.post('/Api/User/deshare', params, { custom: { methodName: 'user.deshare', needToken: false } });
|
||||
|
||||
//获取服务列表
|
||||
let getServicelist = (params, config = {}) => http.post('/Api/Service/GetPageList', params, { custom: { methodName: 'service.getpagelist', needToken: false } });
|
||||
//获取服务详情
|
||||
let getServiceDetail = (params, config = {}) => http.post('/Api/Service/GetDetails', params, { custom: { methodName: 'service.getdetail', needToken: false } });
|
||||
//生成服务购买订单
|
||||
let addServiceOrder = (params, config = {}) => http.post('/Api/Service/AddServiceOrder', params, { custom: { methodName: 'service.addServiceOrder', needToken: true } });
|
||||
|
||||
//获取个人服务订单列表
|
||||
let getUserServicesPageList = (params, config = {}) => http.post('/Api/User/GetServicesPageList', params, { custom: { methodName: 'user.getServicesPageList', needToken: true } });
|
||||
//获取单个服务订单
|
||||
let getServicesById = (params, config = {}) => http.post('/Api/User/GetServicesById', params, { custom: { methodName: 'user.getServicesTickets', needToken: true } });
|
||||
//获取单个服务订单下面服务券
|
||||
let getServicesTickets = (params, config = {}) => http.post('/Api/User/GetServicesTickets', params, { custom: { methodName: 'user.getServicesTickets', needToken: true } });
|
||||
|
||||
|
||||
//门店核销的服务券列表
|
||||
let getverificationPageList = (params, config = {}) => http.post('/Api/Service/VerificationPageList', params, { custom: { methodName: 'service.verificationPageList', needToken: true } });
|
||||
//删除核销券
|
||||
let serviceLogDelete = (params, config = {}) => http.post('/Api/Service/LogDelete', params, { custom: { methodName: 'service.logDelete', needToken: true } });
|
||||
// 获取服务券详情准备核销
|
||||
let getServiceVerificationTicketInfo = (params, config = {}) => http.post('/Api/Service/GetTicketInfo', params, { custom: { methodName: 'service.getTicketInfo', needToken: true } });
|
||||
//核销服务券
|
||||
let serviceVerificationTicket = (params, config = {}) => http.post('/Api/Service/VerificationTicket', params, { custom: { methodName: 'service.verificationTicket', needToken: true } });
|
||||
|
||||
|
||||
//获取接龙列表
|
||||
let getSolitairePageList = (params, config = {}) => http.post('/Api/Solitaire/GetList', params, { custom: { methodName: 'solitaire.getList', needToken: false } });
|
||||
let getSolitaireDetail = (params, config = {}) => http.post('/Api/Solitaire/GetDetail', params, { custom: { methodName: 'solitaire.getDetail', needToken: false } });
|
||||
|
||||
|
||||
//直播
|
||||
let getLiveInfo = (params, config = {}) => http.post('/Api/LiveBroadCast/GetLiveInfo', params, { custom: { methodName: 'liveBroadCast.getLiveInfo', needToken: false } });
|
||||
|
||||
|
||||
//充值规则列表
|
||||
let getTopUpTypeList = (params, config = {}) => http.post('/Api/TopUp/TypeList', params, { custom: { methodName: 'topUp.typeList', needToken: false } });
|
||||
//获取单个充值规则
|
||||
let getTypeDetail = (params, config = {}) => http.post('/Api/TopUp/getTypeDetail', params, { custom: { methodName: 'topUp.getTypeDetail', needToken: false } });
|
||||
|
||||
|
||||
|
||||
//本地选择图片转base64,再上传服务器存储返回地址
|
||||
let uploadFilesFByBase64 = (params, config = {}) => http.post('/Api/Common/UploadFilesFByBase64', params, { custom: { methodName: 'topUp.uploadFilesFByBase64', needToken: true } });
|
||||
|
||||
//获取全局促销列表
|
||||
let getPromotionList = (params, config = {}) => http.post('/Api/Promotion/GetPromotionList', params, { custom: { methodName: 'promotion.getPromotionList', needToken: false } });
|
||||
|
||||
//获取发票是否开具
|
||||
let checkInvoice = (params, config = {}) => http.post('/Api/Order/CheckInvoice', params, { custom: { methodName: 'order.checkInvoice', needToken: true } });
|
||||
//提交发票申请
|
||||
let submitInvoiceApply = (params, config = {}) => http.post('/Api/Order/SubmitInvoiceApply', params, { custom: { methodName: 'order.submitInvoiceApply', needToken: true } });
|
||||
|
||||
|
||||
//支付宝解析code
|
||||
let getAliPayAppAuthTokenBYCode = (params, config = {}) => http.post('/Api/AliPayAuth/getAliPayAppAuthTokenBYCode', params, { custom: { methodName: 'user.GetAliPayAppAuthTokenByCode', needToken: false } });
|
||||
//支付宝小程序手机授权(拉取手机号码)
|
||||
let loginByGetPhoneNumberForAli = (params, config = {}) => http.post('/Api/User/DecryptPhoneNumberByAli', params, { custom: { methodName: 'user.loginByGetPhoneNumberForAli', needToken: false } });
|
||||
|
||||
//查询当前订单是否接入微信发货信息管理
|
||||
let orderShippingList = (params, config = {}) => http.post('/Api/Order/OrderShippingList', params, { custom: { methodName: 'order.orderShippingList', needToken: true } });
|
||||
//根据订单编号获取当前订单的支付信息
|
||||
let getOrderPayInfo = (params, config = {}) => http.post('/Api/Order/GetOrderPayInfo', params, { custom: { methodName: 'order.getOrderPayInfo', needToken: true } });
|
||||
|
||||
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
|
||||
vm.$u.api = {
|
||||
shopConfigV2,
|
||||
getServiceDescription,
|
||||
userInfo,
|
||||
changeAvatar,
|
||||
editInfo,
|
||||
sms,
|
||||
smsLogin,
|
||||
logout,
|
||||
slider,
|
||||
advert,
|
||||
notice,
|
||||
noticeInfo,
|
||||
articleInfo,
|
||||
articleList,
|
||||
articleClassify,
|
||||
|
||||
categories,
|
||||
goodsList,
|
||||
goodsDetail,
|
||||
getGoodsRecommendList,
|
||||
goodsDetailByToken,
|
||||
goodsParams,
|
||||
getProductInfo,
|
||||
goodsComment,
|
||||
goodsSku,
|
||||
goodsSkuByToken,
|
||||
|
||||
addCart,
|
||||
removeCart,
|
||||
cartList,
|
||||
setCartNum,
|
||||
getCartNum,
|
||||
getCartNumAndMoney,
|
||||
getCartCoupon,
|
||||
userShip,
|
||||
userDefaultShip,
|
||||
saveUserShip,
|
||||
saveUserShipWx,
|
||||
getAreaId,
|
||||
getAreaIdByName,
|
||||
shipDetail,
|
||||
editShip,
|
||||
removeShip,
|
||||
setDefShip,
|
||||
createOrder,
|
||||
cancelOrder,
|
||||
delOrder,
|
||||
orderDetail,
|
||||
confirmOrder,
|
||||
orderShip,
|
||||
orderList,
|
||||
getOrderStatusSum,
|
||||
getOrderDistributionModel,
|
||||
afterSalesList,
|
||||
afterSalesInfo,
|
||||
addAfterSales,
|
||||
sendShip,
|
||||
addGoodsBrowsing,
|
||||
delGoodsBrowsing,
|
||||
delGoodsBrowsing,
|
||||
goodsBrowsing,
|
||||
goodsCollection,
|
||||
goodsCollectionList,
|
||||
paymentList,
|
||||
paymentInfo,
|
||||
pay,
|
||||
orderEvaluate,
|
||||
|
||||
userCheckIn,
|
||||
getUserCheckByMonth,
|
||||
getUserCheckCount,
|
||||
|
||||
pointLog,
|
||||
logistics,
|
||||
couponList,
|
||||
couponDetail,
|
||||
getCoupon,
|
||||
userCoupon,
|
||||
getBankCardList,
|
||||
getDefaultBankCard,
|
||||
addBankCard,
|
||||
removeBankCard,
|
||||
setDefaultBankCard,
|
||||
getBankCardInfo,
|
||||
getBankCardOrganization,
|
||||
editPwd,
|
||||
forgotPwd,
|
||||
getBalanceList,
|
||||
recommendUserList,
|
||||
shareCode,
|
||||
userToCash,
|
||||
cashList,
|
||||
usablePoint,
|
||||
|
||||
storeList,
|
||||
getStoreByUserId,
|
||||
getStoreListForUser,
|
||||
getStoreById,
|
||||
getOrderPageByMerchant,
|
||||
getOrderPageByMerchantSearch,
|
||||
switchStore,
|
||||
defaultStore,
|
||||
isPoint,
|
||||
couponKey,
|
||||
isStoreUser,
|
||||
storeLadingList,
|
||||
|
||||
ladingInfo,
|
||||
ladingExec,
|
||||
ladingDel,
|
||||
activityList,
|
||||
activityDetail,
|
||||
onLogin,
|
||||
loginByDecodeEncryptedData,
|
||||
syncWeChatInfo,
|
||||
loginByGetPhoneNumber,
|
||||
getAreaList,
|
||||
getRecommendKeys,
|
||||
myInvite,
|
||||
setMyInvite,
|
||||
getMyInvite,
|
||||
getMyChildSum,
|
||||
getGroup,
|
||||
groupInfo,
|
||||
getPageConfig,
|
||||
|
||||
getDistributionInfo,
|
||||
applyDistribution,
|
||||
setDistributionStore,
|
||||
getDistributionStoreInfo,
|
||||
getDistributionOrder,
|
||||
getDistributionTeamSum,
|
||||
getDistributionOrderSum,
|
||||
getDistributionRanking,
|
||||
|
||||
getAgentInfo,
|
||||
applyAgent,
|
||||
setAgentStore,
|
||||
getAgentStoreInfo,
|
||||
getAgentOrder,
|
||||
getAgentTeamSum,
|
||||
getAgentOrderSum,
|
||||
getAgentGoodsPageList,
|
||||
getAgentRanking,
|
||||
|
||||
pinTuanList,
|
||||
pinTuanGoodsInfo,
|
||||
pinTuanProductInfo,
|
||||
myInvoiceList,
|
||||
paymentsCheckpay,
|
||||
userForgetpwd,
|
||||
getOrderPinTuanTeamInfo,
|
||||
getTaxInfo,
|
||||
getSetting,
|
||||
getSellerSetting,
|
||||
getInviteQRCode,
|
||||
createPoster,
|
||||
getFormDetial,
|
||||
getFormList,
|
||||
addSubmitForm,
|
||||
lotteryConfig,
|
||||
lottery,
|
||||
myLottery,
|
||||
createShareUrl,
|
||||
messageDetail,
|
||||
getAppVersion,
|
||||
getOpenId,
|
||||
getTrustLogin,
|
||||
appTrustLogin,
|
||||
trustBind,
|
||||
ttlogin,
|
||||
alilogin1,
|
||||
getSubscriptionTmplIds,
|
||||
setSubscriptionStatus,
|
||||
subscriptionCloseTip,
|
||||
subscriptionIsTip,
|
||||
share,
|
||||
deshare,
|
||||
getServicelist,
|
||||
getServiceDetail,
|
||||
addServiceOrder,
|
||||
getUserServicesPageList,
|
||||
getServicesById,
|
||||
getServicesTickets,
|
||||
getverificationPageList,
|
||||
serviceLogDelete,
|
||||
getServiceVerificationTicketInfo,
|
||||
serviceVerificationTicket,
|
||||
|
||||
getSolitairePageList,
|
||||
getSolitaireDetail,
|
||||
|
||||
getLiveInfo,
|
||||
|
||||
getTopUpTypeList,
|
||||
getTypeDetail,
|
||||
|
||||
|
||||
uploadFilesFByBase64,
|
||||
getPromotionList,
|
||||
checkInvoice,
|
||||
submitInvoiceApply,
|
||||
|
||||
getAliPayAppAuthTokenBYCode,
|
||||
loginByGetPhoneNumberForAli,
|
||||
|
||||
orderShippingList,
|
||||
getOrderPayInfo
|
||||
};
|
||||
}
|
||||
|
||||
export default {
|
||||
install
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
import { apiBaseUrl } from '@/common/setting/constVarsHelper.js';
|
||||
import * as db from '@/common/utils/dbHelper.js' //引入common
|
||||
|
||||
// 此vm参数为页面的实例,可以通过它引用vuex中的变量
|
||||
module.exports = (vm) => {
|
||||
// 初始化请求配置
|
||||
uni.$u.http.setConfig((defaultConfig) => {
|
||||
/* defaultConfig 为默认全局配置 */
|
||||
defaultConfig.baseURL = apiBaseUrl; /* 根域名 */
|
||||
//defaultConfig.header = {
|
||||
// 'Content-type': 'application/json1'
|
||||
//};
|
||||
defaultConfig.method = 'POST';
|
||||
defaultConfig.dataType = 'json';
|
||||
// #ifndef MP-ALIPAY
|
||||
defaultConfig.responseType = 'text';
|
||||
// #endif
|
||||
// 注:如果局部custom与全局custom有同名属性,则后面的属性会覆盖前面的属性,相当于Object.assign(全局,局部)
|
||||
//defaultConfig.custom = {}; // 全局自定义参数默认值
|
||||
// #ifdef APP-PLUS || MP-ALIPAY || MP-WEIXIN
|
||||
defaultConfig.timeout = 60000;
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
defaultConfig.sslVerify = true;
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
defaultConfig.firstIpv4 = false; // DNS解析时优先使用ipv4 仅 App-Android 支持 (HBuilderX 2.8.0+)
|
||||
// #endif
|
||||
// 局部优先级高于全局,返回当前请求的task,options。请勿在此处修改options。非必填
|
||||
// getTask: (task, options) => {
|
||||
// 相当于设置了请求超时时间500ms
|
||||
// setTimeout(() => {
|
||||
// task.abort()
|
||||
// }, 500)
|
||||
// },
|
||||
// 全局自定义验证器。参数为statusCode 且必存在,不用判断空情况。
|
||||
defaultConfig.validateStatus = (statusCode) => { // statusCode 必存在。此处示例为全局默认配置
|
||||
return statusCode >= 200 && statusCode < 501
|
||||
}
|
||||
|
||||
return defaultConfig
|
||||
})
|
||||
|
||||
// 请求拦截
|
||||
uni.$u.http.interceptors.request.use((config) => { // 可使用async await 做异步操作
|
||||
// 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{}
|
||||
config.data = config.data || {}
|
||||
|
||||
if (config?.custom?.needToken) {
|
||||
// 获取用户token
|
||||
const userToken = db.get("userToken");
|
||||
if (!userToken) {
|
||||
//console.log("开启弹窗");
|
||||
vm.$store.commit('showLoginTip', true);
|
||||
//console.log("弹窗已经开启");
|
||||
//return false;
|
||||
} else {
|
||||
config.header.Authorization = 'Bearer ' + userToken;
|
||||
}
|
||||
}
|
||||
//额外需求
|
||||
if (config.custom.methodName == 'user.share') {
|
||||
const userToken = db.get("userToken");
|
||||
config.header.Authorization = 'Bearer ' + userToken;
|
||||
}
|
||||
|
||||
return config
|
||||
}, config => { // 可使用async await 做异步操作
|
||||
return Promise.reject(config)
|
||||
})
|
||||
|
||||
// 响应拦截
|
||||
uni.$u.http.interceptors.response.use((response) => { /* 对响应成功做点什么 可使用async await 做异步操作*/
|
||||
//console.log(response);
|
||||
const data = response.data
|
||||
if (response.statusCode == 200) {
|
||||
let pages = getCurrentPages();
|
||||
var page = pages[pages.length - 1];
|
||||
|
||||
if (!data.status && page) {
|
||||
// 登录信息过期或者未登录
|
||||
if (data.data === 14007 || data.data === 14006) {
|
||||
// #ifdef APP-PLUS || APP-PLUS-NVUE
|
||||
if (page.route.indexOf('pages/login/loginBySMS/loginBySMS') < 0) {
|
||||
db.del("userToken");
|
||||
uni.showToast({
|
||||
title: result.msg,
|
||||
icon: 'none',
|
||||
duration: 1000,
|
||||
complete: function () {
|
||||
setTimeout(function () {
|
||||
uni.hideToast();
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/loginBySMS/loginBySMS'
|
||||
});
|
||||
},
|
||||
1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN || MP-ALIPAY || MP-TOUTIAO
|
||||
db.del("userToken");
|
||||
vm.$store.commit('userInfo', null);
|
||||
//console.log("开启登录弹窗");
|
||||
vm.$store.commit('hasLogin', false);
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
}
|
||||
return data === undefined ? {} : data
|
||||
}, (response) => {
|
||||
// 对响应错误做点什么 (statusCode !== 200)
|
||||
return Promise.reject(response)
|
||||
})
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
/**
|
||||
* 全局配置文件
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
//接口请求地址,如果需要不部署接口端的情况下测试uni-app,可以直接替换为官方测试接口:https://api.demo.coreshop.cn
|
||||
export const apiBaseUrl = process.env.NODE_ENV === 'development' ? 'https://api.pro.demo.corecms.cn' : 'https://api.pro.demo.corecms.cn';
|
||||
|
||||
//项目静态资源请求地址,如果使用官方的静态文件地址可以直接替换为:https://files.cdn.coreshop.cn
|
||||
export const apiFilesUrl = 'https://files.cdn.coreshop.cn';
|
||||
|
||||
//支付单类型
|
||||
export const paymentType = {
|
||||
//普通订单
|
||||
common: 1,
|
||||
//拼团订单
|
||||
pinTuan: 2,
|
||||
//团购订单
|
||||
group: 3,
|
||||
//秒杀订单
|
||||
seckill: 4,
|
||||
//砍价
|
||||
bargain: 6,
|
||||
//赠品
|
||||
giveaway: 7,
|
||||
//接龙
|
||||
solitaire: 8,
|
||||
//交易组件
|
||||
transactionComponent: 10,
|
||||
//充值
|
||||
recharge: 201,
|
||||
//服务订单
|
||||
serviceOrder: 501,
|
||||
//表单付款码
|
||||
formPay: 301,
|
||||
//表单订单
|
||||
formOrder: 302,
|
||||
};
|
||||
|
||||
//分享链接及海报类型
|
||||
export const shareType = {
|
||||
// 首页
|
||||
index: 1,
|
||||
// 2商品详情页
|
||||
goods: 2,
|
||||
// 3拼团详情页
|
||||
pinTuan: 3,
|
||||
// 4分销店铺
|
||||
inv: 4,
|
||||
// 5文章页面
|
||||
article: 5,
|
||||
// 6参团页面
|
||||
addPinTuan: 6,
|
||||
// 7自定义页面
|
||||
page: 7,
|
||||
// 8智能表单
|
||||
form: 8,
|
||||
// 9团购
|
||||
group: 9,
|
||||
// 10秒杀
|
||||
seckill: 10,
|
||||
// 11代理店铺
|
||||
agent: 11,
|
||||
// 12接龙
|
||||
solitaire: 12,
|
||||
// 13 服务商品
|
||||
serviceGoods: 13
|
||||
};
|
||||
|
||||
//分享终端
|
||||
export const shareClient = {
|
||||
// 普通h5
|
||||
h5: 1,
|
||||
// 微信小程序
|
||||
wxMiNiProgram: 2,
|
||||
// 微信公众号(h5)
|
||||
wxOfficial: 3,
|
||||
// 头条系小程序
|
||||
ttMiNiProgram: 4,
|
||||
// 电脑pc端
|
||||
pc: 5,
|
||||
// 阿里小程序
|
||||
aLiMiNiProgram: 6,
|
||||
};
|
||||
|
||||
|
||||
//分享终端
|
||||
export const shareModel = {
|
||||
// 链接分享
|
||||
url: 1,
|
||||
// 二维码
|
||||
qrCode: 2,
|
||||
// 海报
|
||||
poster: 3,
|
||||
};
|
||||
|
||||
export const shareUrl = 'pages/share/jump/jump'; //分享初始化地址
|
||||
|
||||
|
||||
//列表加载状态
|
||||
export const loadStatus = {
|
||||
// 加载前的状态
|
||||
loadMore: 'loadmore',
|
||||
// 加载中的状态
|
||||
loading: 'loading',
|
||||
// 没有更多的状态
|
||||
noMore: 'nomore',
|
||||
};
|
||||
|
||||
|
||||
//优惠促销类型
|
||||
export const promotionType = {
|
||||
// 促销
|
||||
promotion: 1,
|
||||
|
||||
// 优惠券
|
||||
coupon: 2,
|
||||
|
||||
// 团购
|
||||
group: 3,
|
||||
|
||||
// 秒杀
|
||||
seckill: 4,
|
||||
};
|
||||
|
||||
|
||||
|
||||
//nav页面导航类型
|
||||
export const navLinkType = {
|
||||
urlLink: 1, //"URL链接"
|
||||
shop: 2,// "商品"
|
||||
article: 3,// "文章"
|
||||
articleCategory: 4,// "文章分类",
|
||||
intelligentForms: 5,// "智能表单"
|
||||
shopCategory: 6,// "商品分类"
|
||||
wxMiNiProgram: 7// "跳转小程序Appid"
|
||||
};
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
const store = new Vuex.Store({
|
||||
state: {
|
||||
config: {
|
||||
shopLogo: "/static/images/logo/logo.png"
|
||||
}, // 店铺配置信息 //添加一个前端项目中的图片地址
|
||||
orderTab: 0, // 选中的订单tab页
|
||||
scene: 0, // 选中的订单tab页
|
||||
redirectPage: '',
|
||||
uuid: '',//当前客户端
|
||||
searchStyle: '',
|
||||
sessionAuthId: '', //微信缓存授权信息
|
||||
searchFixed: false,//搜索框样式
|
||||
showLoginTip: false,//显示登录框
|
||||
hasLogin: false,//存储用户当前是否登录,作为切换特效使用
|
||||
userShip: {}, //地区信息
|
||||
userInfo: {}, //用户信息存储
|
||||
invoice: {}, //发票信息
|
||||
},
|
||||
mutations: {
|
||||
config(state, payload) {
|
||||
state.config = payload
|
||||
},
|
||||
orderTab(state, tab) {
|
||||
state.orderTab = tab
|
||||
},
|
||||
scene(state, tab) {
|
||||
state.scene = tab
|
||||
},
|
||||
redirect(state, payload) {
|
||||
state.redirectPage = payload.page
|
||||
},
|
||||
searchStyle(state, style) {
|
||||
state.searchStyle = style
|
||||
},
|
||||
sessionAuthId(state, payload) {
|
||||
state.sessionAuthId = payload
|
||||
},
|
||||
searchFixed(state, payload) {
|
||||
state.searchFixed = payload
|
||||
},
|
||||
showLoginTip(state, payload) {
|
||||
state.showLoginTip = payload
|
||||
},
|
||||
hasLogin(state, payload) {
|
||||
state.hasLogin = payload
|
||||
},
|
||||
userShip(state, userShip) {
|
||||
state.userShip = userShip
|
||||
},
|
||||
userInfo(state, userInfo) {
|
||||
state.userInfo = userInfo
|
||||
},
|
||||
invoice(state, invoice) {
|
||||
state.invoice = invoice
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
||||
},
|
||||
getters: {
|
||||
shopConfig: state => state.config,
|
||||
scene: state => state.scene,
|
||||
userInfo: state => state.userInfo,
|
||||
uuid: state => state.uuid,
|
||||
hasLogin: state => state.hasLogin,
|
||||
sessionAuthId: state => state.sessionAuthId,
|
||||
}
|
||||
})
|
||||
|
||||
export default store
|
||||
@@ -1,80 +0,0 @@
|
||||
|
||||
// 提示框
|
||||
function modelShow(
|
||||
title = '提示',
|
||||
content = '确认执行此操作吗?',
|
||||
callback = () => { },
|
||||
showCancel = true,
|
||||
cancelText = '取消',
|
||||
confirmText = '确定'
|
||||
) {
|
||||
uni.showModal({
|
||||
title: title,
|
||||
content: content,
|
||||
showCancel: showCancel,
|
||||
cancelText: cancelText,
|
||||
confirmText: confirmText,
|
||||
cancelText: cancelText,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
// 用户点击确定操作
|
||||
setTimeout(() => {
|
||||
callback()
|
||||
}, 500)
|
||||
} else if (res.cancel) {
|
||||
// 用户取消操作
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
//货币格式化
|
||||
function formatMoney(number, places, symbol, thousand, decimal) {
|
||||
number = number || 0
|
||||
places = !isNaN((places = Math.abs(places))) ? places : 2
|
||||
symbol = symbol !== undefined ? symbol : '¥'
|
||||
thousand = thousand || ','
|
||||
decimal = decimal || '.'
|
||||
var negative = number < 0 ? '-' : '',
|
||||
i = parseInt((number = Math.abs(+number || 0).toFixed(places)), 10) + '',
|
||||
j = (j = i.length) > 3 ? j % 3 : 0
|
||||
return (
|
||||
symbol +
|
||||
negative +
|
||||
(j ? i.substr(0, j) + thousand : '') +
|
||||
i.substr(j).replace(/(\d{3})(?=\d)/g, '$1' + thousand) +
|
||||
(places ?
|
||||
decimal +
|
||||
Math.abs(number - i)
|
||||
.toFixed(places)
|
||||
.slice(2) :
|
||||
'')
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 金额相加
|
||||
* @param {Object} value1
|
||||
* @param {Object} value2
|
||||
*/
|
||||
function moneySum(value1, value2) {
|
||||
return (parseFloat(value1) + parseFloat(value2)).toFixed(2);
|
||||
}
|
||||
/**
|
||||
* 金额相减
|
||||
* @param {Object} value1
|
||||
* @param {Object} value2
|
||||
*/
|
||||
function moneySub(value1, value2) {
|
||||
let res = (parseFloat(value1) - parseFloat(value2)).toFixed(2);
|
||||
return res > 0 ? res : 0;
|
||||
}
|
||||
|
||||
|
||||
export {
|
||||
formatMoney,
|
||||
modelShow,
|
||||
moneySum,
|
||||
moneySub,
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
|
||||
//取值
|
||||
function get(key, sync = true) {
|
||||
try {
|
||||
if (sync) {
|
||||
return uni.getStorageSync(key);
|
||||
} else {
|
||||
let data = '';
|
||||
uni.getStorage({
|
||||
key: key,
|
||||
success: function (res) {
|
||||
data = res.data;
|
||||
}
|
||||
});
|
||||
return data;
|
||||
}
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//赋值
|
||||
function set(key, value, sync = true) {
|
||||
try {
|
||||
if (sync) {
|
||||
return uni.setStorageSync(key, value);
|
||||
} else {
|
||||
uni.setStorage({
|
||||
key: key,
|
||||
data: value
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//移除
|
||||
function del(key, sync = true) {
|
||||
try {
|
||||
if (sync) {
|
||||
return uni.removeStorageSync(key);
|
||||
} else {
|
||||
uni.removeStorage({
|
||||
key: key
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//清空
|
||||
function clear(sync = true) {
|
||||
try {
|
||||
if (sync) {
|
||||
return uni.clearStorageSync();
|
||||
} else {
|
||||
uni.clearStorage();
|
||||
}
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
get,
|
||||
set,
|
||||
del,
|
||||
clear
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
import { apiBaseUrl } from '@/common/setting/constVarsHelper.js';
|
||||
import * as db from './dbHelper.js' //引入common
|
||||
|
||||
const showError = error => {
|
||||
let errorMsg = '';
|
||||
switch (error.status) {
|
||||
case 400:
|
||||
errorMsg = '请求参数错误';
|
||||
break;
|
||||
case 401:
|
||||
errorMsg = '未授权,请登录';
|
||||
break;
|
||||
case 403:
|
||||
errorMsg = '跨域拒绝访问';
|
||||
break;
|
||||
case 404:
|
||||
errorMsg = `请求地址出错: ${error.config.url}`;
|
||||
break;
|
||||
case 408:
|
||||
errorMsg = '请求超时';
|
||||
break;
|
||||
case 500:
|
||||
errorMsg = '服务器内部错误';
|
||||
break;
|
||||
case 501:
|
||||
errorMsg = '服务未实现';
|
||||
break;
|
||||
case 502:
|
||||
errorMsg = '网关错误';
|
||||
break;
|
||||
case 503:
|
||||
errorMsg = '服务不可用';
|
||||
break;
|
||||
case 504:
|
||||
errorMsg = '网关超时';
|
||||
break;
|
||||
case 505:
|
||||
errorMsg = 'HTTP版本不受支持';
|
||||
break;
|
||||
default:
|
||||
errorMsg = error.msg;
|
||||
break;
|
||||
}
|
||||
uni.showToast({
|
||||
title: errorMsg,
|
||||
icon: 'none',
|
||||
duration: 1000,
|
||||
complete: function () {
|
||||
setTimeout(function () {
|
||||
uni.hideToast();
|
||||
},
|
||||
1000);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 文件上传
|
||||
export const uploadFiles = (data, callback) => {
|
||||
// 获取用户token
|
||||
let userToken = db.get("userToken");
|
||||
if (!userToken) {
|
||||
this.$store.commit('showLoginTip', true);
|
||||
return false;
|
||||
};
|
||||
uni.chooseImage({
|
||||
success: (chooseImageRes) => {
|
||||
uni.showLoading({
|
||||
title: '上传中...'
|
||||
});
|
||||
const tempFilePaths = chooseImageRes.tempFilePaths;
|
||||
const uploadTask = uni.uploadFile({
|
||||
url: apiBaseUrl + '/Api/Common/UploadImages',
|
||||
filePath: tempFilePaths[0],
|
||||
fileType: 'image',
|
||||
name: 'file',
|
||||
header: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'multipart/form-data',
|
||||
'Authorization': 'Bearer ' + userToken
|
||||
},
|
||||
formData: {
|
||||
'method': 'images.upload',
|
||||
'upfile': tempFilePaths[0]
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
//console.log("交互成功");
|
||||
//console.log(uploadFileRes);
|
||||
callback(JSON.parse(uploadFileRes.data));
|
||||
},
|
||||
fail: (error) => {
|
||||
console.log("交互失败");
|
||||
console.log(error);
|
||||
if (error && error.response) {
|
||||
showError(error.response);
|
||||
}
|
||||
},
|
||||
complete: () => {
|
||||
setTimeout(function () {
|
||||
uni.hideLoading();
|
||||
},
|
||||
250);
|
||||
}
|
||||
});
|
||||
//uploadTask.onProgressUpdate((res) => {
|
||||
// console.log('上传进度' + res.progress);
|
||||
// console.log('已经上传的数据长度' + res.totalBytesSent);
|
||||
// console.log('预期需要上传的数据总长度' + res.totalBytesExpectedToSend);
|
||||
|
||||
// // 测试条件,取消上传任务。
|
||||
// if (res.progress > 50) {
|
||||
// uploadTask.abort();
|
||||
// }
|
||||
//});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 上传图片
|
||||
export const uploadImage = (num, callback) => {
|
||||
|
||||
// 获取用户token
|
||||
let userToken = db.get("userToken");
|
||||
if (!userToken) {
|
||||
this.$store.commit('showLoginTip', true);
|
||||
return false;
|
||||
};
|
||||
|
||||
uni.chooseImage({
|
||||
count: num,
|
||||
success: (res) => {
|
||||
uni.showLoading({
|
||||
title: '上传中...'
|
||||
});
|
||||
let tempFilePaths = res.tempFilePaths;
|
||||
for (var i = 0; i < tempFilePaths.length; i++) {
|
||||
uni.uploadFile({
|
||||
url: apiBaseUrl + '/Api/Common/UploadImages',
|
||||
filePath: tempFilePaths[i],
|
||||
fileType: 'image',
|
||||
name: 'file',
|
||||
header: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'multipart/form-data',
|
||||
'Authorization': 'Bearer ' + userToken
|
||||
},
|
||||
formData: {
|
||||
'method': 'images.upload',
|
||||
'upfile': tempFilePaths[i]
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
callback(JSON.parse(uploadFileRes.data));
|
||||
},
|
||||
fail: (error) => {
|
||||
if (error && error.response) {
|
||||
showError(error.response);
|
||||
}
|
||||
},
|
||||
complete: () => {
|
||||
setTimeout(function () {
|
||||
uni.hideLoading();
|
||||
},
|
||||
250);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
.banner-box {
|
||||
.img {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
@@ -1,66 +1,53 @@
|
||||
<template>
|
||||
<view>
|
||||
<!--提示框组件-->
|
||||
<u-toast ref="uToast" />
|
||||
<view v-if="position && advert">
|
||||
<view v-if="position.type==1">
|
||||
<view v-for="(item, index) in advert" :key="index">
|
||||
<u--image :showLoading="true" :src="item.imageUrl" mode="widthFix" width="100%" height="auto" @click="showSliderInfo(item.type, item.val)"></u--image>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<u-swiper :list="advert" indicator indicatorMode="line" circular keyName="imageUrl" :showTitle="showTitle" @click="clickSwiper"></u-swiper>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="banner-box" v-if="state.bannerList.length > 0">
|
||||
<swiper class="swiper" :style="{'height':props.height}" circular :indicator-dots="state.bannerList.length > 1"
|
||||
indicator-active-color="#D33123" :autoplay="true" :interval="3000">
|
||||
<swiper-item v-for="item, index in state.bannerList" :key="index" @click="handleClickImg(item)">
|
||||
<image class="img radius-15" :style="{'height':props.height}" :src="item.imageUrl" mode="aspectFill">
|
||||
</image>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive } from 'vue';
|
||||
import { Response, AdvertPositionType, PositionType } from '@/core/models';
|
||||
import { queryPositionList } from '@/core/api';
|
||||
import { handleAdvertiseDetail } from '@/core/utils';
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
code: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: 'tpl1_class_banner1'
|
||||
},
|
||||
showTitle: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
position: {},
|
||||
advert: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getData();
|
||||
},
|
||||
methods: {
|
||||
getData() {
|
||||
this.$u.api.advert({
|
||||
code: this.code,
|
||||
platform: 3
|
||||
}).then(res => {
|
||||
if (res.status) {
|
||||
this.advert = res.data.childs;
|
||||
this.position = res.data.position;
|
||||
if (this.advert) {
|
||||
for (var i = 0; i < this.advert.length; i++) {
|
||||
this.advert[i].title = this.advert[i].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
clickSwiper(index) {
|
||||
console.log(index);
|
||||
this.showSliderInfo(this.advert[index].type, this.advert[index].val)
|
||||
}
|
||||
},
|
||||
}
|
||||
const props = withDefaults(defineProps<{
|
||||
code : string,
|
||||
height : string
|
||||
}>(), {
|
||||
code: '',
|
||||
height: '200rpx'
|
||||
});
|
||||
|
||||
const state = reactive<{
|
||||
bannerList : Array<PositionType>;
|
||||
bannerPosition : PositionType,
|
||||
}>({
|
||||
bannerList: [],
|
||||
bannerPosition: {},
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
getPositionList();
|
||||
})
|
||||
|
||||
const getPositionList = async () => {
|
||||
const positionList : Response<AdvertPositionType> = await queryPositionList({
|
||||
code: props.code,
|
||||
platform: 3,
|
||||
});
|
||||
state.bannerList = positionList.data?.childs || [];
|
||||
state.bannerPosition = positionList.data.position || {};
|
||||
}
|
||||
|
||||
const handleClickImg = (item : any) => {
|
||||
handleAdvertiseDetail(item.type, item.val)
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
@import './coreshop-advert.scss';
|
||||
</style>
|
||||
@@ -0,0 +1,36 @@
|
||||
.article-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.article-img {
|
||||
display: flex;
|
||||
|
||||
.img {
|
||||
width: 180rpx;
|
||||
height: 180rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.article-msg {
|
||||
flex: 1;
|
||||
margin-left: 20rpx;
|
||||
justify-content: space-between;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.title {
|
||||
height: 80rpx;
|
||||
overflow: hidden;
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.desc {
|
||||
height: 96rpx;
|
||||
overflow: hidden;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<view class="article-box">
|
||||
<view class="article-img" @click="handleClickArticle">
|
||||
<image class="img" :src="props.data?.image || handleStaticResources('/static/images/common/empty.png')">
|
||||
</image>
|
||||
</view>
|
||||
<view class="article-msg" @click="handleClickArticle">
|
||||
<view class="title">
|
||||
{{props.data?.title}}
|
||||
</view>
|
||||
<view class="desc">
|
||||
{{props.data?.brief}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { handleStaticResources } from '@/core/utils';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
data : any,
|
||||
}>(), {
|
||||
data: {},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['handleClickArticle'])
|
||||
|
||||
const handleClickArticle = () => {
|
||||
emit('handleClickArticle', props.data.id);
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import './coreshop-article.scss';
|
||||
</style>
|
||||
@@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<view class="btn" :style="{'border-radius':radiusComp,'background-color':props.backgroundColor,'color':props.color}" @click="onClick()">
|
||||
{{props.title}}
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
|
||||
const emits = defineEmits(['onClick']);
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
title : string;
|
||||
radius ?: number;
|
||||
backgroundColor ?: string;
|
||||
color ?: string;
|
||||
}>(), {
|
||||
title: '保存',
|
||||
radius: 44,
|
||||
backgroundColor: '#D33123',
|
||||
color: '#FFFFFF'
|
||||
})
|
||||
|
||||
const radiusComp = computed(() => `${props.radius}px`);
|
||||
|
||||
const onClick = () => {
|
||||
emits('onClick');
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 88rpx;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,11 @@
|
||||
.coreshop-copyright {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-bottom: 20rpx;
|
||||
align-items: center;
|
||||
.tit {
|
||||
margin-bottom: 8rpx;
|
||||
font-size: 20rpx;
|
||||
color: #aaa;
|
||||
}
|
||||
}
|
||||
@@ -1,43 +1,23 @@
|
||||
<template>
|
||||
<view class="coreshop-copyright">
|
||||
<view class="coreshop-font-xs">
|
||||
© {{shopName}} 品牌运营
|
||||
</view>
|
||||
<view class="coreshop-font-xs" v-if="shopBeiAn">
|
||||
<view>备案号:{{shopBeiAn}}</view>
|
||||
</view>
|
||||
<view class="coreshop-font-xs">
|
||||
Powered by CoreShop
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-copyright">
|
||||
<view class="tit">
|
||||
© {{shopConfigStore.config?.shopName }} 品牌运营
|
||||
</view>
|
||||
<view class="tit" v-if="shopConfigStore.config?.shopBeiAn">
|
||||
<view>备案号:{{ shopConfigStore.config?.shopBeiAn }}</view>
|
||||
</view>
|
||||
<view class="tit">
|
||||
Powered by CoreShop
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { useShopConfigStore } from '@/core/store';
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
//shopBeiAn: this.$store.state.config.shopBeiAn || '',
|
||||
//shopName: this.$store.state.config.shopName || ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
shopBeiAn: state => state.config.shopBeiAn,
|
||||
shopName: state => state.config.shopName,
|
||||
}),
|
||||
shopBeiAn: {
|
||||
get() {
|
||||
return this.$store.state.config.shopBeiAn;
|
||||
}
|
||||
},
|
||||
shopName: {
|
||||
get() {
|
||||
return this.$store.state.config.shopName;
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
// 获取项目配置
|
||||
const shopConfigStore = useShopConfigStore();
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "./coreshop-copyright.scss";
|
||||
</style>
|
||||
@@ -0,0 +1,76 @@
|
||||
<template>
|
||||
<uv-empty :mode="props.mode" :text="props.text" :textColor="props.textColor" :icon="computedSrc"></uv-empty>
|
||||
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { handleStaticResources } from '@/core/utils';
|
||||
import { computed } from 'vue';
|
||||
import { EmptyEnum } from '@/core/enum';
|
||||
import { cdnFilesUrl } from '@/core/consts';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
mode : EmptyEnum;
|
||||
text : string;
|
||||
textColor : string;
|
||||
}>(), {
|
||||
mode: EmptyEnum.data,
|
||||
text: '数据为空',
|
||||
textColor: '#c0c4cc'
|
||||
})
|
||||
|
||||
const computedSrc = computed(() => {
|
||||
let src = '';
|
||||
switch (props.mode) {
|
||||
case EmptyEnum.data:
|
||||
src = cdnFilesUrl + '/static/images/empty/data.png';
|
||||
break;
|
||||
case EmptyEnum.address:
|
||||
src = cdnFilesUrl + '/static/images/empty/address.png';
|
||||
break;
|
||||
case EmptyEnum.authority:
|
||||
src = cdnFilesUrl + '/static/images/empty/authority.png';
|
||||
break;
|
||||
case EmptyEnum.cart:
|
||||
src = cdnFilesUrl + '/static/images/empty/cart.png';
|
||||
break;
|
||||
case EmptyEnum.collect:
|
||||
src = cdnFilesUrl + '/static/images/empty/collect.png';
|
||||
break;
|
||||
case EmptyEnum.comment:
|
||||
src = cdnFilesUrl + '/static/images/empty/comment.png';
|
||||
break;
|
||||
case EmptyEnum.coupon:
|
||||
src = cdnFilesUrl + '/static/images/empty/coupon.png';
|
||||
break;
|
||||
case EmptyEnum.history:
|
||||
src = cdnFilesUrl + '/static/images/empty/history.png';
|
||||
break;
|
||||
case EmptyEnum.message:
|
||||
src = cdnFilesUrl + '/static/images/empty/message.png';
|
||||
break;
|
||||
case EmptyEnum.messageList:
|
||||
src = cdnFilesUrl + '/static/images/empty/messageList.png';
|
||||
break;
|
||||
case EmptyEnum.news:
|
||||
src = cdnFilesUrl + '/static/images/empty/news.png';
|
||||
break;
|
||||
case EmptyEnum.order:
|
||||
src = cdnFilesUrl + '/static/images/empty/order.png';
|
||||
break;
|
||||
case EmptyEnum.search:
|
||||
src = cdnFilesUrl + '/static/images/empty/search.png';
|
||||
break;
|
||||
case EmptyEnum.wifi:
|
||||
src = cdnFilesUrl + '/static/images/empty/wifi.png';
|
||||
break;
|
||||
case EmptyEnum.page:
|
||||
src = cdnFilesUrl + '/static/images/empty/page.png';
|
||||
break;
|
||||
default:
|
||||
src = cdnFilesUrl + '/static/images/empty/data.png';
|
||||
break;
|
||||
}
|
||||
return handleStaticResources(src);
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,31 +0,0 @@
|
||||
.fab-box { position: fixed; display: flex; justify-content: center; align-items: center; z-index: 2;
|
||||
&.top { width: 30px; height: 30px; right: 15px; bottom: 90px; border: 1px #5989b9 solid; background: #6699cc; border-radius: 5px; color: #fff; transition: all 0.3; opacity: 0; }
|
||||
&.active { opacity: 1; }
|
||||
&.fab { z-index: 10;
|
||||
&.leftBottom { left: 15px; bottom: 90px; }
|
||||
&.leftTop { left: 15px; top: 40px; top: calc(40px + var(--window-top)); }
|
||||
&.rightBottom { right: 15px; bottom: 90px; }
|
||||
&.rightTop { right: 15px; top: 40px; top: calc(40px + var(--window-top)); }
|
||||
}
|
||||
}
|
||||
.fab-circle { display: flex; justify-content: center; align-items: center; position: absolute; width: 45px; height: 45px; background: #3c3e49; border-radius: 50%; box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.2); z-index: 11;
|
||||
&.left { left: 0; }
|
||||
&.right { right: 0; }
|
||||
&.top { top: 0; }
|
||||
&.bottom { bottom: 0; }
|
||||
.icon-jia { color: #ffffff; font-size: 25px; transition: all 0.3s; width: 22px; height: 22px;
|
||||
&.active { transform: rotate(90deg); }
|
||||
}
|
||||
}
|
||||
.fab-content { background: #6699cc; box-sizing: border-box; display: flex; border-radius: 50px; overflow: hidden; box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.1); transition: all 0.2s; width: 55px;
|
||||
&.left { justify-content: flex-start; }
|
||||
&.right { justify-content: flex-end; }
|
||||
&.flexDirection { flex-direction: column; justify-content: flex-end; }
|
||||
&.flexDirectionStart { flex-direction: column; justify-content: flex-start; }
|
||||
&.flexDirectionEnd { flex-direction: column; justify-content: flex-end; }
|
||||
.fab-item { display: flex; flex-direction: column; justify-content: center; align-items: center; width: 45px; height: 45px; font-size: 12px; color: #fff; opacity: 0; transition: opacity 0.2s;
|
||||
&.active { opacity: 1; }
|
||||
.content-image { width: 30px; height: 30px; margin-bottom: 5px; }
|
||||
&.first { width: 55px; }
|
||||
}
|
||||
}
|
||||
@@ -1,199 +0,0 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="fab-box fab" :class="{ leftBottom: leftBottom, rightBottom: rightBottom, leftTop: leftTop, rightTop: rightTop }">
|
||||
<view class="fab-circle"
|
||||
:class="{
|
||||
left: horizontal === 'left' && direction === 'horizontal',
|
||||
top: vertical === 'top' && direction === 'vertical',
|
||||
bottom: vertical === 'bottom' && direction === 'vertical',
|
||||
right: horizontal === 'right' && direction === 'horizontal'
|
||||
}"
|
||||
:style="{ 'background-color': styles.buttonColor }"
|
||||
@click="open">
|
||||
<image class="icon icon-jia" src="/static/images/common/menu.png" mode="aspectFit" :class="{ active: showContent }"></image>
|
||||
<!-- <text class="icon icon-jia" :class="{ active: showContent }"></text> -->
|
||||
</view>
|
||||
<view class="fab-content"
|
||||
:class="{
|
||||
left: horizontal === 'left',
|
||||
right: horizontal === 'right',
|
||||
flexDirection: direction === 'vertical',
|
||||
flexDirectionStart: flexDirectionStart,
|
||||
flexDirectionEnd: flexDirectionEnd
|
||||
}"
|
||||
:style="{ width: boxWidth, height: boxHeight, background: styles.backgroundColor }">
|
||||
<view v-if="flexDirectionStart || horizontalLeft" class="fab-item first"></view>
|
||||
<view class="fab-item"
|
||||
v-for="(item, index) in content"
|
||||
:key="index"
|
||||
:class="{ active: showContent }"
|
||||
:style="{
|
||||
color: item.active ? styles.selectedColor : styles.color
|
||||
}"
|
||||
@click="taps(index, item)">
|
||||
<image class="content-image icon"
|
||||
:src="item.active ? item.selectedIconPath : item.iconPath"
|
||||
mode="aspectFit"></image>
|
||||
<text class="text">{{ item.text }}</text>
|
||||
</view>
|
||||
<view v-if="flexDirectionEnd || horizontalRight" class="fab-item first"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
pattern: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
color: '#7A7E83',
|
||||
backgroundColor: '#fff',
|
||||
selectedColor: '#007AFF',
|
||||
buttonColor: '#FF7159'
|
||||
};
|
||||
}
|
||||
},
|
||||
horizontal: {
|
||||
type: String,
|
||||
default: 'left'
|
||||
},
|
||||
vertical: {
|
||||
type: String,
|
||||
default: 'bottom'
|
||||
},
|
||||
direction: {
|
||||
type: String,
|
||||
default: 'horizontal'
|
||||
},
|
||||
content: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [{
|
||||
iconPath: '/static/images/common/tab-ic-hom-selected.png',
|
||||
selectedIconPath: '/static/images/common/tab-ic-hom-unselected.png',
|
||||
// text: '首页',
|
||||
active: false,
|
||||
url: '/pages/index/default/default'
|
||||
},
|
||||
{
|
||||
iconPath: '/static/images/common/tab-ic-me-selected.png',
|
||||
selectedIconPath: '/static/images/common/tab-ic-me-unselected.png',
|
||||
// text: '个人中心',
|
||||
active: false,
|
||||
url: '/pages/index/member/member'
|
||||
}];
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fabShow: false,
|
||||
flug: true,
|
||||
showContent: false,
|
||||
styles: {
|
||||
color: '#3c3e49',
|
||||
selectedColor: '#007AFF',
|
||||
backgroundColor: '#fff',
|
||||
buttonColor: '#3c3e49'
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
if (this.top === 0) {
|
||||
this.fabShow = true;
|
||||
}
|
||||
// 初始化样式
|
||||
this.styles = Object.assign({}, this.styles, this.pattern);
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.showContent = !this.showContent;
|
||||
},
|
||||
/**
|
||||
* 按钮点击事件
|
||||
*/
|
||||
taps(index, item) {
|
||||
//this.$emit('trigger', {
|
||||
// index,
|
||||
// item
|
||||
//});
|
||||
this.$u.route({
|
||||
type: 'switchTab',
|
||||
url: item.url
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 获取 位置信息
|
||||
*/
|
||||
getPosition(types, paramA, paramB) {
|
||||
if (types === 0) {
|
||||
return this.horizontal === paramA && this.vertical === paramB;
|
||||
} else if (types === 1) {
|
||||
return this.direction === paramA && this.vertical === paramB;
|
||||
} else if (types === 2) {
|
||||
return this.direction === paramA && this.horizontal === paramB;
|
||||
} else {
|
||||
return this.showContent && this.direction === paramA
|
||||
? this.contentWidth
|
||||
: this.contentWidthMin;
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
pattern(newValue, oldValue) {
|
||||
// console.log(JSON.stringify(newValue));
|
||||
this.styles = Object.assign({}, this.styles, newValue);
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
contentWidth(e) {
|
||||
return uni.upx2px((this.content.length + 1) * 90 + 20) + 'px';
|
||||
},
|
||||
contentWidthMin() {
|
||||
return uni.upx2px(90) + 'px';
|
||||
},
|
||||
// 动态计算宽度
|
||||
boxWidth() {
|
||||
return this.getPosition(3, 'horizontal');
|
||||
},
|
||||
// 动态计算高度
|
||||
boxHeight() {
|
||||
return this.getPosition(3, 'vertical');
|
||||
},
|
||||
// 计算左下位置
|
||||
leftBottom() {
|
||||
return this.getPosition(0, 'left', 'bottom');
|
||||
},
|
||||
// 计算右下位置
|
||||
rightBottom() {
|
||||
return this.getPosition(0, 'right', 'bottom');
|
||||
},
|
||||
// 计算左上位置
|
||||
leftTop() {
|
||||
return this.getPosition(0, 'left', 'top');
|
||||
},
|
||||
rightTop() {
|
||||
return this.getPosition(0, 'right', 'top');
|
||||
},
|
||||
flexDirectionStart() {
|
||||
return this.getPosition(1, 'vertical', 'top');
|
||||
},
|
||||
flexDirectionEnd() {
|
||||
return this.getPosition(1, 'vertical', 'bottom');
|
||||
},
|
||||
horizontalLeft() {
|
||||
return this.getPosition(2, 'horizontal', 'left');
|
||||
},
|
||||
horizontalRight() {
|
||||
return this.getPosition(2, 'horizontal', 'right');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import "coreshop-fab.scss";
|
||||
</style>
|
||||
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<view class="fix-bottom-btn">
|
||||
<coreshop-button class="btn" v-bind="$attrs" @onClick="onClick()"></coreshop-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
/** 使用$attrs给core-button传递属性 */
|
||||
const emits = defineEmits(['onClick']);
|
||||
const onClick = () => {
|
||||
emits('onClick');
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.fix-bottom-btn {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
border-top: solid 1px #f2f2f2;
|
||||
background-color: #ffffff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-bottom: calc(env(safe-area-inset-bottom) / 2);
|
||||
|
||||
.btn {
|
||||
width: 100%;
|
||||
padding: 20rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,242 @@
|
||||
.horizontal-good-card-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex: 1;
|
||||
|
||||
.good-msg {
|
||||
padding-left: 20rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
flex: 1;
|
||||
.name {
|
||||
font-size: 30rpx;
|
||||
color: #292b2e;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.name-two {
|
||||
font-size: 30rpx;
|
||||
color: #292b2e;
|
||||
height: 75rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.desc {
|
||||
font-size: 24rpx;
|
||||
color: #aaa;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.desc-two {
|
||||
font-size: 24rpx;
|
||||
color: #a5673f;
|
||||
height: 70rpx;
|
||||
margin-bottom: 10rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.tag-box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
.tag {
|
||||
font-size: 20rpx;
|
||||
padding: 0 15rpx;
|
||||
border-radius: 20px;
|
||||
color: #fff;
|
||||
background-color: #d33123;
|
||||
margin-right: 10rpx;
|
||||
line-height: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.price-msg {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
.price-box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-end;
|
||||
|
||||
.price {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-end;
|
||||
margin-right: 10rpx;
|
||||
|
||||
.symbol {
|
||||
font-size: 22rpx;
|
||||
color: #d33123;
|
||||
margin-bottom: 0rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.num {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #d33123;
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
.btn-tit {
|
||||
width: 150rpx;
|
||||
background-color: #333;
|
||||
border-radius: 50px;
|
||||
font-size: 24rpx;
|
||||
color: #fff;
|
||||
padding: 10rpx 0;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.vertical-good-card-box {
|
||||
.good-msg {
|
||||
.name {
|
||||
font-size: 27rpx;
|
||||
color: #292b2e;
|
||||
margin-top: 10rpx;
|
||||
margin-bottom: 10rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.name-two {
|
||||
font-size: 27rpx;
|
||||
height: 70rpx;
|
||||
color: #292b2e;
|
||||
margin-top: 10rpx;
|
||||
margin-bottom: 10rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.desc {
|
||||
font-size: 24rpx;
|
||||
color: #a5673f;
|
||||
margin-bottom: 10rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.desc-two {
|
||||
font-size: 24rpx;
|
||||
color: #a5673f;
|
||||
margin-bottom: 10rpx;
|
||||
overflow: hidden;
|
||||
white-space: initial;
|
||||
height: 70rpx;
|
||||
}
|
||||
.tag-box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
.tag {
|
||||
font-size: 20rpx;
|
||||
padding: 0 15rpx;
|
||||
border-radius: 20px;
|
||||
color: #fff;
|
||||
background-color: #d33123;
|
||||
margin-right: 10rpx;
|
||||
line-height: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.price-msg {
|
||||
.price-box {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
margin-bottom: 15rpx;
|
||||
margin-top: 5rpx;
|
||||
|
||||
.price {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-end;
|
||||
margin-right: 10rpx;
|
||||
|
||||
.symbol {
|
||||
font-size: 22rpx;
|
||||
color: #d33123;
|
||||
margin-bottom: 0rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.num {
|
||||
font-size: 40rpx;
|
||||
font-weight: bold;
|
||||
color: #d33123;
|
||||
line-height: 1;
|
||||
margin-bottom: -3rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.underlin-price {
|
||||
line-height: 1;
|
||||
font-size: 22rpx;
|
||||
text-decoration: line-through;
|
||||
color: #6e737d;
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
flex: 1;
|
||||
background-color: #333;
|
||||
border-radius: 50px;
|
||||
font-size: 24rpx;
|
||||
color: #fff;
|
||||
padding: 10rpx 0;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.img-box {
|
||||
position: relative;
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
.hot {
|
||||
position: absolute;
|
||||
left: 10rpx;
|
||||
top: 10rpx;
|
||||
border-radius: 5rpx;
|
||||
font-size: 20rpx;
|
||||
padding: 5rpx 10rpx;
|
||||
background: #d33123;
|
||||
color: #fff;
|
||||
}
|
||||
.recommend {
|
||||
position: absolute;
|
||||
right: 10rpx;
|
||||
top: 10rpx;
|
||||
border-radius: 5rpx;
|
||||
font-size: 20rpx;
|
||||
padding: 5rpx 10rpx;
|
||||
background: #3c9cff;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.good-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<view :class="props.type == 'horizontal' ? 'horizontal-good-card-box' : 'vertical-good-card-box'">
|
||||
<view class="img-box" :style="{ 'width': props.imgWidth, 'height': props.imgHeight }" @click="hanldeClickGoods">
|
||||
<image class="good-img" :src="props.goodsData.image"></image>
|
||||
<view class="recommend" v-if="props.goodsData.isRecommend">推荐</view>
|
||||
<view class="hot" v-if="props.goodsData.isHot">热门</view>
|
||||
</view>
|
||||
<view class="good-msg"
|
||||
:style="{ 'width': props.type == 'horizontal' ? `calc(100% - 10px - ${props.imgWidth})` : props.imgWidth}">
|
||||
<view v-if="props.goodsData.name" :class="props.nameOverflow === 1 ? 'name' : 'name-two'"
|
||||
@click="hanldeClickGoods">
|
||||
{{ props.goodsData.name }}
|
||||
</view>
|
||||
<view v-if="props.goodsData.brief" :class="props.briefOverflow === 1 ? 'desc' : 'desc-two'"
|
||||
@click="hanldeClickGoods">
|
||||
{{ props.goodsData.brief }}
|
||||
</view>
|
||||
|
||||
<slot name="goodTag"></slot>
|
||||
|
||||
<slot name="goodPrice">
|
||||
<view class="price-msg">
|
||||
<view class="price-box">
|
||||
<view class="price">
|
||||
<text class="symbol">¥</text>
|
||||
<text class="num">{{ props.goodsData.price }}</text>
|
||||
</view>
|
||||
<view class="underlin-price">¥{{ props.goodsData.mktprice }}</view>
|
||||
</view>
|
||||
<view class="btn">
|
||||
立即购买
|
||||
</view>
|
||||
</view>
|
||||
</slot>
|
||||
</view>
|
||||
</view>
|
||||
<slot name="other"></slot>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
const props = withDefaults(defineProps<{
|
||||
type : 'vertical' | 'horizontal',
|
||||
imgWidth : string,
|
||||
imgHeight : string,
|
||||
nameOverflow : number,
|
||||
briefOverflow : number,
|
||||
goodsData : any,
|
||||
}>(), {
|
||||
type: 'horizontal', // vertical 垂直 horizontal 水平
|
||||
imgWidth: '190rpx',
|
||||
imgHeight: '190rpx',
|
||||
nameOverflow: 1,
|
||||
briefOverflow: 1,
|
||||
goodsData: {},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['hanldeClickGoods']);
|
||||
|
||||
const hanldeClickGoods = () => {
|
||||
emit('hanldeClickGoods', props.goodsData)
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import './coreshop-goods-card.scss';
|
||||
</style>
|
||||
@@ -1,41 +1,55 @@
|
||||
.modal-box { width: 305px; border-radius: 10px; background: #fff; position: relative; left: 50%; transform: translateX(-50%); padding: 15px; z-index: 11111; }
|
||||
.modal-box-head-bg { width: 100%; height: 105px; }
|
||||
.modal-box-detail { width: 100%; text-align: center; }
|
||||
.modal-box-detail-title1 { color: #46351b; font-size: 18px; font-weight: bold; }
|
||||
.modal-box-detail-title2 { font-size: 14px; color: #999; padding-top: 10px; }
|
||||
.modal-box-detail-title3 { color: #46351b; font-size: 18px; font-weight: bold; text-align: left; line-height: 18px; padding: 15px 0 15px 15px; }
|
||||
.modal-box-detail-desc { font-size: 12px; line-height: 20px; color: #333; background: #f7f8fa; text-align: left; padding: 10px; }
|
||||
.modal-box-detail-user-avatar { width: 80px; height: 80px; overflow: hidden; margin: 0 auto; margin-bottom: 20px; }
|
||||
.modal-box-detail-user-name { font-size: 18px; font-family: PingFang SC; font-weight: bold; color: #845708; margin-bottom: 10px; }
|
||||
|
||||
.shopDesc { padding: 15px 0px 0px 0px; text-align: left; }
|
||||
.shopDesc-shopName { margin-left: 10px; line-height: 20px; }
|
||||
.shopDesc-get { margin-left: 10px; line-height: 20px; }
|
||||
|
||||
.agreement-checked-view { position: relative; padding: 10px 0px 10px 15px; display: flex; align-items: center; margin: 5px 0; font-size: 12px; }
|
||||
|
||||
|
||||
|
||||
.getCaptcha { background-color: rgb(253, 243, 208); color: $u-tips-color; border: none; font-size: 15px; padding: 6px 0;
|
||||
|
||||
&::after { border: none; }
|
||||
.logon-box {
|
||||
background-color: #fff;
|
||||
width: 600rpx;
|
||||
padding: 40rpx;
|
||||
.title-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.img {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
display: block;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.name {
|
||||
font-size: 32rpx;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
}
|
||||
.desc-box {
|
||||
padding: 50rpx 0 20rpx;
|
||||
font-size: 32rpx;
|
||||
color: #46351b;
|
||||
}
|
||||
.content-box {
|
||||
padding: 20rpx;
|
||||
background-color: #f7f8fa;
|
||||
border-radius: 10rpx;
|
||||
.tit {
|
||||
font-size: 24rpx;
|
||||
line-height: 45rpx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
.agreement-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 50rpx;
|
||||
.agreement-tit {
|
||||
margin-left: 10rpx;
|
||||
font-size: 27rpx;
|
||||
.tit {
|
||||
color: #d33123;
|
||||
}
|
||||
}
|
||||
}
|
||||
.btn-box {
|
||||
margin-top: 50rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.btn {
|
||||
width: 45%;
|
||||
}
|
||||
}
|
||||
}
|
||||
.wrap-content { width: 300px; margin: 40px auto 0; }
|
||||
.wrap { font-size: 14px; }
|
||||
.hint { padding: 10px 20px; font-size: 11px; color: $u-tips-color; }
|
||||
|
||||
.wrapkey { padding: 40px 35px; }
|
||||
.box { margin: 15px 0; font-size: 15px; color: #555; }
|
||||
.key-input { padding: 15px 0;
|
||||
text { display: none; }
|
||||
.error { display: block; color: red; font-size: 15px; margin: 10px 0; }
|
||||
}
|
||||
|
||||
.key-input .tips { font-size: 15px; color: #333; margin-top: 10px; margin-bottom: 30px; }
|
||||
.captcha { color: $u-type-warning; font-size: 15px; margin-top: 20px;
|
||||
.noCaptcha { display: block; }
|
||||
.regain { display: block; }
|
||||
}
|
||||
|
||||
|
||||
.aliGetNumberButton { height: 40px; position: relative; -webkit-box-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center; display: -webkit-box; display: -webkit-flex; display: flex; -webkit-box-orient: horizontal; -webkit-box-direction: normal; -webkit-flex-direction: row; flex-direction: row; box-sizing: border-box; flex-direction: row; padding: 0 12px; font-size: 14px; color: #fff; background-color: #5ac725; border-color: #5ac725; border-width: 1px; border-style: solid; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; }
|
||||
|
||||
@@ -1,628 +1,173 @@
|
||||
<template>
|
||||
<view>
|
||||
<u-toast ref="uToast" />
|
||||
<!-- #ifndef MP-WEIXIN || MP-ALIPAY -->
|
||||
<u-popup class="coreshop-bottom-popup-box" :show="showLogin && sessionAuthIdTool" @close="hideModal" mode="bottom" :closeable="true">
|
||||
<view class="radius coreshop-bg-white wrap">
|
||||
<view v-if="!showCodeBox">
|
||||
<view class="wrap-content">
|
||||
<view class="coreshop-font-25 coreshop-font-weight-bold coreshop-margin-bottom-50">欢迎登录{{shopName}}</view>
|
||||
<input class="coreshop-solid coreshop-margin-bottom-10 coreshop-padding-bottom-5" type="number" v-model="mobile" placeholder="请输入手机号" />
|
||||
<view class="coreshop-margin-bottom-30 coreshop-margin-top-5 ">未注册的手机号验证后自动创建平台账号</view>
|
||||
<button @tap="submit" :style="[inputStyle]" class="getCaptcha">获取短信验证码</button>
|
||||
<view class="coreshop-flex coreshop-justify-between coreshop-margin-top-25">
|
||||
<view class="password">一键登录</view>
|
||||
<view class="issue">遇到问题</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class=" coreshop-padding-bottom-30 coreshop-padding-top-30">
|
||||
<view class="hint">
|
||||
登录即代表你同意
|
||||
<text @click="goUserAgreementPage()">用户协议</text>
|
||||
和
|
||||
<text @click="goUserPrivacyPolicy()">隐私政策</text>,
|
||||
并授权使用您的{{shopName}}账号信息(如昵称、头像、收货地址)以便您统一管理
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="wrapkey" v-if="showCodeBox">
|
||||
<view class="key-input">
|
||||
<view class="coreshop-font-25 coreshop-font-weight-bold coreshop-margin-bottom-50">输入验证码</view>
|
||||
<view class="coreshop-margin-bottom-30 coreshop-margin-top-5">验证码已发送至 +{{mobile}}</view>
|
||||
<u-code-input :focus="true" v-model="codevalue" @change="change" @finish="finish" mode="box" :maxlength="maxlength"></u-code-input>
|
||||
<text :class="{ error: error }">{{errorMsg}}</text>
|
||||
<view class="captcha">
|
||||
<text :class="{ noCaptcha: verification }" @tap="noCaptcha">收不到验证码点这里</text>
|
||||
<text :class="{ regain: !verification }">{{ timer }}秒后重新获取验证码</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP-ALIPAY -->
|
||||
<u-popup class="coreshop-bottom-popup-box" :show="showLogin && sessionAuthIdTool" @close="hideModal" mode="center">
|
||||
<view class="radius coreshop-bg-white">
|
||||
<view class="modal-box">
|
||||
<view class="modal-box-detail-detail">
|
||||
<view class="shopDesc">
|
||||
<view class="coreshop-avatar sm round margin-left">
|
||||
<u--image width="24px" height="24px" :src="shopLogo"></u--image>
|
||||
</view>
|
||||
<text class="shopName">
|
||||
{{shopName||'登录授权'}}
|
||||
</text>
|
||||
<text class="get">
|
||||
申请
|
||||
</text>
|
||||
</view>
|
||||
<view class="modal-box-detail-title3">获取以下权限为您提供服务</view>
|
||||
<view class="modal-box-detail-desc">
|
||||
1、获取你的手机号提供更好的账户安全,物流,订单状态提醒等服务(在接下来微信授权手机号的弹窗中选择“允许”)<br />
|
||||
2、使用我们的相关服务,需要将您的手机号授权给我们。
|
||||
</view>
|
||||
<!--服务协议-->
|
||||
<view class="coreshop-margin-top-15 coreshop-margin-bottom-30 agreement-checked-view">
|
||||
<u-checkbox-group>
|
||||
<u-checkbox v-model="agreement" :checked="agreement" @change="checkboxChange" size="20" active-color="#19be6b"></u-checkbox>
|
||||
</u-checkbox-group>
|
||||
<view class="coreshop-text-black-view">
|
||||
<text class="coreshop-text-black">同意</text>
|
||||
<text class="text-blue" @tap="goUserAgreementPage">《服务协议》</text>
|
||||
<text class="coreshop-text-black">与</text>
|
||||
<text class="text-blue" @tap="goUserPrivacyPolicy">《隐私协议》</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-justify-between coreshop-padding-left-15 coreshop-padding-right-15">
|
||||
<view class="coreshop-padding-5">
|
||||
<u-button @click="closeAuth">暂不授权</u-button>
|
||||
</view>
|
||||
<view class="coreshop-padding-5">
|
||||
<u-button type="success" :disabled="isDisabled" v-if="isDisabled">确定授权</u-button>
|
||||
<!--<u-button type="success" open-type="getAuthorize" scope="phoneNumber" @getphonenumber="getAliPhoneNumber" v-else>确定授权</u-button>-->
|
||||
<button class="aliGetNumberButton" open-type="getAuthorize" scope="phoneNumber" @getAuthorize="getAliPhoneNumber" v-else>确定授权</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<u-popup class="coreshop-bottom-popup-box" :show="showLogin && sessionAuthIdTool" @close="hideModal" mode="center">
|
||||
<view class="radius coreshop-bg-white">
|
||||
<view class="modal-box">
|
||||
<view class="modal-box-detail-detail">
|
||||
<view class="shopDesc">
|
||||
<view class="coreshop-avatar sm round margin-left">
|
||||
<u--image width="24px" height="24px" :src="shopLogo"></u--image>
|
||||
</view>
|
||||
<text class="shopName">
|
||||
{{shopName||'登录授权'}}
|
||||
</text>
|
||||
<text class="get">
|
||||
申请
|
||||
</text>
|
||||
</view>
|
||||
<view class="modal-box-detail-title3">获取以下权限为您提供服务</view>
|
||||
<view class="modal-box-detail-desc">
|
||||
1、获取你的手机号提供更好的账户安全,物流,订单状态提醒等服务(在接下来微信授权手机号的弹窗中选择“允许”)<br />
|
||||
2、使用我们的相关服务,需要将您的手机号授权给我们。
|
||||
</view>
|
||||
<!--服务协议-->
|
||||
<view class="coreshop-margin-top-15 coreshop-margin-bottom-30 agreement-checked-view">
|
||||
<u-checkbox-group>
|
||||
<u-checkbox v-model="agreement" :checked="agreement" @change="checkboxChange" size="20" active-color="#19be6b"></u-checkbox>
|
||||
</u-checkbox-group>
|
||||
|
||||
|
||||
<view class="coreshop-text-black-view">
|
||||
<text class="coreshop-text-black">同意</text>
|
||||
<text class="text-blue" @tap="goUserAgreementPage">《服务协议》</text>
|
||||
<text class="coreshop-text-black">与</text>
|
||||
<text class="text-blue" @tap="goUserPrivacyPolicy">《隐私协议》</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-justify-between coreshop-padding-left-15 coreshop-padding-right-15">
|
||||
<view class="coreshop-padding-5">
|
||||
<u-button @click="closeAuth">暂不授权</u-button>
|
||||
</view>
|
||||
<view class="coreshop-padding-5">
|
||||
<u-button type="success" :disabled="isDisabled" v-if="isDisabled">确定授权</u-button>
|
||||
<u-button type="success" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" v-else>确定授权</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
<uv-popup ref="loginPopup" mode="center" :customStyle="{ 'border-radius': '20rpx' }" :safeAreaInsetBottom="false"
|
||||
:closeable="true" @change="handleChangePopup">
|
||||
<view class="logon-box">
|
||||
<view class="title-box">
|
||||
<image class="img" :src="shopConfigStore?.config?.shopLogo"></image>
|
||||
<text class="name">{{ shopConfigStore?.config?.shopName || '登录授权' }} 申请</text>
|
||||
</view>
|
||||
<view class="desc-box">获取以下权限为您提供服务</view>
|
||||
<view class="content-box">
|
||||
<view class="tit m-b-20">
|
||||
1、获取你的手机号提供更好的账户安全,物流,订单状态提醒等服务(在接下来微信授权手机号的弹窗中选择“允许”)
|
||||
</view>
|
||||
<view class="tit">
|
||||
2、使用我们的相关服务,需要将您的手机号授权给我们。
|
||||
</view>
|
||||
</view>
|
||||
<view class="agreement-box">
|
||||
<uv-checkbox-group :customStyle="{ 'flex': 'none' }">
|
||||
<uv-checkbox :checked="state.agreement" @change="handleCheckboxChange"></uv-checkbox>
|
||||
</uv-checkbox-group>
|
||||
<view class="agreement-tit">
|
||||
同意 <text class="tit">《服务协议》</text> 与 <text class="tit">《隐私协议》</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn-box">
|
||||
<view class="btn">
|
||||
<uv-button @click="handleCloseAuth" :customStyle="{ 'width': '100%' }" size="normal" :plain="true"
|
||||
text="暂不授权"></uv-button>
|
||||
</view>
|
||||
<view class="btn">
|
||||
<uv-button v-if="state.agreement" :customStyle="{ 'width': '100%' }" openType="getPhoneNumber"
|
||||
@getphonenumber="getPhoneNumber" type="success" size="normal" text="确定授权"></uv-button>
|
||||
<uv-button v-else @click="handleClickOk" :customStyle="{ 'width': '100%' }" type="success"
|
||||
size="normal" text="确定授权"></uv-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</uv-popup>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { watch, ref, reactive, onMounted } from 'vue';
|
||||
import { useShopConfigStore, useUserInfoStore } from '@/core/store';
|
||||
import { Response } from '@/core/models';
|
||||
import { Invitecode, UserToken } from '@/core/consts';
|
||||
import { queryLoginPhoneNumber, queryLogin, queryAliPayAppAuthTokenBYCode } from '@/core/api';
|
||||
import { loginGetCode, handleShowToast } from '@/core/utils';
|
||||
|
||||
<script>
|
||||
/**
|
||||
* 登录提示页
|
||||
* @property {Boolean} value=showLoginTip - 由v-model控制显示隐藏。
|
||||
* @property {Boolean} forceOauth - 小程序端特制的全屏登录提示。
|
||||
*/
|
||||
import { mapState } from 'vuex';
|
||||
export default {
|
||||
name: 'coreshopLoginModal',
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
agreement: false,
|
||||
isDisabled: true,
|
||||
maxMobile: 11,
|
||||
mobile: '', // 用户手机号
|
||||
code: '', // 短信验证码
|
||||
verification: true, // 通过v-show控制显示获取还是倒计时
|
||||
timer: 60, // 定义初始时间为60s
|
||||
btnb: 'coreshop-btn coreshop-btn-square coreshop-btn-c coreshop-btn-all', //按钮背景
|
||||
type: '', // 有值是第三方登录账号绑定
|
||||
showCodeBox: false,
|
||||
maxlength: 6,
|
||||
codevalue: '',
|
||||
error: false,
|
||||
errorMsg: '验证码错误,请重新输入',
|
||||
};
|
||||
},
|
||||
props: {
|
||||
value: {},
|
||||
modalType: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
showLoginTip: state => state.showLoginTip,
|
||||
sessionAuthId: state => state.sessionAuthId,
|
||||
hasLogin: state => state.hasLogin,
|
||||
}),
|
||||
shopLogo() {
|
||||
return this.$store.state.config.shopLogo
|
||||
},
|
||||
shopName() {
|
||||
return this.$store.state.config.shopName;
|
||||
},
|
||||
showLogin: {
|
||||
get() {
|
||||
return this.showLoginTip;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit('showLoginTip', val);
|
||||
}
|
||||
},
|
||||
sessionAuthIdTool: {
|
||||
get() {
|
||||
return this.sessionAuthId;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit('sessionAuthId', val);
|
||||
}
|
||||
},
|
||||
inputStyle() {
|
||||
let style = {};
|
||||
if (this.mobile) {
|
||||
style.color = "#fff";
|
||||
style.backgroundColor = this.$u.color['warning'];
|
||||
}
|
||||
return style;
|
||||
},
|
||||
// 验证手机号
|
||||
rightMobile() {
|
||||
let res = {};
|
||||
if (!this.mobile) {
|
||||
res.status = false;
|
||||
res.msg = '请输入手机号';
|
||||
} else if (!this.$u.test.mobile(this.mobile)) {
|
||||
res.status = false;
|
||||
res.msg = '手机号格式不正确';
|
||||
} else {
|
||||
res.status = true;
|
||||
}
|
||||
return res;
|
||||
},
|
||||
// 动态计算发送验证码按钮样式
|
||||
sendCodeBtn() {
|
||||
let btn = 'coreshop-btn coreshop-btn-g';
|
||||
if (this.mobile.length === this.maxMobile && this.rightMobile.status) {
|
||||
return btn + ' coreshop-btn-b';
|
||||
} else {
|
||||
return btn;
|
||||
}
|
||||
},
|
||||
// 动态更改登录按钮bg
|
||||
regButtonClass() {
|
||||
return this.mobile && this.mobile.length === this.maxMobile && this.code ? this.btnb + ' coreshop-btn-b' : this.btnb;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const _this = this
|
||||
// #ifdef MP-WEIXIN
|
||||
var userInfo = this.$store.state.userInfo;
|
||||
if (Object.keys(userInfo).length == 0) {
|
||||
_this.$store.commit('userInfo', "");
|
||||
_this.doWeChatToken();
|
||||
}
|
||||
// #endif
|
||||
// 获取项目配置
|
||||
const shopConfigStore = useShopConfigStore();
|
||||
|
||||
// #ifdef MP-ALIPAY
|
||||
var userInfo = this.$store.state.userInfo;
|
||||
if (Object.keys(userInfo).length == 0) {
|
||||
_this.$store.commit('userInfo', "");
|
||||
_this.doAliPayToken();
|
||||
}
|
||||
// #endif
|
||||
// 获取 用户数据
|
||||
const userInfoStore = useUserInfoStore();
|
||||
|
||||
},
|
||||
onShow() {
|
||||
let _this = this;
|
||||
_this.timer = parseInt(_this.$db.get('timer'));
|
||||
if (_this.timer != null && _this.timer > 0) {
|
||||
_this.countDown();
|
||||
_this.verification = false;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
if (this.$u.test.mobile(this.mobile)) {
|
||||
this.sendCode();
|
||||
} else {
|
||||
this.$u.toast('请输入合法的手机号码!');
|
||||
}
|
||||
},
|
||||
// 收不到验证码选择时的选择
|
||||
noCaptcha() {
|
||||
var _this = this;
|
||||
uni.showActionSheet({
|
||||
itemList: ['重新获取验证码'],
|
||||
success: function (res) {
|
||||
_this.sendCode();
|
||||
},
|
||||
fail: function (res) {
|
||||
this.$u.toast('重发失败!');
|
||||
}
|
||||
});
|
||||
},
|
||||
// change事件侦听
|
||||
change(value) {
|
||||
console.log('change', value);
|
||||
},
|
||||
// 输入完验证码最后一位执行
|
||||
finish(value) {
|
||||
this.code = value;
|
||||
if (this.sessionAuthIdTool) {
|
||||
this.toBind();
|
||||
} else {
|
||||
this.login();
|
||||
}
|
||||
},
|
||||
// 发送短信验证码
|
||||
sendCode() {
|
||||
if (!this.rightMobile.status) {
|
||||
this.$u.toast(this.rightMobile.msg);
|
||||
} else {
|
||||
uni.showToast({ title: '发送中...', icon: 'loading' })
|
||||
setTimeout(() => {
|
||||
uni.hideToast();
|
||||
this.$u.api.sms({ mobile: this.mobile, code: 'login' }).then(res => {
|
||||
if (res.status) {
|
||||
this.showCodeBox = true;
|
||||
this.timer = 60;
|
||||
this.verification = false;
|
||||
this.$refs.uToast.show({ message: res.msg, type: 'success' });
|
||||
this.countDown(); // 执行验证码计时
|
||||
} else {
|
||||
this.$u.toast(res.msg);
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
},
|
||||
// 验证码倒计时
|
||||
countDown() {
|
||||
let auth_timer = setInterval(() => {
|
||||
// 定时器设置每秒递减
|
||||
this.timer--; // 递减时间
|
||||
uni.setStorage({
|
||||
key: 'timer',
|
||||
data: this.timer,
|
||||
success: function () { }
|
||||
});
|
||||
if (this.timer <= 0) {
|
||||
this.verification = true; // 60s时间结束还原v-show状态并清除定时器
|
||||
clearInterval(auth_timer);
|
||||
}
|
||||
}, 1000);
|
||||
},
|
||||
// 登录
|
||||
login() {
|
||||
var _this = this;
|
||||
if (!_this.rightMobile.status) {
|
||||
_this.$u.toast(_this.rightMobile.msg);
|
||||
} else {
|
||||
// 短信验证码登录
|
||||
if (!_this.code) {
|
||||
_this.$u.toast('请输入短信验证码!');
|
||||
} else {
|
||||
let data = {
|
||||
mobile: _this.mobile,
|
||||
code: _this.code
|
||||
};
|
||||
const props = withDefaults(defineProps<{
|
||||
show : boolean,
|
||||
goodsDetailData : any,
|
||||
}>(), {
|
||||
show: false,
|
||||
goodsDetailData: {},
|
||||
});
|
||||
|
||||
let invicode = _this.$db.get('invitecode');
|
||||
if (invicode) {
|
||||
data.invitecode = invicode;
|
||||
}
|
||||
const loginPopup = ref();
|
||||
|
||||
_this.$u.api.smsLogin(data).then(res => {
|
||||
if (res.status) {
|
||||
_this.$db.set('userToken', res.data.token);
|
||||
_this.redirectHandler(res.msg);
|
||||
} else {
|
||||
_this.$u.toast(res.msg);
|
||||
_this.error = true;
|
||||
_this.errorMsg = res.msg;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
// 重定向跳转 或者返回上一个页面
|
||||
redirectHandler(msg) {
|
||||
let _this = this;
|
||||
this.$refs.uToast.show({
|
||||
message: msg, type: 'success', complete: function () {
|
||||
_this.$db.set('timer', 0);
|
||||
_this.$db.del('invitecode');
|
||||
_this.showLogin = false;
|
||||
_this.toLoginSuccessHandleBack();
|
||||
}
|
||||
})
|
||||
},
|
||||
doWeChatToken() {
|
||||
const _this = this
|
||||
_this.getCode(function (code) {
|
||||
let data = {
|
||||
code: code
|
||||
}
|
||||
_this.$u.api.onLogin(data).then(res => {
|
||||
if (res.status) {
|
||||
if (res.data.auth) {
|
||||
_this.$db.set('userToken', res.data.auth.token)
|
||||
_this.$store.commit('hasLogin', true);
|
||||
}
|
||||
if (res.data.user) {
|
||||
_this.$store.commit('userInfo', res.data.user);
|
||||
}
|
||||
_this.sessionAuthIdTool = res.otherData;
|
||||
} else {
|
||||
_this.$u.toast(res.msg);
|
||||
_this.$store.commit('userInfo', "");
|
||||
_this.sessionAuthIdTool = res.otherData;
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
doAliPayToken() {
|
||||
const _this = this
|
||||
_this.getCode(function (code) {
|
||||
let data = {
|
||||
id: code
|
||||
}
|
||||
_this.$u.api.getAliPayAppAuthTokenBYCode(data).then(res => {
|
||||
if (res.status) {
|
||||
if (res.data.auth) {
|
||||
_this.$db.set('userToken', res.data.auth.token)
|
||||
_this.$store.commit('hasLogin', true);
|
||||
}
|
||||
if (res.data.user) {
|
||||
_this.$store.commit('userInfo', res.data.user);
|
||||
}
|
||||
_this.sessionAuthIdTool = res.otherData;
|
||||
//console.log("成功后获取sessionAuthIdTool:" + _this.sessionAuthIdTool);
|
||||
} else {
|
||||
_this.$u.toast(res.msg);
|
||||
_this.$store.commit('userInfo', "");
|
||||
_this.sessionAuthIdTool = res.otherData;
|
||||
//console.log("失败后获取sessionAuthIdTool:" + _this.sessionAuthIdTool);
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
// 勾选版权协议
|
||||
checkboxChange(e) {
|
||||
this.agreement = e;
|
||||
if (e == true) {
|
||||
this.isDisabled = false;
|
||||
} else {
|
||||
this.isDisabled = true;
|
||||
}
|
||||
//console.log(this.agreement);
|
||||
},
|
||||
// 隐藏登录弹窗
|
||||
hideModal() {
|
||||
this.showLogin = false;
|
||||
},
|
||||
// 去登录
|
||||
toAccountLogin() {
|
||||
this.showLogin = false;
|
||||
this.$u.route('/pages/login/loginByAccount/loginByAccount');
|
||||
},
|
||||
// 小程序,取消登录
|
||||
closeAuth() {
|
||||
this.showLogin = false;
|
||||
this.$u.toast('您已取消授权')
|
||||
},
|
||||
getCode: function (callback) {
|
||||
let _this = this
|
||||
// #ifdef MP-WEIXIN
|
||||
uni.login({
|
||||
success: function (res) {
|
||||
if (res.code) {
|
||||
return callback(res.code)
|
||||
} else {
|
||||
_this.$refs.uToast.show({ message: '未取得code,请重试', type: 'error', })
|
||||
}
|
||||
},
|
||||
fail: function (res) {
|
||||
var scene = this.$store.state.scene;
|
||||
//判断是否为 朋友圈内打开“单页模式",单页模式下,数据交互无法执行。所以不进行提醒
|
||||
if (scene != 1154) {
|
||||
_this.$refs.uToast.show({ message: '用户授权失败wx.login,请重试', type: 'error', })
|
||||
}
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
const state = reactive<{
|
||||
agreement : boolean;
|
||||
sessionAuthIdTool : string;
|
||||
}>({
|
||||
agreement: false,
|
||||
sessionAuthIdTool: "",
|
||||
})
|
||||
|
||||
// #ifdef MP-ALIPAY
|
||||
my.getAuthCode({
|
||||
scopes: 'auth_user',
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
return callback(res.authCode)
|
||||
},
|
||||
});
|
||||
// #endif
|
||||
watch(() => props.show, (newVal : boolean) => {
|
||||
if (newVal) {
|
||||
loginPopup.value.open();
|
||||
} else {
|
||||
loginPopup.value.close();
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
toLogin: function (data) {
|
||||
let _this = this
|
||||
_this.$u.api.loginByDecodeEncryptedData(data).then(res => {
|
||||
if (res.status) {
|
||||
//判断是否返回了token,如果没有,就说明没有绑定账号,跳转到绑定页面
|
||||
if (res.data.token) {
|
||||
//登陆成功,设置token,并返回上一页
|
||||
_this.$db.set('userToken', res.data.token)
|
||||
_this.$store.commit('hasLogin', true);
|
||||
_this.$refs.uToast.show({ message: '登录成功', type: 'success', })
|
||||
return false
|
||||
} else {
|
||||
// #ifdef MP-WEIXIN
|
||||
_this.sessionAuthIdTool = res.data.sessionAuthId;
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
_this.$u.route({ type: 'navigateTo', url: '/pages/login/loginBySMS/loginBySMS?sessionAuthId=' + res.data.sessionAuthId });
|
||||
// #endif
|
||||
}
|
||||
} else {
|
||||
_this.$refs.uToast.show({ message: '登录失败,请重试', type: 'error', })
|
||||
}
|
||||
})
|
||||
},
|
||||
async getPhoneNumber(e) {
|
||||
if (this.agreement == false) {
|
||||
this.$refs.uToast.show({ message: '请先勾选并同意服务', type: 'error', })
|
||||
return false;
|
||||
} else {
|
||||
let _this = this;
|
||||
if (e.mp.detail.errMsg == 'getPhoneNumber:ok') {
|
||||
var data = {
|
||||
sessionAuthId: _this.sessionAuthIdTool,
|
||||
iv: e.mp.detail.iv,
|
||||
encryptedData: e.mp.detail.encryptedData,
|
||||
}
|
||||
//有推荐码的话,带上
|
||||
var invitecode = _this.$db.get('invitecode')
|
||||
if (invitecode) {
|
||||
data.invitecode = invitecode
|
||||
}
|
||||
_this.toGetPhoneNumber(data);
|
||||
} else if (e.mp.detail.errMsg == 'getPhoneNumber:fail user deny') {
|
||||
_this.$u.toast('您已经取消了授权,将无法进行关键业务功能。');
|
||||
}
|
||||
else {
|
||||
_this.$u.toast('如未授权,您可尝试使用手机号+短信验证码登录');
|
||||
}
|
||||
_this.agreement = false;
|
||||
_this.isDisabled = true;
|
||||
_this.showLogin = false;
|
||||
//console.log(e.mp.detail.errMsg);
|
||||
}
|
||||
},
|
||||
async getAliPhoneNumber() {
|
||||
let _this = this
|
||||
if (_this.agreement == false) {
|
||||
_this.$refs.uToast.show({ message: '请先勾选并同意服务', type: 'error', })
|
||||
return false;
|
||||
} else {
|
||||
my.getPhoneNumber({
|
||||
success: (res) => {
|
||||
console.log('获取手机号码', res);
|
||||
let encryptedData = JSON.parse(res.response);
|
||||
console.log('获取手机号码2', encryptedData);
|
||||
var data = {
|
||||
sessionAuthId: _this.sessionAuthIdTool,
|
||||
sign: encryptedData.sign,
|
||||
encryptedData: encryptedData.response,
|
||||
}
|
||||
//有推荐码的话,带上
|
||||
var invitecode = _this.$db.get('invitecode')
|
||||
if (invitecode) {
|
||||
data.invitecode = invitecode
|
||||
}
|
||||
_this.$u.api.loginByGetPhoneNumberForAli(data).then(res => {
|
||||
console.log(res);
|
||||
if (res.status) {
|
||||
//判断是否返回了token,如果没有,就说明没有绑定账号,跳转到绑定页面
|
||||
if (res.data.token) {
|
||||
//console.log("登陆成功,设置token,并返回上一页");
|
||||
//登陆成功,设置token,并返回上一页
|
||||
_this.$db.set('userToken', res.data.token)
|
||||
_this.$store.commit('hasLogin', true);
|
||||
_this.showLogin = false;
|
||||
_this.$refs.uToast.show({ message: '登录成功', type: 'success', })
|
||||
return false
|
||||
}
|
||||
} else if (!res.status && res.code == 500) {
|
||||
_this.$u.route({ type: 'switchTab', url: '/pages/index/default/default' });
|
||||
} else {
|
||||
_this.$u.toast('登录失败,请重试')
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log(res);
|
||||
},
|
||||
});
|
||||
const emits = defineEmits(['handleChangePopup', 'getUserInfo']);
|
||||
|
||||
_this.agreement = false;
|
||||
_this.isDisabled = true;
|
||||
_this.showLogin = false;
|
||||
onMounted(() => {
|
||||
if (Object.keys(userInfoStore.userInfo).length == 0 || !uni.getStorageSync(UserToken)) {
|
||||
handleLoginGainToken();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
//实际的去登陆
|
||||
toGetPhoneNumber: function (data) {
|
||||
let _this = this
|
||||
_this.$u.api.loginByGetPhoneNumber(data).then(res => {
|
||||
//console.log(res);
|
||||
if (res.status) {
|
||||
//判断是否返回了token,如果没有,就说明没有绑定账号,跳转到绑定页面
|
||||
if (res.data.token) {
|
||||
//console.log("登陆成功,设置token,并返回上一页");
|
||||
//登陆成功,设置token,并返回上一页
|
||||
_this.$db.set('userToken', res.data.token)
|
||||
_this.$store.commit('hasLogin', true);
|
||||
_this.showLogin = false;
|
||||
_this.$refs.uToast.show({ message: '登录成功', type: 'success', })
|
||||
return false
|
||||
}
|
||||
} else if (res.status == false && res.code == 500) {
|
||||
//console.log("sessionId不正确,重载");
|
||||
_this.$u.route({ type: 'switchTab', url: '/pages/index/default/default' });
|
||||
} else {
|
||||
_this.$u.toast('登录失败,请重试')
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
};
|
||||
/** 微信/支付宝 登录 */
|
||||
const handleLoginGainToken = () => {
|
||||
loginGetCode(async (code : string) => {
|
||||
// #ifdef MP-WEIXIN
|
||||
const login : Response<any> = await queryLogin({ code, });
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-ALIPAY
|
||||
const login : Response<any> = await queryAliPayAppAuthTokenBYCode({ code, });
|
||||
// #endif
|
||||
|
||||
if (login.status) {
|
||||
if (login.data.auth) {
|
||||
uni.setStorageSync(UserToken, login.data.auth.token);
|
||||
}
|
||||
if (login.data.user) {
|
||||
userInfoStore.setUserInfo(login.data.user);
|
||||
}
|
||||
state.sessionAuthIdTool = login?.otherData;
|
||||
} else {
|
||||
state.sessionAuthIdTool = login?.otherData;
|
||||
handleShowToast(login.msg);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** sku弹框显示或者隐藏 */
|
||||
const handleChangePopup = (e : any) => {
|
||||
emits('handleChangePopup', e.show)
|
||||
}
|
||||
|
||||
/** 勾选版权协议 */
|
||||
const handleCheckboxChange = (e : boolean) => {
|
||||
state.agreement = e;
|
||||
}
|
||||
|
||||
/** 点击确定提醒勾选 */
|
||||
const handleClickOk = () => {
|
||||
handleShowToast('请先勾选版权协议');
|
||||
}
|
||||
|
||||
/** 取消授权 */
|
||||
const handleCloseAuth = () => {
|
||||
emits('handleChangePopup', false);
|
||||
handleShowToast('您已取消授权');
|
||||
}
|
||||
|
||||
/** 获取授权手机号 */
|
||||
const getPhoneNumber = (e : any) => {
|
||||
emits('handleChangePopup', false);
|
||||
if (e.errMsg.includes('ok')) {
|
||||
let data = {
|
||||
sessionAuthId: state.sessionAuthIdTool,
|
||||
iv: e.iv,
|
||||
encryptedData: e.encryptedData,
|
||||
}
|
||||
/** 有推荐码的话,带上 */
|
||||
if (uni.getStorageSync(Invitecode)) {
|
||||
data['invitecode'] = uni.getStorageSync(Invitecode);
|
||||
}
|
||||
handleLogin(data);
|
||||
} else {
|
||||
handleShowToast('您已经取消了授权,将无法进行关键业务功能。');
|
||||
}
|
||||
}
|
||||
|
||||
/** 去登录获取数据 */
|
||||
const handleLogin = async (data : any) => {
|
||||
const phoneNumber : Response<any> = await queryLoginPhoneNumber(data);
|
||||
if (phoneNumber.status && phoneNumber.data.token) {
|
||||
uni.setStorageSync(UserToken, phoneNumber.data.token);
|
||||
if (phoneNumber.otherData) {
|
||||
userInfoStore.setUserInfo(phoneNumber.otherData);
|
||||
handleShowToast('登录成功', 'success');
|
||||
emits('getUserInfo')
|
||||
}
|
||||
} else {
|
||||
handleShowToast('登录失败,请重试');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "coreshop-login-modal.scss";
|
||||
</style>
|
||||
@import "./coreshop-login-modal.scss";
|
||||
</style>
|
||||
@@ -1,45 +0,0 @@
|
||||
<template>
|
||||
<view class="coreshop-modal-box" :class="show?'show':''">
|
||||
<view class="dialog">
|
||||
<image class="img" :src="src" lazy-load mode="widthFix" @tap="imgEvent"></image>
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-self-end coreshop-justify-center">
|
||||
<u-icon name="close-circle" color="#ffffff" size="32" @click="closeEvent"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'coreshop-modal-img',
|
||||
props: {
|
||||
src: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
imgEvent() {
|
||||
this.$emit('imgTap');
|
||||
},
|
||||
closeEvent() {
|
||||
this.$emit('closeTap');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.coreshop-modal-box { position: fixed; opacity: 0; top: inherit; left: inherit; right: inherit; bottom: inherit; z-index: 99999999; text-align: center; background: rgba(0, 0, 0, 0.6); transition: all 0.3s; pointer-events: none;
|
||||
&::before { content: "\200B"; display: inline-block; height: 100%; vertical-align: middle; }
|
||||
.dialog { position: relative; display: inline-block; vertical-align: middle; width: 310px;
|
||||
.img { width: 100%; border-radius: 3%; }
|
||||
.close { color: #dadada; top: 10px; position: relative; font-size: 26px; }
|
||||
}
|
||||
}
|
||||
.coreshop-modal-box.show { top: 0; left: 0; right: 0; bottom: 0; opacity: 1; pointer-events: auto; }
|
||||
</style>
|
||||
@@ -0,0 +1,15 @@
|
||||
.page-back {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.back {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.name {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
.title {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<uv-navbar :bgColor="props.bgColor">
|
||||
<template #left>
|
||||
<view class="page-back">
|
||||
<image v-if="props.isBack" @click="hanlderBack" class="back"
|
||||
:src="handleStaticResources('/static/images/back.png')"></image>
|
||||
<text class="name" v-if="props.mode === 'left'"
|
||||
:style="{ 'color': props.titleColor }">{{ props.title }}</text>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="props.mode === 'center'" #center>
|
||||
<view class="title" :style="{ 'color': props.titleColor }">{{ props.title }}</view>
|
||||
</template>
|
||||
</uv-navbar>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { handleStaticResources } from '@/core/utils';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
isBack : boolean,
|
||||
bgColor : string,
|
||||
titleColor : string,
|
||||
mode : string,
|
||||
title : string,
|
||||
handleCustomRouteJump : () => void | null,
|
||||
}>(), {
|
||||
isBack: true,
|
||||
bgColor: '#EEF3F7',
|
||||
titleColor: '#000',
|
||||
mode: 'center',
|
||||
title: '',
|
||||
handleCustomRouteJump: null,
|
||||
});
|
||||
|
||||
const hanlderBack = () => {
|
||||
if (props.handleCustomRouteJump) {
|
||||
props.handleCustomRouteJump();
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './coreshop-navbar.scss';
|
||||
</style>
|
||||
@@ -1,62 +0,0 @@
|
||||
<template>
|
||||
<!-- 单图 -->
|
||||
<view class="coreshop-adpop" v-if="coreshopdata.parameters.list && coreshopdata.parameters.list.length > 0">
|
||||
<view class="adpop" v-if="closeAd">
|
||||
<view class="adpop-center">
|
||||
<view class="adpop-img">
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<view @click="showSliderInfo(coreshopdata.parameters.list[0].linkType, coreshopdata.parameters.list[0].linkValue)">
|
||||
<image class="ad-img" :src="coreshopdata.parameters.list[0].image" mode="widthFix"></image>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<image class="ad-img" :src="coreshopdata.parameters.list[0].image" mode="widthFix" @click="showSliderInfo(coreshopdata.parameters.list[0].linkType, coreshopdata.parameters.list[0].linkValue)"></image>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
<image class="close-btn" src="/static/images/close-pink.png" mode="" @click="closePop"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopadpop",
|
||||
props: {
|
||||
coreshopdata: {
|
||||
// type: Object,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
closeAd: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
count() {
|
||||
// console.log(coreshopdata)
|
||||
return (this.coreshopdata.parameters.list.length > 0)
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
closePop() {
|
||||
this.closeAd = false
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.coreshop-adpop {
|
||||
.adpop { position: fixed; background: rgba(0,0,0,.5); width: 100%; height: 100vh; z-index: 999; top: 0; left: 0;
|
||||
.adpop-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 70%; text-align: center;
|
||||
.adpop-img { width: 100%; max-height: 500px; margin-bottom: 25px;
|
||||
.ad-img { width: 100%; max-height: 500px; }
|
||||
}
|
||||
.close-btn { width: 40px; height: 40px; }
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,77 +0,0 @@
|
||||
<template>
|
||||
|
||||
<view class="coreshop-padding-10 coreshop-margin-10 coreshop-bg-white coreshop-border-radius-trbl-18" v-if="count">
|
||||
<u-toast ref="uToast" />
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-min-height-30">
|
||||
<view class="coreshop-font-16 coreshop-text-black coreshop-font-weight-bold">{{title}}</view>
|
||||
<u-icon name="arrow-right-double" size="12" label="查看更多" labelSize="12" labelPos="left" @click="articleDetail(id)"></u-icon>
|
||||
</view>
|
||||
<view class="coreshop-divider">
|
||||
<view class="complete"></view>
|
||||
</view>
|
||||
<view class="coreshop-margin-bottom-10 coreshop-bg-main coreshop-text-black coreshop-index-article">
|
||||
<view class='coreshop-cell-item'>
|
||||
<view class="coreshop-cell-item-bd">
|
||||
<view class="article-des u-line-5">
|
||||
{{ brief }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell-title-img">
|
||||
<image :src="coverImage" mode="aspectFill" class="coverImage"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopArticle",
|
||||
props: {
|
||||
coreshopData: {
|
||||
// type: Array,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: "",
|
||||
brief: "",
|
||||
coverImage: "",
|
||||
id: 0
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.coreshopData.parameters.list.length > 0) {
|
||||
this.title = this.coreshopData.parameters.list[0].title;
|
||||
this.brief = this.coreshopData.parameters.list[0].brief;
|
||||
this.coverImage = this.coreshopData.parameters.list[0].coverImage;
|
||||
this.id = this.coreshopData.parameters.list[0].id;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
count() {
|
||||
return (this.coreshopData.parameters.list.length > 0)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 查看文章详情
|
||||
articleDetail(articleId) {
|
||||
this.$u.route('/pages/article/details/details?id=' + articleId + '&idType=1')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.coreshop-index-article { background: #FFFFFF !important; color: #333333 !important; overflow: hidden;
|
||||
.coreshop-cell-item { padding: 5px 0px 5px 0; float: left; width: 100%; border-bottom: 1px solid #f3f3f3;
|
||||
.coreshop-cell-item-bd { float: left; width: calc(100% - 100px);
|
||||
.article-des { font-size: 14px; color: #999; overflow: hidden; float: left; line-height: 20px; }
|
||||
}
|
||||
.cell-title-img { width: 80px; height: 80px; float: right;
|
||||
.coverImage { width: 80px; height: 80px; border-radius: 2px; }
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,68 +0,0 @@
|
||||
<template>
|
||||
<view class="coreshop-padding-10 coreshop-margin-10 coreshop-bg-white coreshop-border-radius-trbl-18" v-if="count">
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-min-height-30">
|
||||
<view class="coreshop-font-16 coreshop-text-black coreshop-font-weight-bold">{{coreshopData.parameters.articleClassifyObj.name}}</view>
|
||||
<u-icon name="arrow-right-double" size="12" label="查看更多" labelSize="12" labelPos="left" @click="goArticleClassify(coreshopData.parameters.articleClassifyObj.id)"></u-icon>
|
||||
</view>
|
||||
<view class="coreshop-divider">
|
||||
<view class="complete"></view>
|
||||
</view>
|
||||
<view class="coreshop-bg-main coreshop-text-black">
|
||||
<view class='coreshop-index-article coreshop-cell-group coreshop-margin-bottom-10 coreshop-margin-top-10 coreshop-bg-white' v-if="coreshopData.parameters.list && count">
|
||||
<view class='coreshop-cell-item' v-for="(item, index) in coreshopData.parameters.list" :key="index" @click="articleDetail(item.id)">
|
||||
<view class="coreshop-cell-item-bd">
|
||||
<view class="article-title">
|
||||
{{ item.title }}
|
||||
</view>
|
||||
<view class="article-des u-line-2">
|
||||
{{ item.brief }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell-title-img">
|
||||
<image :src="item.coverImage" mode="aspectFill" class="coverImage"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopArticleclassify",
|
||||
props: {
|
||||
coreshopData: {
|
||||
// type: Array,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
count() {
|
||||
if (!this.coreshopData.parameters.list) {
|
||||
return false;
|
||||
}
|
||||
return (this.coreshopData.parameters.list.length > 0)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 查看文章详情
|
||||
articleDetail(articleId) {
|
||||
this.$u.route('/pages/article/details/details?id=' + articleId + '&idType=1')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.coreshop-index-article { border-radius: 8px; background: #FFFFFF !important; color: #333333 !important; overflow: hidden;
|
||||
.coreshop-cell-item { padding: 8px 0px 8px 0; float: left; width: 100%; border-bottom: 1px solid #f3f3f3;
|
||||
.coreshop-cell-item-bd { float: left; display: flex; flex-direction: column;
|
||||
.article-title { font-size: 14px; color: #333; width: 100%; overflow: hidden; float: left; margin-bottom: 5px; }
|
||||
.article-des { font-size: 12px; color: #999; overflow: hidden; float: left; line-height: 20px; }
|
||||
}
|
||||
.cell-title-img { width: 80px; height: 80px; float: right;
|
||||
.coverImage { width: 80px; height: 80px; border-radius: 2px; }
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,20 +0,0 @@
|
||||
<template>
|
||||
<view>
|
||||
<u-gap :height="coreshopData.parameters.height * 2" :bg-color="coreshopData.parameters.backgroundColor"></u-gap>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopBlank",
|
||||
props: {
|
||||
coreshopData: {
|
||||
// type: Array,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,21 +0,0 @@
|
||||
<template>
|
||||
<view class="u-content">
|
||||
<u-parse :content="content" :selectable="true"></u-parse>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
//视频和文本解析组件
|
||||
export default {
|
||||
name: 'coreshopContent',
|
||||
props: {
|
||||
content: {
|
||||
required: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.u-content { color: $u-content-color; font-size: 13px; line-height: 1.8; }
|
||||
.u-content p { color: $u-tips-color; }
|
||||
</style>
|
||||
@@ -1,93 +0,0 @@
|
||||
<template>
|
||||
<view class="coreshop-padding-10 coreshop-margin-10 coreshop-bg-white coreshop-border-radius-trbl-18" v-if="count">
|
||||
<u-toast ref="uToast" />
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-min-height-30">
|
||||
<view class="coreshop-font-16 coreshop-text-black coreshop-font-weight-bold">领券专区</view>
|
||||
<u-icon name="arrow-right-double" size="12" label="查看更多" labelSize="12" labelPos="left" @tap="$u.route('/pages/coupon/coupon')"></u-icon>
|
||||
</view>
|
||||
<view class="coreshop-divider">
|
||||
<view class="complete"></view>
|
||||
</view>
|
||||
<view class="coreshop-margin-bottom-10 coreshop-bg-main coreshop-text-black">
|
||||
<scroll-view class="groupon-scroll" enable-flex scroll-anchoring scroll-x scroll-with-animation>
|
||||
<view class="groupon-card-wrap coreshop-flex coreshop-align-center">
|
||||
<view v-for="(item, index) in coreshopData.parameters.list" :key="index">
|
||||
<view class="coreshop-padding-right-5">
|
||||
<view class="coupon-wrap " :style="{ background: `linear-gradient(to right, ${bgColor1}, ${bgColor2})` }">
|
||||
<view class="coupon-item coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between">
|
||||
<view class="coupon-left coreshop-flex coreshop-flex-direction">
|
||||
<view class="sum-box">
|
||||
<text class="unit" style="color: #6b3f12">¥</text>
|
||||
<text class="sub" style="color: #6b3f12">{{ item.name }}</text>
|
||||
</view>
|
||||
<view class="notice " style="color: #9d6d25">
|
||||
<text v-for="(itemCondition, index) in item.conditions" :key="index">【{{itemCondition}}】</text>
|
||||
</view>
|
||||
<view class="notice" style="color: #9d6d25">
|
||||
有效期:{{$u.timeFormat(item.startTime, 'yyyy-mm-dd')}} 至 {{$u.timeFormat(item.endTime, 'yyyy-mm-dd')}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="coupon-right coreshop-flex coreshop-flex-direction">
|
||||
<button class="get-btn" :style="{ color: bgColor1 }" @tap.stop="receiveCoupon(item.id)">立即领取</button>
|
||||
<view class="surplus-num" style="color: #9d6d25">
|
||||
<text v-for="(itemResult, index) in item.results" :key="index">{{itemResult}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopCoupon",
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
coreshopData: {
|
||||
type: Object,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
count() {
|
||||
if (!this.coreshopData) {
|
||||
return false;
|
||||
}
|
||||
if (!this.coreshopData.parameters) {
|
||||
return false;
|
||||
}
|
||||
if (!this.coreshopData.parameters.list) {
|
||||
return false;
|
||||
}
|
||||
return (this.coreshopData.parameters.list.length > 0)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.coupon-wrap { mask: url($apiFilesUrl+'/static/images/coupon/coupon_bg1.png'); -webkit-mask-box-image: url($apiFilesUrl+'/static/images/coupon/coupon_bg1.png'); mask-size: 100% 100%; position: relative; border-radius: 5px; width: 355px; height: 100px; background: linear-gradient(to right, $u-type-warning-disabled, $u-type-warning);
|
||||
.coupon-item { width: 100%; height: 100%; border-radius: 5px;
|
||||
.coupon-left { justify-content: center; padding-left: 10px; padding-right: 5px;
|
||||
.unit { font-size: 12px; color: #fff; }
|
||||
.sum { font-size: 22.5px; font-weight: bold; color: #fff; line-height: 22.5px; padding-right: 5px; }
|
||||
.sub { font-size: 18px; font-weight: bold; color: #fff; line-height: 18px; padding-right: 5px; }
|
||||
.notice { font-size: 11px; color: rgba(#fff, 0.7); margin-top: 3px; }
|
||||
}
|
||||
.coupon-right { min-width: 110px; justify-content: center; align-items: center; padding-right: 5px;
|
||||
.get-btn { width: 72px; height: 27px; background: #ffffff; border-radius: 13px; padding: 0; font-size: 12px; font-weight: 500; color: $u-type-warning; }
|
||||
.surplus-num { font-size: 11px; font-weight: 500; color: #fff; margin-top: 7px; }
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,199 +0,0 @@
|
||||
<template>
|
||||
<view class="coreshop-padding-10 coreshop-margin-10 coreshop-bg-white coreshop-border-radius-trbl-18" style="overflow: hidden;">
|
||||
<u-tabs :list="nameList" :current="current" @change="onChange"></u-tabs>
|
||||
<view class="coreshop-divider">
|
||||
<view class="complete"></view>
|
||||
</view>
|
||||
|
||||
<view class="coreshop-text-black" v-for="(newData, indexParent) in coreshopData.parameters.list" :key="indexParent" v-show="newData.isShow">
|
||||
<view class="flex-box clear-fix">
|
||||
<view class="coreshop-padding-bottom-10 coreshop-bg-main column-value2" v-for="(item,index) in newData.list" :key="index" v-if="newData.column==2">
|
||||
<view class="coreshop-padding-top-6 coreshop-padding-bottom-3 coreshop-padding-left-8 coreshop-padding-right-8 coreshop-bg-main coreshop-border-radius-bl-18" @click="goGoodsDetail(item.id)">
|
||||
<image :src="item.image" class="img" mode="widthFix"></image>
|
||||
<view class="coreshop-multiple-line-clamp">
|
||||
<text class="coreshop-font-14">{{item.name}}</text>
|
||||
</view>
|
||||
<view class="coreshop-margin-top-8 coreshop-flex coreshop-justify-between coreshop-align-center coreshop-margin-bottom-5">
|
||||
<view class="coreshop-text-red coreshop-font-weight-bold">
|
||||
<text class="coreshop-font-12">¥</text>
|
||||
<text class="coreshop-font-16">{{item.price}}</text>
|
||||
<span class="coreshop-font-xs coreshop-text-through coreshop-margin-left-6 coreshop-text-gray" v-if="newData.column==2">{{item.mktprice}}元</span>
|
||||
</view>
|
||||
<view>
|
||||
<text class="coreshop-font-10 coreshop-text-gray">已售{{item.buyCount+item.initialSales}}{{item.unit}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-divider" v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && item.pointsDeduction > 0">
|
||||
<view class="complete"></view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-font-11 coreshop-margin-top-5 coreshop-margin-bottom-5" :class="newData.column>2?'coreshop-flex-direction-column':'coreshop-flex-direction-row'" v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && item.pointsDeduction > 0">
|
||||
<view>
|
||||
{{ pointShowName}}兑换价:
|
||||
</view>
|
||||
<view class="coreshop-text-red">
|
||||
{{pointDiscountedProportion * item.pointsDeduction }}{{ pointShowName}}+{{ parseFloat(item.price-item.pointsDeduction).toFixed(2)}} 元
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-flex-direction-row coreshop-font-11 coreshop-margin-top-5 coreshop-margin-bottom-5" v-if="pointSwitch==1 && pointGetModel==2 && pointShowPoint==1 && item.points > 0">
|
||||
<view>
|
||||
购买赠送:
|
||||
</view>
|
||||
<view class="coreshop-text-red">
|
||||
{{item.points}}{{ pointShowName}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-box3 clear-fix">
|
||||
<view class="coreshop-padding-bottom-10 coreshop-bg-main column-value3" v-for="(item,index) in newData.list" :key="index" v-if="newData.column==3">
|
||||
<view class="coreshop-padding-top-6 coreshop-padding-bottom-3 coreshop-padding-left-4 coreshop-padding-right-4 coreshop-bg-main coreshop-border-radius-bl-18" @click="goGoodsDetail(item.id)">
|
||||
<image :src="item.image" class="img" mode="widthFix"></image>
|
||||
<view class="coreshop-multiple-line-clamp">
|
||||
<text class="coreshop-font-14">{{item.name}}</text>
|
||||
</view>
|
||||
<view class="coreshop-margin-top-8 coreshop-flex coreshop-justify-between coreshop-align-center coreshop-margin-bottom-5">
|
||||
<view class="coreshop-text-red coreshop-font-weight-bold">
|
||||
<text class="coreshop-font-12">¥</text>
|
||||
<text class="coreshop-font-16">{{item.price}}</text>
|
||||
<span class="coreshop-font-xs coreshop-text-through coreshop-margin-left-6 coreshop-text-gray" v-if="newData.column==2">{{item.mktprice}}元</span>
|
||||
</view>
|
||||
<view>
|
||||
<text class="coreshop-font-10 coreshop-text-gray">已售{{item.buyCount+item.initialSales}}{{item.unit}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-divider" v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && item.pointsDeduction > 0">
|
||||
<view class="complete"></view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-font-11 coreshop-margin-top-5 coreshop-margin-bottom-5" :class="newData.column>2?'coreshop-flex-direction-column':'coreshop-flex-direction-row'" v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && item.pointsDeduction > 0">
|
||||
<view>
|
||||
{{ pointShowName}}兑换价:
|
||||
</view>
|
||||
<view class="coreshop-text-red">
|
||||
{{pointDiscountedProportion * item.pointsDeduction }}{{ pointShowName}}+{{ parseFloat(item.price-item.pointsDeduction).toFixed(2)}} 元
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-flex-direction-row coreshop-font-11 coreshop-margin-top-5 coreshop-margin-bottom-5" v-if="pointSwitch==1 && pointGetModel==2 && pointShowPoint==1 && item.points > 0">
|
||||
<view>
|
||||
购买赠送:
|
||||
</view>
|
||||
<view class="coreshop-text-red">
|
||||
{{item.points}}{{ pointShowName}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="coreshop-text-black" v-for="(item, index) in newData.list" :key="index" v-if="newData.column==1">
|
||||
<view class="coreshop-flex coreshop-justify-start coreshop-padding-top-10 coreshop-padding-bottom-10" v-if="newData.list.length" @click="goGoodsDetail(item.id)">
|
||||
<view>
|
||||
<u--image :src="item.image" mode="widthFix" width="130px" height="130px" radius="8"></u--image>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-flex-direction coreshop-padding-left-10">
|
||||
<view class="coreshop-font-14 u-line-2 coreshop-text-black">{{ item.name }}</view>
|
||||
<view class="coreshop-font-11 coreshop-padding-top-5 coreshop-padding-bottom-3 u-line-2 coreshop-text-brown">{{ item.brief }}</view>
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-padding-top-10 coreshop-padding-bottom-10">
|
||||
<view class="coreshop-font-11 coreshop-bg-orange coreshop-padding-2 coreshop-border-radius-4 coreshop-margin-right-10">已售{{item.buyCount}}{{item.unit}}</view>
|
||||
<view class="coreshop-font-11 coreshop-bg-olive coreshop-padding-2 coreshop-border-radius-4">{{item.viewCount}}人访问</view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-flex-direction-row coreshop-font-11 coreshop-margin-bottom-5" v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && item.pointsDeduction > 0">
|
||||
<view>
|
||||
{{ pointShowName}}兑换价:
|
||||
</view>
|
||||
<view class="coreshop-text-red">
|
||||
{{pointDiscountedProportion * item.pointsDeduction }}{{ pointShowName}}+{{ parseFloat(item.price-item.pointsDeduction).toFixed(2)}} 元
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-flex-direction-row coreshop-font-11 coreshop-margin-top-5" v-if="pointSwitch==1 && pointGetModel==2 && pointShowPoint==1 && item.points > 0">
|
||||
<view>
|
||||
购买赠送:
|
||||
</view>
|
||||
<view class="coreshop-text-red">
|
||||
{{item.points}}{{ pointShowName}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-justify-between coreshop-flex-direction-row coreshop-align-center">
|
||||
<view class="coreshop-flex coreshop-align-center">
|
||||
<view class="coreshop-font-14 coreshop-text-red">¥{{ item.price }}</view>
|
||||
<view class="coreshop-font-12 coreshop-text-gray coreshop-text-through">¥{{ item.mktprice }}</view>
|
||||
</view>
|
||||
<view class="coreshop-buy-btn">立即购</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="order-none" v-else>
|
||||
<u-empty :icon="$globalConstVars.apiFilesUrl+'/static/images/empty/order.png'" icon-size="150" text="暂无" mode="list"></u-empty>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
current: 0,
|
||||
nameList: [],
|
||||
};
|
||||
},
|
||||
name: "coreshopGoodTabBar",
|
||||
props: {
|
||||
coreshopData: {
|
||||
// type: Array,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
var _this = this;
|
||||
for (var i = 0; i < this.coreshopData.parameters.list.length; i++) {
|
||||
let item = {
|
||||
name: this.coreshopData.parameters.list[i].title
|
||||
}
|
||||
this.nameList.push(item);
|
||||
if (_this.current == i) {
|
||||
this.coreshopData.parameters.list[i].isShow = true;
|
||||
} else {
|
||||
this.coreshopData.parameters.list[i].isShow = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
pointSwitch() { return this.$store.state.config.pointSwitch },
|
||||
pointShowExchangePrice() { return this.$store.state.config.pointShowExchangePrice },
|
||||
pointDiscountedProportion() { return this.$store.state.config.pointDiscountedProportion },
|
||||
pointExchangeModel() { return this.$store.state.config.pointExchangeModel },
|
||||
pointShowName() { return this.$store.state.config.pointShowName },
|
||||
pointGetModel() { return this.$store.state.config.pointGetModel },
|
||||
pointShowPoint() { return this.$store.state.config.pointShowPoint },
|
||||
},
|
||||
methods: {
|
||||
onChange(item) {
|
||||
var _this = this;
|
||||
this.current = item.index;
|
||||
for (var i = 0; i < _this.coreshopData.parameters.list.length; i++) {
|
||||
if (_this.current == i) {
|
||||
_this.coreshopData.parameters.list[i].isShow = true;
|
||||
} else {
|
||||
_this.coreshopData.parameters.list[i].isShow = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.flex-box { column-count: 2; column-gap: 8px;
|
||||
.column-value2 { width: 100%; break-inside: avoid; color: #333333 !important; margin-bottom: 8px; }
|
||||
}
|
||||
.flex-box3 { column-count: 3; column-gap: 8px;
|
||||
.column-value3 { width: 100%; break-inside: avoid; color: #333333 !important; margin-bottom: 5px; }
|
||||
}
|
||||
.img { width: 100%; }
|
||||
.clear-fix::after { content: ''; display: block; height: 0; clear: both; }
|
||||
.clear-fix { zoom: 1; }
|
||||
</style>
|
||||
@@ -1,368 +0,0 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 列表平铺两列三列 -->
|
||||
<view class="" v-if="coreshopData.parameters.column == '2' && coreshopData.parameters.display == 'list' || coreshopData.parameters.column == '3' && coreshopData.parameters.display == 'list'">
|
||||
<view class="coreshop-padding-top-10 coreshop-padding-left-10 coreshop-padding-right-10 coreshop-margin-top-10 coreshop-margin-left-10 coreshop-margin-right-10 coreshop-bg-white coreshop-border-radius-trbl-18">
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-min-height-30" v-if="coreshopData.parameters.lookTitle == 'true'">
|
||||
<view class="coreshop-font-16 coreshop-text-black coreshop-font-weight-bold">{{coreshopData.parameters.title}}</view>
|
||||
<u-icon name="arrow-right-double" size="12" label="查看更多" labelSize="12" labelPos="left" v-if="coreshopData.parameters.lookMore == 'true' && coreshopData.parameters.type == 'auto'" @click="goGoodsList({catId: coreshopData.parameters.classifyId,brandId:coreshopData.parameters.brandId})"></u-icon>
|
||||
</view>
|
||||
<view class="coreshop-divider">
|
||||
<view class="complete"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="waterfall">
|
||||
<uv-waterfall ref="waterfall"
|
||||
v-model="coreshopData.parameters.list"
|
||||
:columnCount="coreshopData.parameters.column"
|
||||
:add-time="10"
|
||||
:left-gap="leftGap"
|
||||
:right-gap="rightGap"
|
||||
:column-gap="columnGap"
|
||||
@changeList="changeList">
|
||||
<!-- 第一列数据 -->
|
||||
<template v-slot:list1>
|
||||
<!-- 为了磨平部分平台的BUG,必须套一层view -->
|
||||
<view>
|
||||
<view v-for="(item, index) in list1" :key="item.id" class="waterfall-item" @tap="goGoodsDetail(item.id)">
|
||||
<view class="goods coreshop-padding-bottom-10 coreshop-bg-main">
|
||||
<view class="waterfall-item__image" :style="[imageStyle(item,coreshopData.parameters.column)]">
|
||||
<image :src="item.image" mode="widthFix" :style="{width:item.width+'px'}"></image>
|
||||
</view>
|
||||
<view class="coreshop-padding-top-6 coreshop-padding-bottom-3 coreshop-padding-left-8 coreshop-padding-right-8 coreshop-bg-main coreshop-border-radius-bl-18">
|
||||
<view class="coreshop-multiple-line-clamp">
|
||||
<text class="coreshop-font-14">{{item.name}}</text>
|
||||
</view>
|
||||
<view class="coreshop-margin-top-8 coreshop-flex coreshop-justify-between coreshop-align-center coreshop-margin-bottom-5">
|
||||
<view class="coreshop-text-red coreshop-font-weight-bold">
|
||||
<text class="coreshop-font-12">¥</text>
|
||||
<text class="coreshop-font-16">{{item.price}}</text>
|
||||
<span class="coreshop-font-xs coreshop-text-through coreshop-margin-left-6 coreshop-text-gray" v-if="coreshopData.parameters.column==2">{{item.mktprice}}元</span>
|
||||
</view>
|
||||
<view>
|
||||
<text class="coreshop-font-10 coreshop-text-gray">已售{{item.buyCount+item.initialSales}}{{item.unit}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-divider" v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && item.pointsDeduction > 0">
|
||||
<view class="complete"></view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-font-11 coreshop-margin-top-10 coreshop-margin-bottom-5" :class="coreshopData.parameters.column>2?'coreshop-flex-direction-column':'coreshop-flex-direction-row'" v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && item.pointsDeduction > 0">
|
||||
<view>
|
||||
{{ pointShowName}}兑换价:
|
||||
</view>
|
||||
<view class="coreshop-text-red">
|
||||
{{pointDiscountedProportion * item.pointsDeduction }}{{ pointShowName}}+{{ parseFloat(item.price-item.pointsDeduction).toFixed(2)}}元
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-flex-direction-row coreshop-font-11 coreshop-margin-top-5 coreshop-margin-bottom-5" v-if="pointSwitch==1 && pointGetModel==2 && pointShowPoint==1 && item.points > 0">
|
||||
<view>
|
||||
购买赠送:
|
||||
</view>
|
||||
<view class="coreshop-text-red">
|
||||
{{item.points}}{{ pointShowName}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<!-- 第二列数据 -->
|
||||
<template v-slot:list2 v-if="coreshopData.parameters.column>=2">
|
||||
<!-- 为了磨平部分平台的BUG,必须套一层view -->
|
||||
<view>
|
||||
<view v-for="(item, index) in list2" :key="item.id" class="waterfall-item" @tap="goGoodsDetail(item.id)">
|
||||
<view class="goods coreshop-padding-bottom-10 coreshop-bg-main">
|
||||
<view class="waterfall-item__image" :style="[imageStyle(item,coreshopData.parameters.column)]">
|
||||
<image :src="item.image" mode="widthFix" :style="{width:item.width+'px'}"></image>
|
||||
</view>
|
||||
<view class="coreshop-padding-top-6 coreshop-padding-bottom-3 coreshop-padding-left-8 coreshop-padding-right-8 coreshop-bg-main coreshop-border-radius-bl-18">
|
||||
<view class="coreshop-multiple-line-clamp">
|
||||
<text class="coreshop-font-14">{{item.name}}</text>
|
||||
</view>
|
||||
<view class="coreshop-margin-top-8 coreshop-flex coreshop-justify-between coreshop-align-center coreshop-margin-bottom-5">
|
||||
<view class="coreshop-text-red coreshop-font-weight-bold">
|
||||
<text class="coreshop-font-12">¥</text>
|
||||
<text class="coreshop-font-16">{{item.price}}</text>
|
||||
<span class="coreshop-font-xs coreshop-text-through coreshop-margin-left-6 coreshop-text-gray" v-if="coreshopData.parameters.column==2">{{item.mktprice}}元</span>
|
||||
</view>
|
||||
<view>
|
||||
<text class="coreshop-font-10 coreshop-text-gray">已售{{item.buyCount+item.initialSales}}{{item.unit}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-divider" v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && item.pointsDeduction > 0">
|
||||
<view class="complete"></view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-font-11 coreshop-margin-top-10 coreshop-margin-bottom-5" :class="coreshopData.parameters.column>2?'coreshop-flex-direction-column':'coreshop-flex-direction-row'" v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && item.pointsDeduction > 0">
|
||||
<view>
|
||||
{{ pointShowName}}兑换价:
|
||||
</view>
|
||||
<view class="coreshop-text-red">
|
||||
{{pointDiscountedProportion * item.pointsDeduction }}{{ pointShowName}}+{{ parseFloat(item.price-item.pointsDeduction).toFixed(2)}}元
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-flex-direction-row coreshop-font-11 coreshop-margin-top-5 coreshop-margin-bottom-5" v-if="pointSwitch==1 && pointGetModel==2 && pointShowPoint==1 && item.points > 0">
|
||||
<view>
|
||||
购买赠送:
|
||||
</view>
|
||||
<view class="coreshop-text-red">
|
||||
{{item.points}}{{ pointShowName}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<!-- 第三列数据 -->
|
||||
<template v-slot:list3 v-if="coreshopData.parameters.column>=3">
|
||||
<!-- 为了磨平部分平台的BUG,必须套一层view -->
|
||||
<view>
|
||||
<view v-for="(item, index) in list3" :key="item.id" class="waterfall-item" @tap="goGoodsDetail(item.id)">
|
||||
<view class="goods coreshop-padding-bottom-10 coreshop-bg-main">
|
||||
<view class="waterfall-item__image" :style="[imageStyle(item,coreshopData.parameters.column)]">
|
||||
<image :src="item.image" mode="widthFix" :style="{width:item.width+'px'}"></image>
|
||||
</view>
|
||||
<view class="coreshop-padding-top-6 coreshop-padding-bottom-3 coreshop-padding-left-8 coreshop-padding-right-8 coreshop-bg-main coreshop-border-radius-bl-18">
|
||||
<view class="coreshop-multiple-line-clamp">
|
||||
<text class="coreshop-font-14">{{item.name}}</text>
|
||||
</view>
|
||||
<view class="coreshop-margin-top-8 coreshop-flex coreshop-justify-between coreshop-align-center coreshop-margin-bottom-5">
|
||||
<view class="coreshop-text-red coreshop-font-weight-bold">
|
||||
<text class="coreshop-font-12">¥</text>
|
||||
<text class="coreshop-font-16">{{item.price}}</text>
|
||||
<span class="coreshop-font-xs coreshop-text-through coreshop-margin-left-6 coreshop-text-gray" v-if="coreshopData.parameters.column==2">{{item.mktprice}}元</span>
|
||||
</view>
|
||||
<view>
|
||||
<text class="coreshop-font-10 coreshop-text-gray">已售{{item.buyCount+item.initialSales}}{{item.unit}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-divider" v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && item.pointsDeduction > 0">
|
||||
<view class="complete"></view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-font-11 coreshop-margin-top-10 coreshop-margin-bottom-5" :class="coreshopData.parameters.column>2?'coreshop-flex-direction-column':'coreshop-flex-direction-row'" v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && item.pointsDeduction > 0">
|
||||
<view>
|
||||
{{ pointShowName}}兑换价:
|
||||
</view>
|
||||
<view class="coreshop-text-red">
|
||||
{{pointDiscountedProportion * item.pointsDeduction }}{{ pointShowName}}+{{ parseFloat(item.price-item.pointsDeduction).toFixed(2)}}元
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-flex-direction-row coreshop-font-11 coreshop-margin-top-5 coreshop-margin-bottom-5" v-if="pointSwitch==1 && pointGetModel==2 && pointShowPoint==1 && item.points > 0">
|
||||
<view>
|
||||
购买赠送:
|
||||
</view>
|
||||
<view class="coreshop-text-red">
|
||||
{{item.points}}{{ pointShowName}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</uv-waterfall>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 列表平铺单列 -->
|
||||
<view class="coreshop-padding-10 coreshop-margin-10 coreshop-bg-white coreshop-border-radius-trbl-18" v-if="coreshopData.parameters.column == '1' && coreshopData.parameters.display == 'list'">
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-min-height-30" v-if="coreshopData.parameters.lookMore == 'true'">
|
||||
<view class="coreshop-font-16 coreshop-text-black coreshop-font-weight-bold">{{coreshopData.parameters.title}}</view>
|
||||
<u-icon name="arrow-right-double" size="12" label="查看更多" labelSize="12" labelPos="left" v-if="coreshopData.parameters.lookMore == 'true' && coreshopData.parameters.type == 'auto'" @click="goGoodsList({catId: coreshopData.parameters.classifyId,brandId:coreshopData.parameters.brandId})"></u-icon>
|
||||
</view>
|
||||
<view class="coreshop-divider">
|
||||
<view class="complete"></view>
|
||||
</view>
|
||||
<view class="coreshop-text-black" v-for="(item, index) in coreshopData.parameters.list" :key="index" v-if="count" @tap="goGoodsDetail(item.id)">
|
||||
<view class="coreshop-flex coreshop-justify-start coreshop-padding-top-10 coreshop-padding-bottom-10">
|
||||
<view>
|
||||
<u--image :src="item.image" mode="widthFix" width="130px" height="130px" radius="8"></u--image>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-flex-direction coreshop-padding-left-10 coreshop-percent-100">
|
||||
<view class="coreshop-font-14 u-line-2 coreshop-text-black">{{ item.name }}</view>
|
||||
<view class="coreshop-font-11 coreshop-padding-top-5 coreshop-padding-bottom-3 u-line-2 coreshop-text-brown">{{ item.brief }}</view>
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-padding-top-10 coreshop-padding-bottom-10">
|
||||
<view class="coreshop-font-11 coreshop-bg-orange coreshop-padding-2 coreshop-border-radius-4 coreshop-margin-right-10">已售{{item.buyCount+item.initialSales}}{{item.unit}}</view>
|
||||
<view class="coreshop-font-11 coreshop-bg-olive coreshop-padding-2 coreshop-border-radius-4">{{item.viewCount}}人访问</view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-justify-between coreshop-flex-direction-row coreshop-align-center">
|
||||
<view class="coreshop-flex coreshop-align-center">
|
||||
<view class="coreshop-font-14 coreshop-text-red">¥{{ item.price }}</view>
|
||||
<view class="coreshop-font-12 coreshop-text-gray coreshop-text-through">¥{{ item.mktprice }}</view>
|
||||
</view>
|
||||
<view class="coreshop-buy-btn">马上抢</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-flex-direction-row coreshop-font-11 coreshop-margin-top-5" v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && item.pointsDeduction > 0">
|
||||
<view>
|
||||
{{ pointShowName}}兑换价:
|
||||
</view>
|
||||
<view class="coreshop-text-red">
|
||||
{{pointDiscountedProportion * item.pointsDeduction }}{{ pointShowName}}+{{ parseFloat(item.price-item.pointsDeduction).toFixed(2)}} 元
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-flex-direction-row coreshop-font-11 coreshop-margin-top-5" v-if="pointSwitch==1 && pointGetModel==2 && pointShowPoint==1 && item.points > 0">
|
||||
<view>
|
||||
购买赠送:
|
||||
</view>
|
||||
<view class="coreshop-text-red">
|
||||
{{item.points}}{{ pointShowName}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="order-none" v-else>
|
||||
<u-empty :icon="$globalConstVars.apiFilesUrl+'/static/images/empty/order.png'" icon-size="150" text="暂无" mode="list"></u-empty>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 横向滚动 -->
|
||||
<view class="coreshop-padding-10 coreshop-margin-10 coreshop-bg-white coreshop-border-radius-trbl-18" v-if="coreshopData.parameters.display == 'slide'">
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-min-height-30" v-if="coreshopData.parameters.lookTitle == 'true'">
|
||||
<view class="coreshop-font-16 coreshop-text-black coreshop-font-weight-bold">{{coreshopData.parameters.title}}</view>
|
||||
<u-icon name="arrow-right-double" size="12" label="查看更多" labelSize="12" labelPos="left" v-if="coreshopData.parameters.lookMore == 'true' && coreshopData.parameters.type == 'auto'" @click="goGoodsList({catId: coreshopData.parameters.classifyId,brandId:coreshopData.parameters.brandId})"></u-icon>
|
||||
</view>
|
||||
<view class="coreshop-divider">
|
||||
<view class="complete"></view>
|
||||
</view>
|
||||
<view v-if="count">
|
||||
<swiper :class="coreshopData.parameters.column==3?'swiper3':coreshopData.parameters.column==2?'swiper2':''" @change="change">
|
||||
<swiper-item v-for="(no, indexPage) of pageCount" :key="indexPage">
|
||||
<u-grid :col="coreshopData.parameters.column" :border="false" align="left" :data-id="no">
|
||||
<u-grid-item v-for="(item, index) in coreshopData.parameters.list" v-if="index >=coreshopData.parameters.column*no && index <coreshopData.parameters.column*(no+1)" :key="index" @click="goGoodsDetail(item.id)">
|
||||
<view class="good_box">
|
||||
<u-image :src="item.image" :index="item.id" mode="widthFit" width="100%" :height="coreshopData.parameters.column==3?'104px':coreshopData.parameters.column==2?'164px':'104px'" radius="10">
|
||||
</u-image>
|
||||
<view class="good_title u-line-2">
|
||||
{{item.name}}
|
||||
</view>
|
||||
<view class="good-price coreshop-display-block">
|
||||
{{item.price}}元 <span class="coreshop-font-xs coreshop-text-through coreshop-margin-left-5 coreshop-text-gray">{{item.mktprice}}元</span>
|
||||
</view>
|
||||
<view class="good-tag-recommend" v-if="item.isRecommend">
|
||||
推荐
|
||||
</view>
|
||||
<view class="good-tag-hot" v-if="item.isHot">
|
||||
热门
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-flex-direction-row coreshop-font-11 coreshop-margin-top-5" v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && item.pointsDeduction > 0">
|
||||
<view>
|
||||
{{ pointShowName}}兑换价:
|
||||
</view>
|
||||
<view class="coreshop-text-red">
|
||||
{{pointDiscountedProportion * item.pointsDeduction }}{{ pointShowName}}+{{ parseFloat(item.price-item.pointsDeduction).toFixed(2)}} 元
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-flex-direction-row coreshop-font-11 coreshop-margin-top-5" v-if="pointSwitch==1 && pointGetModel==2 && pointShowPoint==1 && item.points > 0">
|
||||
<view>
|
||||
购买赠送:
|
||||
</view>
|
||||
<view class="coreshop-text-red">
|
||||
{{item.points}}{{ pointShowName}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view class="indicator-dots">
|
||||
<view class="indicator-dots-item" v-for="(no, index) of pageCount" :key="index" :class="[current == no ? 'indicator-dots-active' : '']">
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else="">
|
||||
<scroll-view class='swiper-list' scroll-x="true"></scroll-view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
current: 0,
|
||||
pageCount: [],
|
||||
count: false,
|
||||
list1: [],// 瀑布流第一列数据
|
||||
list2: [],// 瀑布流第二列数据
|
||||
list3: [],// 瀑布流第三列数据
|
||||
leftGap: 10,
|
||||
rightGap: 10,
|
||||
columnGap: 10
|
||||
};
|
||||
},
|
||||
name: "coreshopGoods",
|
||||
props: {
|
||||
coreshopData: {
|
||||
// type: Array,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
imageStyle(item, column) {
|
||||
return item => {
|
||||
const v = uni.upx2px(750) - this.leftGap - this.rightGap - this.columnGap;
|
||||
const w = v / column;
|
||||
const rate = w / item.w;
|
||||
const h = rate * item.h;
|
||||
return {
|
||||
width: w + 'px',
|
||||
height: h + 'px'
|
||||
}
|
||||
}
|
||||
},
|
||||
pointSwitch() { return this.$store.state.config.pointSwitch },
|
||||
pointShowExchangePrice() { return this.$store.state.config.pointShowExchangePrice },
|
||||
pointDiscountedProportion() { return this.$store.state.config.pointDiscountedProportion },
|
||||
pointExchangeModel() { return this.$store.state.config.pointExchangeModel },
|
||||
pointShowName() { return this.$store.state.config.pointShowName },
|
||||
pointGetModel() { return this.$store.state.config.pointGetModel },
|
||||
pointShowPoint() { return this.$store.state.config.pointShowPoint },
|
||||
},
|
||||
methods: {
|
||||
// 这点非常重要:e.name在这里返回是list1或list2,要手动将数据追加到相应列
|
||||
changeList(e) {
|
||||
this[e.name].push(e.value);
|
||||
},
|
||||
change(e) {
|
||||
this.current = e.detail.current;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.count = this.coreshopData.parameters.list.length > 0;
|
||||
var page = Number(this.coreshopData.parameters.list.length / this.coreshopData.parameters.column).toFixed(0);
|
||||
if (this.coreshopData.parameters.column * page < this.coreshopData.parameters.list.length) {
|
||||
page = Number(page) + 1;
|
||||
}
|
||||
for (var i = 0; i < page; i++) {
|
||||
this.pageCount.push(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.good_box { border-radius: 8px; background-color: #ffffff; padding: 5px; position: relative; width: 100%;
|
||||
.good_title { font-size: 14px; margin-top: 5px; color: $u-main-color; }
|
||||
.good-tag-hot { display: flex; margin-top: 5px; position: absolute; top: 7.5px; left: 7.5px; background-color: $u-type-error; color: #FFFFFF; display: flex; align-items: center; padding: 2px 7px; border-radius: 25px; font-size: 10px; line-height: 1; }
|
||||
.good-tag-recommend { display: flex; margin-top: 5px; position: absolute; top: 7.5px; right: 7.5px; background-color: $u-type-primary; color: #FFFFFF; margin-left: 10px; border-radius: 25px; line-height: 1; padding: 2px 7px; display: flex; align-items: center; border-radius: 25px; font-size: 10px; }
|
||||
.good-tag-recommend2 { display: flex; margin-top: 5px; position: absolute; bottom: 7.5px; left: 7.5px; background-color: $u-type-primary; color: #FFFFFF; border-radius: 25px; line-height: 1; padding: 2px 7px; display: flex; align-items: center; border-radius: 25px; font-size: 10px; }
|
||||
.good-price { font-size: 15px; color: $u-type-error; margin-top: 5px; }
|
||||
}
|
||||
|
||||
.indicator-dots { margin-top: 10px; margin-bottom: 10px; display: flex; justify-content: center; align-items: center; flex-direction: row;
|
||||
.indicator-dots-item { background-color: $u-tips-color; height: 6px; width: 6px; border-radius: 10px; margin: 0 3px; }
|
||||
.indicator-dots-active { background-color: $u-type-primary; }
|
||||
}
|
||||
.swiper3 { height: 200px; }
|
||||
.swiper2 { height: 270px; }
|
||||
.image2 { height: 150px; }
|
||||
.image3 { height: 150px; }
|
||||
</style>
|
||||
@@ -1,104 +0,0 @@
|
||||
<template>
|
||||
<view class="coreshop-padding-10 coreshop-margin-10 coreshop-bg-white coreshop-border-radius-trbl-18" v-if="listData && count">
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-min-height-30">
|
||||
<view class="coreshop-font-16 coreshop-text-black coreshop-font-weight-bold">{{coreshopData.parameters.title}}</view>
|
||||
<u-icon name="arrow-right-double" size="12" label="查看更多" labelSize="12" labelPos="left" @tap="goGroupPurchase()"></u-icon>
|
||||
</view>
|
||||
<view class="coreshop-divider">
|
||||
<view class="complete"></view>
|
||||
</view>
|
||||
<view class="coreshop-flex-direction coreshop-margin-bottom-10 coreshop-text-black" v-for="(item, key) in listData" :key="key">
|
||||
<view class="coreshop-flex">
|
||||
<view>
|
||||
<u--image :src="item.goodThumbnail" mode="widthFix" width="96px" height="96px" radius="8"></u--image>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-flex-direction coreshop-padding-left-10 coreshop-percent-100">
|
||||
<view class="coreshop-font-15 u-line-2 coreshop-text-black">{{ item.name }}</view>
|
||||
<view class="coreshop-font-11 coreshop-padding-top-5 coreshop-padding-bottom-3 u-line-2 coreshop-text-brown">{{ item.goodName }}</view>
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-start coreshop-min-height-30" v-if="(item.startStatus == 1) && item.timestamp">
|
||||
<view class="coreshop-font-12">仅剩:</view><u-count-down :time="item.timestamp*1000" format="DD天HH时mm分ss秒" autoStart></u-count-down>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-start coreshop-min-height-30" v-if="(item.startStatus == 0) && item.timestamp">
|
||||
<view class="coreshop-font-12">即将开始:</view><u-count-down :time="item.timestamp*1000" format="DD天HH时mm分ss秒" autoStart></u-count-down>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-start coreshop-min-height-30" v-if="(item.startStatus == 2) && item.timestamp">
|
||||
<view class="coreshop-font-12">已结束:</view><u-count-down :time="item.timestamp*1000" format="DD天HH时mm分ss秒" autoStart></u-count-down>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-justify-between coreshop-flex-direction-row coreshop-align-center">
|
||||
<view class="coreshop-flex coreshop-align-center">
|
||||
<view class="coreshop-font-14 coreshop-text-red">¥{{item.price}}</view>
|
||||
<view class="coreshop-font-xs coreshop-text-through coreshop-margin-left-5">{{item.mktPrice}}元</view>
|
||||
</view>
|
||||
<view class="coreshop-groupPurchase-btn" v-if="item.startStatus == 1" @click="goGroupBuyingDetail(item.id)">立即团</view>
|
||||
<view class="coreshop-groupPurchase-btn" v-if="item.startStatus == 0">即将开始</view>
|
||||
<view class="coreshop-buy-btn-disabled" v-if="item.startStatus == 2">已结束</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="key+1 < listData.length">
|
||||
<view class="coreshop-divider">
|
||||
<view class="groupPurchase"></view>
|
||||
<view class="dot">●</view>
|
||||
<view class="groupPurchase"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopGroupPurchase",
|
||||
props: {
|
||||
coreshopData: {
|
||||
// type: Array,
|
||||
required: false,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
listData: [],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.listData = uni.$u.deepClone(this.coreshopData.parameters.list);
|
||||
},
|
||||
computed: {
|
||||
count() {
|
||||
if (!this.coreshopData) {
|
||||
return false;
|
||||
}
|
||||
if (!this.coreshopData.parameters) {
|
||||
return false;
|
||||
}
|
||||
if (!this.coreshopData.parameters.list) {
|
||||
return false;
|
||||
}
|
||||
return (this.coreshopData.parameters.list.length > 0)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
end(index) {
|
||||
let _that = this;
|
||||
_that.list.splice(index, 1)
|
||||
},
|
||||
onChange(e, key) {
|
||||
this.$set(this.listData[key], 'timeData', e)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.img-list-item { border-radius: 8px; margin: 2.5px 2.5px 10px 2.5px; background-color: #ffffff; padding: 5px; position: relative; overflow: hidden; flex-direction: row;
|
||||
.img-list-item-l { width: 100px; height: 100px; display: inline-block; float: left; }
|
||||
.img-list-item-r { width: calc(100% - 120px); display: inline-block; margin-left: 7.5px; float: left; position: relative;
|
||||
.description { font-size: 12px; color: #929292; }
|
||||
.item-c { width: 100%; margin-top: 0;
|
||||
.btnCart { float: right; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.u-count-down__text { font-size: 12px; }
|
||||
</style>
|
||||
@@ -1,49 +0,0 @@
|
||||
<template>
|
||||
<!-- 单图 -->
|
||||
<view class="coreshop-imgsingle coreshop-bg-white" v-if="listData && listData.length > 0">
|
||||
<view v-for="(child, index) in listData" :key="index">
|
||||
<view @click="taped(child)">
|
||||
<image class="ad-img" :src="child.image" mode="widthFix"></image>
|
||||
</view>
|
||||
<view class="imgup-btn" v-if="child.buttonText != ''" @click="showSliderInfo(child.linkType, child.linkValue)">
|
||||
<button class="coreshop-btn" :style="{background:child.buttonColor,color:child.textColor}">{{child.buttonText}}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopImgSingle",
|
||||
props: {
|
||||
coreshopData: {
|
||||
type: Array,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
count: 0,
|
||||
listData: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.listData = this.coreshopData;
|
||||
},
|
||||
methods: {
|
||||
taped(item) {
|
||||
this.showSliderInfo(item.linkType, item.linkValue);
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.coreshop-imgsingle { overflow: hidden; position: relative;
|
||||
.ad-img { width: 100%; float: left; }
|
||||
.ad-img:last-child { margin-bottom: 0; }
|
||||
.imgup-btn { position: absolute; z-index: 1; bottom: 10px; width: 100%; min-height: 30px; text-align: center;
|
||||
.coreshop-btn { font-size: 14px; padding: 0 25px; border-radius: 25px; height: 70rpx;line-height: 70rpx; }
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,50 +0,0 @@
|
||||
<template>
|
||||
<view class="coreshop-bg-white">
|
||||
<u-swiper :list="swiperItems" :height="swiperHeight" :interval="swiperDuration" keyName="image" @click="onClicked" indicator indicatorMode="line" circular radius="0"></u-swiper>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopImgSlide",
|
||||
props: {
|
||||
coreshopData: {
|
||||
type: Object,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
swiperItems: [],
|
||||
swiperHeight: 150,
|
||||
swiperDuration: 2500,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
count() {
|
||||
return (this.coreshopData.list.length > 0)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
var data = this.coreshopData.list;
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
let moder = {
|
||||
image: 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.height;
|
||||
this.swiperDuration = this.coreshopData.duration;
|
||||
},
|
||||
methods: {
|
||||
onClicked: function (e) {
|
||||
this.showSliderInfo(this.swiperItems[e].linkType, this.swiperItems[e].linkValue);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,55 +0,0 @@
|
||||
<template>
|
||||
<view class="coreshop-margin-left-10 coreshop-margin-right-10 coreshop-margin-bottom-10 coreshop-margin-top-10">
|
||||
<u-grid :border="false" align="left" :col="coreshopData.parameters.style" v-if="coreshopData.parameters.style == '2' ||coreshopData.parameters.style == '3' ||coreshopData.parameters.style == '4'">
|
||||
<u-grid-item bg-color="transparent" v-for="(item, index) in coreshopData.parameters.list" :key="index" :custom-style="{padding:coreshopData.parameters.margin+'px'}">
|
||||
<image :src="item.image" mode="widthFix" @click="showSliderInfo(item.linkType, item.linkValue)" style="width: 100%;"></image>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between mainWindow" v-if="coreshopData.parameters.style == '0'">
|
||||
<view class="left" :style="{paddingRight:coreshopData.parameters.margin+'px'}">
|
||||
<u--image :src="coreshopData.parameters.list[0].image" height="200px" width="100%" v-if="coreshopData.parameters.list[0]" @click="showSliderInfo(coreshopData.parameters.list[0].linkType, coreshopData.parameters.list[0].linkValue)"></u--image>
|
||||
</view>
|
||||
<view class="right" :style="{paddingLeft:coreshopData.parameters.margin+'px'}">
|
||||
<view>
|
||||
<u--image :src="coreshopData.parameters.list[1].image" height="120px" width="100%" v-if="coreshopData.parameters.list[1]" @click="showSliderInfo(coreshopData.parameters.list[1].linkType, coreshopData.parameters.list[1].linkValue)"></u--image>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between" :style="{marginTop:coreshopData.parameters.margin +'px'}">
|
||||
<view :style="{paddingRight:coreshopData.parameters.margin / 2+'px'}" class="minBox">
|
||||
<u--image :src="coreshopData.parameters.list[2].image" :height="(200-120-coreshopData.parameters.margin)+'px'" width="100%" v-if="coreshopData.parameters.list[2]" @click="showSliderInfo(coreshopData.parameters.list[2].linkType, coreshopData.parameters.list[2].linkValue)"></u--image>
|
||||
</view>
|
||||
<view :style="{paddingLeft:coreshopData.parameters.margin / 2+'px'}" class="minBox">
|
||||
<u--image :src="coreshopData.parameters.list[3].image" :height="(200-120-coreshopData.parameters.margin)+'px'" width="100%" v-if="coreshopData.parameters.list[3]" @click="showSliderInfo(coreshopData.parameters.list[3].linkType, coreshopData.parameters.list[3].linkValue)"></u--image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopImgWindow",
|
||||
props: {
|
||||
coreshopData: {
|
||||
// type: Object,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
height: 0
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.mainWindow { width: 100%; height: 200px;
|
||||
.left { width: 50%; height: 200px; }
|
||||
.right { width: 50%; height: 200px; }
|
||||
.minBox { width: 50%; }
|
||||
}
|
||||
</style>
|
||||
@@ -1,46 +0,0 @@
|
||||
<template>
|
||||
<view class="coreshop-margin-bottom-10 coreshop-padding-top-10 coreshop-padding-bottom-10 coreshop-bg-white coreshop-text-center">
|
||||
<u-grid :col="limit" :border="false">
|
||||
<u-grid-item v-for="(item, index) in ListData" :key="index" @click="showSliderInfo(item.linkType, item.linkValue)">
|
||||
<view class="coreshop-padding-bottom-10 coreshop-padding-top-10">
|
||||
<view class="coreshop-display-flex coreshop-align-center coreshop-justify-center coreshop-text-center">
|
||||
<u-image class="show coreshop-margin-auto" width="100rpx" height="100rpx" :src="item.image"></u-image>
|
||||
</view>
|
||||
<u-icon :label="item.text" :labelSize="13" labelPos="bottom" :top="25" space="10"></u-icon>
|
||||
</view>
|
||||
</u-grid-item>
|
||||
</u-grid>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopData",
|
||||
components: {},
|
||||
props: {
|
||||
coreshopData: {
|
||||
// type: Object,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
ListData: [],
|
||||
limit: 0,
|
||||
multiple: 0,
|
||||
count: 0,
|
||||
scrollPage: 1,
|
||||
scrollDot: 0,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
created() {
|
||||
this.ListData = this.coreshopData.parameters.list;
|
||||
this.limit = this.coreshopData.parameters.limit;
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,36 +0,0 @@
|
||||
<template>
|
||||
<view class="coreshop-margin-left-10 coreshop-margin-right-10 coreshop-margin-bottom-10 coreshop-margin-top-10 coreshop-bg-white" v-if="count > 0">
|
||||
<u-notice-bar :text="notcieText" url="/pages/notice/list/list" bgColor="#ffffff" color="#333333"></u-notice-bar>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopNotice",
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
coreshopData: {
|
||||
type: Array,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
notcieText: "",
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.coreshopData.length > 0) {
|
||||
for (var i = 0; i < this.coreshopData.length; i++) {
|
||||
this.notcieText += this.coreshopData[i].title + '【' + this.$u.timeFormat(this.coreshopData[i].createTime, 'yyyy年mm月dd日') + '】' + '\u00A0\u00A0\u00A0\u00A0\u00A0';
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
count() {
|
||||
return (this.coreshopData.length > 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,112 +1,39 @@
|
||||
<template>
|
||||
<view>
|
||||
<block v-for="(item,index) in coreshopdata" :key="index">
|
||||
<!--图片-->
|
||||
<coreshopImgSingle :coreshopData="item.parameters.list" v-if="item.widgetCode=='imgSingle' "></coreshopImgSingle>
|
||||
<!--服务商品-->
|
||||
<coreshopServiceGood :coreshopData="item" v-if="item.widgetCode=='service' "></coreshopServiceGood>
|
||||
<!--图片轮播-->
|
||||
<coreshopImgSlide :coreshopData="item.parameters" v-if="item.widgetCode=='imgSlide' "></coreshopImgSlide>
|
||||
<!--公告-->
|
||||
<coreshopNotice :coreshopData="item.parameters.list" v-if="item.widgetCode=='notice' "></coreshopNotice>
|
||||
<!--优惠券-->
|
||||
<coreshopCoupon :coreshopData="item" v-if="item.widgetCode=='coupon' "></coreshopCoupon>
|
||||
<!--拼团-->
|
||||
<coreshopPinTuan :coreshopData="item" v-if="item.widgetCode=='pinTuan' "></coreshopPinTuan>
|
||||
<!--搜索-->
|
||||
<coreshopSearch :coreshopData="item" v-if="item.widgetCode=='search' "></coreshopSearch>
|
||||
<!--宫格自定义导航-->
|
||||
<coreshopNavBar :coreshopData="item" v-if="item.widgetCode=='navBar' "></coreshopNavBar>
|
||||
<!--商品选项卡-->
|
||||
<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>
|
||||
<!--视频-->
|
||||
<coreshopVideo :coreshopData="item" v-if="item.widgetCode=='video' "></coreshopVideo>
|
||||
<!--商品-->
|
||||
<coreshopGoods :coreshopData="item" v-if="item.widgetCode=='goods' "></coreshopGoods>
|
||||
<!--浏览记录-->
|
||||
<coreshopRecord :coreshopData="item" v-if="item.widgetCode=='record' "></coreshopRecord>
|
||||
<!--空格-->
|
||||
<coreshopBlank :coreshopData="item" v-if="item.widgetCode=='blank' "></coreshopBlank>
|
||||
<!--多行文本输入区-->
|
||||
<coreshopTextArea :coreshopData="item" v-if="item.widgetCode=='textarea' "></coreshopTextArea>
|
||||
<!--图片集-->
|
||||
<coreshopImgWindow :coreshopData="item" v-if="item.widgetCode=='imgWindow' "></coreshopImgWindow>
|
||||
<!--文本内容-->
|
||||
<coreshopContent :coreshopData="item" v-if="item.widgetCode=='content' "></coreshopContent>
|
||||
<!--团购-->
|
||||
<coreshopGroupPurchase :coreshopData="item" v-if="item.widgetCode=='groupPurchase' "></coreshopGroupPurchase>
|
||||
<!--秒杀-->
|
||||
<coreshopSeckill :coreshopData="item" v-if="item.widgetCode=='seckill' "></coreshopSeckill>
|
||||
|
||||
|
||||
|
||||
<!--弹窗广告-->
|
||||
<coreshopadpop :coreshopdata="item" v-if="item.widgetCode=='adpop' "></coreshopadpop>
|
||||
|
||||
</block>
|
||||
</view>
|
||||
<template>
|
||||
<view class="layout-page-box page-bg" :style="props.customStyle">
|
||||
<coreshop-navbar :isBack="props.isBack" :bgColor="props.bgColor" :mode="props.mode" :title="props.title"
|
||||
:titleColor="props.titleColor" :handleCustomRouteJump="props.handleCustomRouteJump"></coreshop-navbar>
|
||||
<view class="layout-page-content"
|
||||
:style="{ 'padding-top': `${props.isShowStatusBarHeight ? statusBarHeight : 0}px`, ...props.contentStyle }">
|
||||
<slot></slot>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { useSystemInfo } from '@/core/hooks';
|
||||
// 获取自定义导航栏高度
|
||||
const { statusBarHeight } = useSystemInfo();
|
||||
|
||||
<script>
|
||||
import coreshopImgSingle from '@/components/coreshop-page/coreshop-imgSingle.vue'
|
||||
import coreshopServiceGood from '@/components/coreshop-page/coreshop-serviceGood.vue'
|
||||
import coreshopImgSlide from '@/components/coreshop-page/coreshop-imgSlide.vue'
|
||||
import coreshopNotice from '@/components/coreshop-page/coreshop-notice.vue'
|
||||
import coreshopCoupon from '@/components/coreshop-page/coreshop-coupon.vue'
|
||||
import coreshopPinTuan from '@/components/coreshop-page/coreshop-pinTuan.vue'
|
||||
import coreshopSearch from '@/components/coreshop-page/coreshop-search.vue'
|
||||
import coreshopNavBar from '@/components/coreshop-page/coreshop-navBar.vue'
|
||||
import coreshopArticle from '@/components/coreshop-page/coreshop-article.vue'
|
||||
import coreshopArticleClassify from '@/components/coreshop-page/coreshop-articleClassify.vue'
|
||||
import coreshopGoodTabBar from '@/components/coreshop-page/coreshop-goodTabBar.vue'
|
||||
import coreshopVideo from '@/components/coreshop-page/coreshop-video.vue'
|
||||
import coreshopGoods from '@/components/coreshop-page/coreshop-goods.vue'
|
||||
import coreshopRecord from '@/components/coreshop-page/coreshop-record.vue'
|
||||
import coreshopBlank from '@/components/coreshop-page/coreshop-blank.vue'
|
||||
import coreshopTextArea from '@/components/coreshop-page/coreshop-textarea.vue'
|
||||
import coreshopImgWindow from '@/components/coreshop-page/coreshop-imgWindow.vue'
|
||||
import coreshopContent from '@/components/coreshop-page/coreshop-content.vue'
|
||||
import coreshopGroupPurchase from '@/components/coreshop-page/coreshop-groupPurchase.vue'
|
||||
import coreshopSeckill from '@/components/coreshop-page/coreshop-seckill.vue'
|
||||
|
||||
import coreshopadpop from '@/components/coreshop-page/coreshop-adpop.vue'
|
||||
|
||||
export default {
|
||||
name: 'coreshop-page',
|
||||
components: {
|
||||
coreshopImgSingle,
|
||||
coreshopServiceGood,
|
||||
coreshopImgSlide,
|
||||
coreshopNotice,
|
||||
coreshopCoupon,
|
||||
coreshopPinTuan,
|
||||
coreshopSearch,
|
||||
coreshopNavBar,
|
||||
coreshopArticle,
|
||||
coreshopArticleClassify,
|
||||
coreshopGoodTabBar,
|
||||
coreshopVideo,
|
||||
coreshopGoods,
|
||||
coreshopRecord,
|
||||
coreshopBlank,
|
||||
coreshopTextArea,
|
||||
coreshopImgWindow,
|
||||
coreshopContent,
|
||||
coreshopGroupPurchase,
|
||||
coreshopSeckill,
|
||||
|
||||
coreshopadpop,
|
||||
},
|
||||
props: {
|
||||
coreshopdata: {
|
||||
default: function () {
|
||||
return []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const props = withDefaults(defineProps<{
|
||||
isBack : boolean,
|
||||
bgColor : string,
|
||||
titleColor : string,
|
||||
mode : string,
|
||||
title : string,
|
||||
isShowStatusBarHeight : boolean;
|
||||
customStyle : any;
|
||||
contentStyle : any;
|
||||
handleCustomRouteJump : () => void | null,
|
||||
}>(), {
|
||||
isBack: true,
|
||||
bgColor: '#EEF3F7',
|
||||
titleColor: '#000',
|
||||
mode: 'center',
|
||||
title: '',
|
||||
isShowStatusBarHeight: true,
|
||||
customStyle: {},
|
||||
contentStyle: {},
|
||||
handleCustomRouteJump: null,
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
@@ -1,118 +0,0 @@
|
||||
<template>
|
||||
<view class="activity-wrap coreshop-padding-10 coreshop-margin-10 coreshop-bg-white coreshop-border-radius-trbl-18" v-if="count">
|
||||
<view class="coreshop-padding-bottom-10 coreshop-padding-top-10 groupon-title coreshop-min-height-30">
|
||||
<view class="title-box coreshop-flex coreshop-justify-between">
|
||||
<view class="coreshop-font-16 coreshop-text-black coreshop-font-weight-bold">每日拼团</view>
|
||||
<u-icon name="arrow-right-double" size="12" label="查看更多" labelSize="12" labelPos="left" @tap="goPinTuanList()"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-divider">
|
||||
<view class="complete"></view>
|
||||
</view>
|
||||
<scroll-view class="scroll-box" scroll-x scroll-anchoring>
|
||||
<view class="goods-box coreshop-flex coreshop-justify-between coreshop-text-black">
|
||||
<view class="min-goods" v-for="(item, index) in coreshopData.parameters.list" :key="index" @tap="goPinTuanDetail(item.id)">
|
||||
<view class="img-box">
|
||||
<image class="img" :src="item.goodThumbnail" mode=""></image>
|
||||
</view>
|
||||
<view class="item-card-bottom coreshop-padding-10">
|
||||
<view class="goods-title u-line-1">{{ item.name }}</view>
|
||||
<view class="price coreshop-margin-bottom-5">{{item.pinTuanPrice}}</view>
|
||||
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between">
|
||||
<view class="original-price">¥{{ item.pinTuanPrice + item.discountAmount }}</view>
|
||||
<view class="coreshop-font-10">
|
||||
<u-tag :text="'限购'+item.maxNums" type="warning" plain plainFill size="mini" v-if="item.maxNums>0"></u-tag>
|
||||
<u-tag text="不限购" type="success" plain plainFill size="mini" v-if="item.maxNums==0"></u-tag>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopPinTuan",
|
||||
props: {
|
||||
coreshopData: {
|
||||
required: false,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
goodsList: [],
|
||||
swiperCurrent: 0
|
||||
};
|
||||
},
|
||||
created() {
|
||||
let that = this;
|
||||
if (that.coreshopData.parameters.list.length > 0) {
|
||||
let arr = that.sortData(that.coreshopData.parameters.list, 4);
|
||||
that.goodsList = arr;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
count() {
|
||||
return (this.coreshopData.parameters.list.length > 0)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
swiperChange(e) {
|
||||
this.swiperCurrent = e.detail.current;
|
||||
},
|
||||
// 数据分层
|
||||
sortData(oArr, length) {
|
||||
let arr = [];
|
||||
let minArr = [];
|
||||
oArr.forEach(c => {
|
||||
if (minArr.length === length) {
|
||||
minArr = [];
|
||||
}
|
||||
if (minArr.length === 0) {
|
||||
arr.push(minArr);
|
||||
}
|
||||
minArr.push(c);
|
||||
});
|
||||
return arr;
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.activity-wrap { background-color: #fff; min-height: 150px; background: linear-gradient(#faecca 20%, #ffffff 30%, #ffffff 100%);
|
||||
.groupon-title { background: url($apiFilesUrl+'/static/images/pinTuan/groupon_title_bg.png') no-repeat; background-position: center top; background-size: 100% auto; }
|
||||
.title-box {
|
||||
.title-text { font-size: 16px; font-weight: bold; color: #333333; }
|
||||
.more-box {
|
||||
.more-text { font-size: 11px; font-weight: 500; color: #333333; }
|
||||
.more-icon { font-size: 12px; color: #333333; }
|
||||
}
|
||||
}
|
||||
|
||||
.scroll-box,
|
||||
.goods-box { min-height: 190px; width: 100%; }
|
||||
}
|
||||
|
||||
// 商品卡片
|
||||
.min-goods { background: #fffaef; box-shadow: 0px 3.5px 4px 0.5px rgba(162, 117, 27, 0.24); border-radius: 5px; margin-right: 15px !important;
|
||||
.img-box { width: 140px; height: 140px; overflow: hidden; position: relative; border-radius: 5px 5px 0 0;
|
||||
.img { width: 140px; height: 140px; background-color: #ccc; }
|
||||
}
|
||||
.item-card-bottom { min-height: 75px; background: url($apiFilesUrl+'/static/images/pinTuan/groupon_goods_bg.png') no-repeat; background-position: bottom center; background-size: 100% 100%; }
|
||||
.goods-title { font-size: 13px; font-weight: 500; color: #000000; line-height: 13px; margin-bottom: 5px; }
|
||||
.price { font-size: 15px; font-weight: 500; color: #ff0000;
|
||||
&::before { content: '¥'; font-size: 12px; }
|
||||
}
|
||||
.original-price { font-size: 20rpx; font-weight: 500; text-decoration: line-through; color: #c4c4c4; }
|
||||
.groupon-num-box {
|
||||
.avatar-box { direction: rtl; unicode-bidi: bidi-override; height: 30rpx;
|
||||
.avatar-img { width: 30rpx; height: 30rpx; border-radius: 50%; background-color: #f5f5f5; }
|
||||
}
|
||||
.groupon-num-text { font-size: 18rpx; font-weight: 500; color: #e9b461; }
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,124 +0,0 @@
|
||||
<template>
|
||||
<view class="adbrathing" v-show="adbshow" v-bind:class="['adbrathing'+coreshopData.parameters.style.align,!hideanimation?'pc':hideanimation?'hc':'']" :style="{top:coreshopData.parameters.style.top+'%'}">
|
||||
<view class="adbrathing-c coreshop-flex-direction-row">
|
||||
<view class="adbrathing-l">
|
||||
<image class="user-head-img" :src="log.avatar" mode="aspectFill"></image>
|
||||
<view class="user-name">
|
||||
{{log.nickname}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="adbrathing-r">
|
||||
{{log.createTime}}{{log.desc}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopRecord",
|
||||
props: {
|
||||
coreshopData: {
|
||||
// type: Object,
|
||||
required: true,
|
||||
},
|
||||
//记录显示的位置类型
|
||||
ltype: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'home',
|
||||
},
|
||||
//记录显示的位置的值
|
||||
lvalue: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '0',
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
adbshow: false,
|
||||
hideanimation: true,
|
||||
log: {
|
||||
avatar: '/static/images/common/user_black.png',
|
||||
nickname: '',
|
||||
desc: '',
|
||||
ctime: '',
|
||||
},
|
||||
times: {},//定时器
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
//隐藏
|
||||
hideLog() {
|
||||
var _this = this;
|
||||
_this.times = setInterval(function () {
|
||||
_this.adbshow = !_this.adbshow;
|
||||
_this.hideanimation = !_this.hideanimation;
|
||||
clearInterval(_this.times);
|
||||
_this.times = setInterval(function () {
|
||||
_this.getRecord();
|
||||
}, 5000);
|
||||
}, 3000)
|
||||
},
|
||||
//获取日志
|
||||
getRecord() {
|
||||
var _this = this;
|
||||
if (_this.times != {}) {
|
||||
clearInterval(_this.times);
|
||||
}
|
||||
var data = {
|
||||
type: _this.ltype,
|
||||
value: _this.lvalue,
|
||||
};
|
||||
uni.request({
|
||||
url: this.$globalConstVars.apiBaseUrl + '/Api/Page/GetRecord',
|
||||
data: data,
|
||||
header: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: 'POST',
|
||||
success: (response) => {
|
||||
var res = response.data;
|
||||
if (res.status == true) {
|
||||
if (res.data) {
|
||||
_this.log = res.data;
|
||||
_this.adbshow = true;
|
||||
_this.hideanimation = false;
|
||||
_this.hideLog();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getRecord();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.adbrathing { position: fixed; height: 35px; background-color: rgba(0,0,0,.5); border-radius: 5px; padding: 5px; z-index: 666;
|
||||
.adbrathing-c { width: 100%; height: 100%; overflow: hidden; color: #fff; font-size: 12px;
|
||||
.adbrathing-l { display: inline-block; height: 100%; float: left; overflow: hidden;
|
||||
.user-head-img { width: 25px; height: 25px; border-radius: 50%; float: left; }
|
||||
.user-name { float: left; display: inline-block; height: 100%; line-height: 25px; margin: 0 2px 0 5px; max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
}
|
||||
.adbrathing-r { float: left; height: 100%; display: inline-block; line-height: 25px; }
|
||||
}
|
||||
}
|
||||
.pc { animation: showcenter .55s; }
|
||||
.hc { animation: hidecenter .55s; }
|
||||
|
||||
@keyframes showcenter {
|
||||
0% { opacity: 0; }
|
||||
100% { opacity: 1; }
|
||||
}
|
||||
|
||||
@keyframes hidecenter {
|
||||
0% { opacity: 1; }
|
||||
100% { opacity: 0; }
|
||||
}
|
||||
</style>
|
||||
@@ -1,48 +0,0 @@
|
||||
<template>
|
||||
<!-- 搜索组件宽度自适应于外层 -->
|
||||
<view class="coreshop-padding-left-10 coreshop-padding-right-10 coreshop-padding-bottom-10 coreshop-padding-top-10 coreshop-margin-left-10 coreshop-margin-right-10 coreshop-margin-bottom-10 coreshop-margin-top-10 coreshop-bg-white" v-bind:class="coreshopData.parameters.style">
|
||||
<u-toast ref="uToast"></u-toast>
|
||||
<u-search :placeholder="coreshopData.parameters.keywords" v-model="keyword" shape="square" :show-action="true" action-text="搜索" @custom="goSearch" @search="goSearch"></u-search>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopSearch",
|
||||
props: {
|
||||
coreshopData: {
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyword: '',
|
||||
searchTop: 0,
|
||||
scrollTop: 0,
|
||||
searchFixed: this.$store.state.searchFixed || false,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.searchStyle()
|
||||
},
|
||||
methods: {
|
||||
searchStyle() {
|
||||
this.$store.commit('searchStyle', this.coreshopData.parameters.style)
|
||||
},
|
||||
change(value) {
|
||||
// 搜索框内容变化时,会触发此事件,value值为输入框的内容
|
||||
//console.log(value);
|
||||
},
|
||||
goSearch() {
|
||||
if (this.keyword != '') {
|
||||
this.$u.route('/pages/category/list/list?key=' + this.keyword);
|
||||
} else {
|
||||
this.$refs.uToast.show({ message: '请输入查询关键字', type: 'warning', })
|
||||
}
|
||||
},
|
||||
handleScroll() {
|
||||
this.scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
|
||||
this.scrollTop >= this.searchTop ? this.searchFixed = true : this.searchFixed = false;
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -1,106 +0,0 @@
|
||||
<template>
|
||||
<view class="coreshop-padding-10 coreshop-margin-10 coreshop-bg-white coreshop-border-radius-trbl-18" v-if="listData && count">
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-min-height-30">
|
||||
<view class="coreshop-font-16 coreshop-text-black coreshop-font-weight-bold">{{coreshopData.parameters.title}}</view>
|
||||
<u-icon name="arrow-right-double" size="12" label="查看更多" labelSize="12" labelPos="left" @tap="goSeckillList()"></u-icon>
|
||||
</view>
|
||||
<view class="coreshop-divider">
|
||||
<view class="complete"></view>
|
||||
</view>
|
||||
<view class="coreshop-flex-direction coreshop-margin-bottom-10 coreshop-text-black" v-for="(item, key) in listData" :key="key">
|
||||
<view class="coreshop-flex">
|
||||
<view>
|
||||
<u--image :src="item.goodThumbnail" mode="widthFix" width="96px" height="96px" radius="8"></u--image>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-flex-direction coreshop-padding-left-10 coreshop-percent-100">
|
||||
<view class="coreshop-font-15 u-line-2 coreshop-text-black">{{ item.name }}</view>
|
||||
<view class="coreshop-font-11 coreshop-padding-top-5 coreshop-padding-bottom-3 u-line-2 coreshop-text-brown">{{ item.goodName }}</view>
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-start coreshop-min-height-30" v-if="(item.startStatus == 1) && item.timestamp">
|
||||
<view class="coreshop-font-12">仅剩:</view><u-count-down :time="item.timestamp*1000" format="DD天HH时mm分ss秒" autoStart></u-count-down>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-start coreshop-min-height-30" v-if="(item.startStatus == 0) && item.timestamp">
|
||||
<view class="coreshop-font-12">即将开始:</view><u-count-down :time="item.timestamp*1000" format="DD天HH时mm分ss秒" autoStart></u-count-down>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-start coreshop-min-height-30" v-if="(item.startStatus == 2) && item.timestamp">
|
||||
<view class="coreshop-font-12">已结束:</view><u-count-down :time="item.timestamp*1000" format="DD天HH时mm分ss秒" autoStart></u-count-down>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-justify-between coreshop-flex-direction-row coreshop-align-center">
|
||||
<view class="coreshop-flex coreshop-align-center">
|
||||
<view class="coreshop-font-14 coreshop-text-red">¥{{item.price}}</view>
|
||||
<view class="coreshop-font-xs coreshop-text-through coreshop-margin-left-5">{{item.mktPrice}}元</view>
|
||||
</view>
|
||||
<view class="coreshop-seckill-btn" v-if="item.startStatus == 1" @click="goSeckillDetail(item.id)">马上秒</view>
|
||||
<view class="coreshop-solitaire-btn" v-if="item.startStatus == 0">即将开始</view>
|
||||
<view class="coreshop-buy-btn-disabled" v-if="item.startStatus == 2">已结束</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="key+1 < listData.length">
|
||||
<view class="coreshop-divider">
|
||||
<view class="seckill"></view>
|
||||
<view class="dot">●</view>
|
||||
<view class="seckill"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopGroupPurchase",
|
||||
props: {
|
||||
coreshopData: {
|
||||
// type: Array,
|
||||
required: false,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
listData: [],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.listData = uni.$u.deepClone(this.coreshopData.parameters.list);
|
||||
},
|
||||
computed: {
|
||||
count() {
|
||||
if (!this.coreshopData) {
|
||||
return false;
|
||||
}
|
||||
if (!this.coreshopData.parameters) {
|
||||
return false;
|
||||
}
|
||||
if (!this.coreshopData.parameters.list) {
|
||||
return false;
|
||||
}
|
||||
return (this.coreshopData.parameters.list.length > 0)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
end(index) {
|
||||
let _that = this;
|
||||
_that.list.splice(index, 1)
|
||||
},
|
||||
onChange(e, key) {
|
||||
this.$set(this.listData[key], 'timeData', e)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.u-count-down__text { font-size: 12px; }
|
||||
|
||||
.img-list-item { border-radius: 8px; margin: 2.5px 2.5px 10px 2.5px; background-color: #ffffff; padding: 5px; position: relative; overflow: hidden; flex-direction: row;
|
||||
.img-list-item-l { width: 100px; height: 100px; display: inline-block; float: left; }
|
||||
.img-list-item-r { width: calc(100% - 120px); display: inline-block; margin-left: 7.5px; float: left; position: relative;
|
||||
.description { font-size: 12px; color: #929292; }
|
||||
.item-c { width: 100%; margin-top: 0;
|
||||
.btnCart { float: right; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.u-count-down__text { font-size: 12px; }
|
||||
</style>
|
||||
@@ -1,137 +0,0 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
<view class="coreshop-padding-10 coreshop-margin-10 coreshop-bg-white coreshop-border-radius-tr-24 coreshop-border-radius-bl-24" v-if="listData && count">
|
||||
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-min-height-30">
|
||||
<view class="coreshop-font-16 coreshop-text-black coreshop-font-weight-bold">{{coreshopdata.parameters.title}}</view>
|
||||
<u-icon name="arrow-right-double" size="12" label="查看更多" labelSize="12" labelPos="left" @tap="goServicesList()"></u-icon>
|
||||
</view>
|
||||
<view class="coreshop-divider">
|
||||
<view class="left"></view>
|
||||
<text class="dot">●</text>
|
||||
<view class="right"></view>
|
||||
</view>
|
||||
|
||||
<view class="img-list-item coreshop-flex-direction-row coreshop-margin-bottom-10 bg-main coreshop-text-black" v-for="(item, key) in listData" :key="key" @click="goServicesDetail(item.id)">
|
||||
<view class="img-list-item-l">
|
||||
<u--image :src="item.thumbnail" :index="item.id" width="100px" height="100px"></u--image>
|
||||
</view>
|
||||
<view class="img-list-item-r">
|
||||
<view class="coreshop-font-14 coreshop-text-bold u-line-1 title">{{item.title}}</view>
|
||||
<view class="coreshop-font-12 u-line-2 coreshop-margin-top-10 coreshop-margin-bottom-10">{{item.description}}</view>
|
||||
<view class="item-c coreshop-flex coreshop-justify-between">
|
||||
<view class="red-price coreshop-justify-between">
|
||||
¥{{item.money}}
|
||||
</view>
|
||||
<!--<u-count-down :time="item.lastTime" format="HH:mm:ss"></u-count-down>-->
|
||||
<view class="coreshop-text-right coreshop-time-right" v-if="item.openStatus == 1 && item.lastTime > 0">
|
||||
<u-count-down :time="item.lastTime*1000" :autoStart="true" format="DD天HH时mm秒ss" @change="onChange($event,key)">
|
||||
<view class="time coreshop-font-11">
|
||||
<view class="coreshop-font-12">仅剩:</view>
|
||||
<view class="time__custom">
|
||||
<text class="time__custom__item">{{ item.timeData.days }}</text>
|
||||
</view>
|
||||
<text class="time__doc">天</text>
|
||||
<view class="time__custom">
|
||||
<text class="time__custom__item">{{ item.timeData.hours>10?item.timeData.hours:'0'+item.timeData.hours}}</text>
|
||||
</view>
|
||||
<text class="time__doc">:</text>
|
||||
<view class="time__custom">
|
||||
<text class="time__custom__item">{{ item.timeData.minutes }}</text>
|
||||
</view>
|
||||
<text class="time__doc">:</text>
|
||||
<view class="time__custom">
|
||||
<text class="time__custom__item">{{ item.timeData.seconds }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</u-count-down>
|
||||
</view>
|
||||
<view class="coreshop-text-right coreshop-time-right" v-if="item.openStatus == 2 && item.lastTime > 0">
|
||||
<u-count-down :time="item.lastTime*1000" :autoStart="true" format="DD天HH时mm秒ss" @change="onChange($event,key)">
|
||||
<view class="time">
|
||||
<view class="coreshop-font-12">即将开始:</view>
|
||||
<view class="time__custom">
|
||||
<text class="time__custom__item">{{ item.timeData.days }}</text>
|
||||
</view>
|
||||
<text class="time__doc">天</text>
|
||||
<view class="time__custom">
|
||||
<text class="time__custom__item">{{ item.timeData.hours>10?item.timeData.hours:'0'+item.timeData.hours}}</text>
|
||||
</view>
|
||||
<text class="time__doc">:</text>
|
||||
<view class="time__custom">
|
||||
<text class="time__custom__item">{{ item.timeData.minutes }}</text>
|
||||
</view>
|
||||
<text class="time__doc">:</text>
|
||||
<view class="time__custom">
|
||||
<text class="time__custom__item">{{ item.timeData.seconds }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</u-count-down>
|
||||
</view>
|
||||
<view class="coreshop-font-12 red-price" v-if="item.openStatus == 3">已结束</view>
|
||||
|
||||
<!--<view class="coreshop-flex coreshop-flex-direction-row coreshop-justify-between">
|
||||
<view class="coreshop-font-12 red-price" v-if="item.status == 3">已结束</view>
|
||||
<view class="coreshop-font-12 red-price" v-if="item.status == 2">即将开始</view>
|
||||
<u-icon name="shopping-cart" color="#2979ff" size="25" class="btnCart"></u-icon>
|
||||
</view>-->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopservice",
|
||||
data() {
|
||||
return {
|
||||
listData: [],
|
||||
}
|
||||
},
|
||||
props: {
|
||||
coreshopdata: {
|
||||
// type: Array,
|
||||
required: false,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.listData = uni.$u.deepClone(this.coreshopdata.parameters.list);
|
||||
},
|
||||
computed: {
|
||||
count() {
|
||||
return (this.listData.length > 0)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onChange(e, key) {
|
||||
//this.item.timeData = uni.$u.deepClone(e);
|
||||
this.$set(this.listData[key], 'timeData', e)
|
||||
// this.$forceUpdate();
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.img-list-item { position: relative; overflow: hidden;
|
||||
.img-list-item-l { width: 100px; height: 100px; display: inline-block; float: left; }
|
||||
.img-list-item-r { width: calc(100% - 120px); display: inline-block; margin-left: 7.5px; float: left; position: relative;
|
||||
.title { line-height: 24px; }
|
||||
.item-c { width: 100%; margin-top: 0;
|
||||
.red-price { color: #FF7159 !important; }
|
||||
.btnCart { float: right; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.time { display: flex; align-items: center;
|
||||
.time__custom { min-width: 18px; height: 18px; background-color: #3c9cff; border-radius: 4px; display: flex; justify-content: center; align-items: center;
|
||||
.time__custom__item { color: #fff; font-size: 10px; text-align: center; }
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,87 +0,0 @@
|
||||
<template>
|
||||
<view class="coreshop-padding-10 coreshop-margin-10 coreshop-bg-white coreshop-border-radius-trbl-18" v-if="listData && count">
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-between coreshop-min-height-30">
|
||||
<view class="coreshop-font-16 coreshop-text-black coreshop-font-weight-bold">{{coreshopData.parameters.title}}</view>
|
||||
<u-icon name="arrow-right-double" size="12" label="查看更多" labelSize="12" labelPos="left" @tap="goServicesList()"></u-icon>
|
||||
</view>
|
||||
<view class="coreshop-divider">
|
||||
<view class="complete"></view>
|
||||
</view>
|
||||
<view class="coreshop-flex-direction-row coreshop-margin-bottom-10 coreshop-text-black" v-for="(item, key) in listData" :key="key" @click="goServicesDetail(item.id)">
|
||||
<view class="coreshop-flex">
|
||||
<view>
|
||||
<u--image :src="item.thumbnail" mode="widthFix" width="96px" height="96px" radius="8"></u--image>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-flex-direction coreshop-padding-left-10 coreshop-percent-100">
|
||||
<view class="coreshop-font-15 u-line-2 coreshop-text-black">{{ item.title }}</view>
|
||||
<view class="coreshop-font-11 coreshop-padding-top-5 coreshop-padding-bottom-3 u-line-2 coreshop-text-brown">{{ item.description }}</view>
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-padding-top-10 coreshop-padding-bottom-5">
|
||||
<view class="coreshop-font-11 coreshop-bg-orange coreshop-padding-2 coreshop-border-radius-4 coreshop-margin-right-10" v-if="item.maxBuyNumber>0">限购{{item.maxBuyNumber}}</view>
|
||||
<view class="coreshop-font-11 coreshop-bg-green coreshop-padding-2 coreshop-border-radius-4 coreshop-margin-right-10" v-if="item.maxBuyNumber==0">不限购</view>
|
||||
<view class="coreshop-font-11 coreshop-bg-olive coreshop-padding-2 coreshop-border-radius-4">{{item.ticketNumber}}张券</view>
|
||||
</view>
|
||||
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-start" v-if="item.openStatus == 1 && item.lastTime > 0">
|
||||
<view class="coreshop-font-12">仅剩:</view><u-count-down :time="item.lastTime*1000" format="DD天HH时mm分ss秒" autoStart></u-count-down>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-align-center coreshop-flex-direction-row coreshop-justify-start" v-if="item.openStatus == 2 && item.lastTime > 0">
|
||||
<view class="coreshop-font-12">即将开始:</view><u-count-down :time="item.lastTime*1000" format="DD天HH时mm分ss秒" autoStart></u-count-down>
|
||||
</view>
|
||||
|
||||
<view class="coreshop-flex coreshop-justify-between coreshop-flex-direction-row coreshop-align-center">
|
||||
<view class="coreshop-flex coreshop-align-center">
|
||||
<view class="coreshop-font-14 coreshop-text-red">¥{{ item.money }}</view>
|
||||
</view>
|
||||
<view class="coreshop-buy-btn" v-if="item.openStatus != 3">马上抢</view>
|
||||
<view class="coreshop-buy-btn-disabled" v-if="item.openStatus == 3">已结束</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="key+1 < listData.length">
|
||||
<view class="coreshop-divider">
|
||||
<view class="serviceGood"></view>
|
||||
<view class="dot">●</view>
|
||||
<view class="serviceGood"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopServiceGood",
|
||||
data() {
|
||||
return {
|
||||
listData: [],
|
||||
}
|
||||
},
|
||||
props: {
|
||||
coreshopData: {
|
||||
type: Object,
|
||||
required: false,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.listData = uni.$u.deepClone(this.coreshopData.parameters.list);
|
||||
},
|
||||
computed: {
|
||||
count() {
|
||||
return (this.listData.length > 0)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onChange(e, key) {
|
||||
this.$set(this.listData[key], 'timeData', e)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.time { display: flex; align-items: center;
|
||||
.time__custom { min-width: 18px; height: 18px; background-color: #3c9cff; border-radius: 4px; display: flex; justify-content: center; align-items: center;
|
||||
.time__custom__item { color: #fff; font-size: 10px; text-align: center; }
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,73 +0,0 @@
|
||||
<template>
|
||||
<view class="">
|
||||
<view class="coreshop-tabbar coreshop-margin-bottom-10" ref="tabBar">
|
||||
<scroll-view scroll-x='true' class="tabbar-list">
|
||||
<view class="tabbar-item" v-for="(item, index) in coreshopdata.parameters.list" :key="index" @click="showSliderInfo(item.linkType, item.linkValue)">
|
||||
{{item.text}}
|
||||
<view class="active-tabbar"></view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopTabbar",
|
||||
props: {
|
||||
coreshopdata: {
|
||||
// type: Object,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
searchTop: 0,
|
||||
scrollTop: 0,
|
||||
tabbarFixed: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.searchStyle()
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
searchStyle() {
|
||||
this.$store.commit('searchStyle', this.coreshopdata.parameters.style)
|
||||
},
|
||||
handleScroll() {
|
||||
this.scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
|
||||
this.scrollTop >= this.searchTop ? this.tabbarFixed = true : this.tabbarFixed = false;
|
||||
},
|
||||
goClassify() {
|
||||
this.$u.route({ type: 'switchTab', url: '/pages/category/index/index' });
|
||||
},
|
||||
},
|
||||
onPageScroll() {
|
||||
var _this = this;
|
||||
// #ifdef MP-WEIXIN || APP-PLUS || APP-PLUS-NVUE
|
||||
const query = uni.createSelectorQuery().in(this)
|
||||
query.select('.search').boundingClientRect(function (res) {
|
||||
if (res.top < 0) {
|
||||
_this.tabbarFixed = true;
|
||||
} else {
|
||||
_this.tabbarFixed = false;
|
||||
}
|
||||
}).exec()
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tabbar-list { padding: 5px 0; background-color: #fff; white-space: nowrap; width: 100%;
|
||||
.tabbar-item { display: inline-block; padding: 5px 10px;
|
||||
.active-tabbar { display: none; }
|
||||
}
|
||||
}
|
||||
.tabbar-item:first-of-type { color: #FF7159;
|
||||
.active-tabbar { display: block; width: 100%; height: 2px; margin: 5px auto 0; background-color: #FF7159; }
|
||||
}
|
||||
.tabbar-fixed { position: fixed; top: 52px; transition: all .5s; z-index: 999; background-color: #fff; width: 100%; }
|
||||
</style>
|
||||
@@ -1,31 +0,0 @@
|
||||
<template>
|
||||
<view class="textarea coreshop-margin-10 coreshop-padding-10">
|
||||
<coreshopContent :content="coreshopData.parameters.value" v-if="coreshopData.parameters.value"></coreshopContent>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import coreshopContent from '@/components/coreshop-page/coreshop-content.vue'//视频和文本解析组件
|
||||
export default {
|
||||
components: {
|
||||
coreshopContent
|
||||
},
|
||||
name: "coreshopTextArea",
|
||||
props: {
|
||||
coreshopData: {
|
||||
// type: Object,
|
||||
required: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.textarea { background-color: #fff;
|
||||
p {
|
||||
img { width: 100% !important; background-color: #000; }
|
||||
}
|
||||
div { background-color: #000; }
|
||||
}
|
||||
.clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
||||
</style>
|
||||
@@ -1,42 +0,0 @@
|
||||
<template>
|
||||
<view class="video coreshop-margin-left-10 coreshop-margin-right-10 coreshop-margin-bottom-10">
|
||||
<video class="videoCT" id="myVideo" :src="coreshopData.parameters.list[0].url" :autoplay="autoplay" :poster="coreshopData.parameters.list[0].image"></video>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "coreshopVideo",
|
||||
props: {
|
||||
coreshopData: {
|
||||
type: Object,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
autoplay: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.coreshopData.parameters.autoplay == 'true' || this.coreshopData.parameters.autoplay == true) {
|
||||
this.autoplay = true;
|
||||
}
|
||||
|
||||
},
|
||||
onReady: function (res) {
|
||||
// #ifndef MP-ALIPAY
|
||||
this.videoContext = uni.createVideoContext('myVideo')
|
||||
// #endif
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.video { border-radius: 8px;
|
||||
.videoCT { width: 100%; min-height: 100px; }
|
||||
}
|
||||
</style>
|
||||
@@ -1,134 +0,0 @@
|
||||
<template>
|
||||
<view class="coreshop-section">
|
||||
<view class="coreshop-section__title" :style="{
|
||||
fontWeight: bold ? 'bold' : 'normal',
|
||||
color: color,
|
||||
fontSize: fontSize + 'px',
|
||||
paddingLeft: showLine ? (fontSize * 0.7) + 'px' : 0
|
||||
}" :class="{
|
||||
'coreshop-section--line': showLine
|
||||
}">
|
||||
<view class="coreshop-section__title__icon-wrap coreshop-flex" :style="[lineStyle]" v-if="showLine">
|
||||
<u-icon top="0" name="column-line" :size="fontSize * 1.25" bold :color="lineColor ? lineColor : color"></u-icon>
|
||||
</view>
|
||||
<text class="coreshop-flex coreshop-section__title__text">{{title}}</text>
|
||||
</view>
|
||||
<view class="coreshop-section__right-info" v-if="right || $slots.right" :style="{
|
||||
color: subColor
|
||||
}" @tap="rightClick">
|
||||
<slot name="right" v-if="$slots.right" />
|
||||
<block v-else>
|
||||
{{subTitle}}
|
||||
<view class="coreshop-section__right-info__icon-arrow u-flex" v-if="arrow">
|
||||
<u-icon name="arrow-right" size="14" :color="subColor"></u-icon>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* section 查看更多
|
||||
* @description 该组件一般用于分类信息有很多,但是限于篇幅只能列出一部分,让用户通过"查看更多"获得更多信息的场景,实际效果见演示。
|
||||
* @tutorial https://www.uviewui.com/components/section.html
|
||||
* @property {String} title 左边主标题
|
||||
* @property {String} sub-title 右边副标题(默认更多)
|
||||
* @property {Boolean} right 是否显示右边的内容(默认true)
|
||||
* @property {Boolean} showLine 是否显示左边的竖条(默认true)
|
||||
* @property {Boolean} arrow 是否显示右边箭头(默认true)
|
||||
* @property {String Number} font-size 主标题的字体大小(默认28)
|
||||
* @property {Boolean} bold 主标题是否加粗(默认true)
|
||||
* @property {String} color 主标题颜色(默认#303133)
|
||||
* @event {Function} click 组件右侧的内容被点击时触发,用于跳转"更多"
|
||||
* @example <coreshop-section title="今日热门" :right="false"></coreshop-section>
|
||||
*/
|
||||
export default {
|
||||
name: "coreshop-section",
|
||||
props: {
|
||||
// 标题信息
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 右边副标题内容
|
||||
subTitle: {
|
||||
type: String,
|
||||
default: '更多'
|
||||
},
|
||||
// 是否显示右边的内容
|
||||
right: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
fontSize: {
|
||||
type: [Number, String],
|
||||
default: 28
|
||||
},
|
||||
// 主标题是否加粗
|
||||
bold: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 主标题的颜色
|
||||
color: {
|
||||
type: String,
|
||||
default: '#303133'
|
||||
},
|
||||
// 右边副标题的颜色
|
||||
subColor: {
|
||||
type: String,
|
||||
default: '#909399'
|
||||
},
|
||||
// 是否显示左边的竖条
|
||||
showLine: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 左边竖线的颜色
|
||||
lineColor: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 是否显示右边箭头
|
||||
arrow: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
// 左边竖条的样式
|
||||
lineStyle() {
|
||||
// 由于安卓和iOS的,需要稍微调整绝对定位的top值,才能让左边的竖线和右边的文字垂直居中
|
||||
return {
|
||||
// 由于竖线为字体图标,具有比实际线宽更宽的宽度,所以也需要根据字体打下动态调整
|
||||
left: -(Number(this.fontSize) * 0.9) / 2 + 'px',
|
||||
top: -(Number(this.fontSize) * (this.$u.os() == 'ios' ? 0.14 : 0.15)) / 2 + 'px',
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
rightClick() {
|
||||
this.$emit('click');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.coreshop-section { /* #ifndef APP-NVUE */ display: flex; flex-direction: row; /* #endif */ justify-content: space-between; align-items: center; width: 100%;
|
||||
|
||||
&__title { position: relative; font-size: 14px; padding-left: 10px; /* #ifndef APP-NVUE */ display: flex; flex-direction: row; /* #endif */ align-items: center;
|
||||
|
||||
&__icon-wrap { position: absolute; }
|
||||
|
||||
&__text { line-height: 1; }
|
||||
}
|
||||
|
||||
&__right-info { color: $u-tips-color; font-size: 13px; /* #ifndef APP-NVUE */ display: flex; flex-direction: row; /* #endif */ align-items: center;
|
||||
|
||||
&__icon-arrow { margin-left: 3px; }
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,123 @@
|
||||
<template>
|
||||
<uv-picker ref="cityPicker" :columns="addressList" keyName="label" @change="change" @confirm="confirm" @close="close"> </uv-picker>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { watch, watchEffect, reactive, ref, computed, onMounted } from 'vue';
|
||||
import { Response, CityAddressType } from '@/core/models';
|
||||
import { queryAreas } from '@/core/api';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
show : boolean,
|
||||
cityList : Array<CityAddressType>,
|
||||
pickerValue : string,
|
||||
}>(), {
|
||||
show: false,
|
||||
cityList: () => [],
|
||||
pickerValue: '',
|
||||
});
|
||||
|
||||
const emit = defineEmits(['handleClosePicker', 'handleConfirmPicker']);
|
||||
|
||||
const cityPicker = ref();
|
||||
|
||||
const state = reactive<{
|
||||
provinces : Array<any>,
|
||||
citys : Array<any>,
|
||||
areas : Array<any>,
|
||||
cityList : Array<CityAddressType>,
|
||||
cityVal : Array<number>;
|
||||
}>({
|
||||
provinces: [], //省
|
||||
citys: [], //市
|
||||
areas: [], //区
|
||||
cityList: [],
|
||||
cityVal: [],
|
||||
})
|
||||
|
||||
const addressList = computed(() => {
|
||||
return [state.provinces, state.citys, state.areas];
|
||||
})
|
||||
|
||||
watch(() => props.show, (newVal : boolean) => {
|
||||
if (newVal) {
|
||||
cityPicker.value.open();
|
||||
if (props.pickerValue) {
|
||||
cityPicker.value.setIndexs(state.cityVal, true)
|
||||
}
|
||||
} else {
|
||||
cityPicker.value.close();
|
||||
}
|
||||
})
|
||||
|
||||
watchEffect(() => {
|
||||
if (props.pickerValue && state.cityList.length > 0) {
|
||||
|
||||
const cityName = props.pickerValue.split(' ');
|
||||
|
||||
let provincesIndex : number = state.cityList.findIndex(((item : CityAddressType) => item.label === cityName[0]));
|
||||
|
||||
let citysIndex : number = state.cityList[provincesIndex].children.findIndex((item : CityAddressType) => item.label === cityName[1])
|
||||
|
||||
let areasIndex : number = state.cityList[provincesIndex].children[citysIndex].children.findIndex((item : CityAddressType) => item.label === cityName[2])
|
||||
|
||||
state.cityVal = [provincesIndex, citysIndex, areasIndex];
|
||||
}
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
getAreas();
|
||||
})
|
||||
|
||||
/** 获取城市列表 */
|
||||
const getAreas = async () => {
|
||||
const address : Response<Array<CityAddressType>> = await queryAreas();
|
||||
if (address.status) {
|
||||
state.cityList = address.data;
|
||||
/** 省 */
|
||||
state.provinces = address.data.map((item : CityAddressType) => {
|
||||
return {
|
||||
label: item.label,
|
||||
value: item.value,
|
||||
children: item.children,
|
||||
}
|
||||
});
|
||||
/** 市 */
|
||||
state.citys = address.data[0].children.map((item) => {
|
||||
return {
|
||||
label: item.label,
|
||||
value: item.value,
|
||||
children: item.children,
|
||||
}
|
||||
})
|
||||
/** 区 */
|
||||
state.areas = address.data[0].children[0].children.map((item) => {
|
||||
return {
|
||||
label: item.label,
|
||||
value: item.value,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const change = (e : any) => {
|
||||
const { columnIndex, index, indexs } = e;
|
||||
if (columnIndex === 0) {
|
||||
state.citys = state.provinces[index]?.children || [];
|
||||
state.areas = state.citys[0]?.children || [];
|
||||
cityPicker.value.setIndexs([index, 0, 0], true);
|
||||
} else if (columnIndex === 1) {
|
||||
state.areas = state.citys[index]?.children || [];
|
||||
cityPicker.value.setIndexs(indexs, true)
|
||||
}
|
||||
}
|
||||
|
||||
const confirm = (e : any) => {
|
||||
emit('handleClosePicker')
|
||||
emit('handleConfirmPicker', e.value)
|
||||
}
|
||||
|
||||
const close = () => {
|
||||
emit('handleClosePicker')
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -1,360 +0,0 @@
|
||||
<template>
|
||||
<view class="u-select">
|
||||
<u-popup :maskCloseAble="maskCloseAble" mode="bottom" :show="value" :safeAreaInsetBottom="safeAreaInsetBottom" @close="close" :zIndex="uZIndex">
|
||||
<view class="u-select">
|
||||
<view class="u-select__header" @touchmove.stop.prevent="">
|
||||
<view class="u-select__header__cancel u-select__header__btn"
|
||||
:style="{ color: cancelColor }"
|
||||
hover-class="u-hover-class"
|
||||
:hover-stay-time="150"
|
||||
@tap="getResult('cancel')">
|
||||
{{cancelText}}
|
||||
</view>
|
||||
<view class="u-select__header__title">
|
||||
{{title}}
|
||||
</view>
|
||||
<view class="u-select__header__confirm u-select__header__btn"
|
||||
:style="{ color: moving ? cancelColor : confirmColor }"
|
||||
hover-class="u-hover-class"
|
||||
:hover-stay-time="150"
|
||||
@touchmove.stop=""
|
||||
@tap.stop="getResult('confirm')">
|
||||
{{confirmText}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-select__body">
|
||||
<picker-view @change="columnChange" class="u-select__body__picker-view" :value="defaultSelector" @pickstart="pickstart" @pickend="pickend">
|
||||
<picker-view-column v-for="(item, index) in columnData" :key="index">
|
||||
<view class="u-select__body__picker-view__item" v-for="(item1, index1) in item" :key="index1">
|
||||
<view class="u-line-1">{{ item1[labelName] }}</view>
|
||||
</view>
|
||||
</picker-view-column>
|
||||
</picker-view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* select 列选择器
|
||||
* @description 此选择器用于单列,多列,多列联动的选择场景。(从1.3.0版本起,不建议使用Picker组件的单列和多列模式,Select组件是专门为列选择而构造的组件,更简单易用。)
|
||||
* @tutorial http://uviewui.com/components/select.html
|
||||
* @property {String} mode 模式选择,"single-column"-单列模式,"mutil-column"-多列模式,"mutil-column-auto"-多列联动模式
|
||||
* @property {Array} list 列数据,数组形式,见官网说明
|
||||
* @property {Boolean} v-model 布尔值变量,用于控制选择器的弹出与收起
|
||||
* @property {Boolean} safe-area-inset-bottom 是否开启底部安全区适配(默认false)
|
||||
* @property {String} cancel-color 取消按钮的颜色(默认#606266)
|
||||
* @property {String} confirm-color 确认按钮的颜色(默认#2979ff)
|
||||
* @property {String} confirm-text 确认按钮的文字
|
||||
* @property {String} cancel-text 取消按钮的文字
|
||||
* @property {String} default-value 提供的默认选中的下标,见官网说明
|
||||
* @property {Boolean} mask-close-able 是否允许通过点击遮罩关闭Picker(默认true)
|
||||
* @property {String Number} z-index 弹出时的z-index值(默认10075)
|
||||
* @property {String} value-name 自定义list数据的value属性名 1.3.6
|
||||
* @property {String} label-name 自定义list数据的label属性名 1.3.6
|
||||
* @property {String} child-name 自定义list数据的children属性名,只对多列联动模式有效 1.3.7
|
||||
* @event {Function} confirm 点击确定按钮,返回当前选择的值
|
||||
* @example <u-select v-model="show" :list="list"></u-select>
|
||||
*/
|
||||
|
||||
export default {
|
||||
props: {
|
||||
// 列数据
|
||||
list: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
// 是否显示边框
|
||||
border: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 通过双向绑定控制组件的弹出与收起
|
||||
value: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// "取消"按钮的颜色
|
||||
cancelColor: {
|
||||
type: String,
|
||||
default: '#606266'
|
||||
},
|
||||
// "确定"按钮的颜色
|
||||
confirmColor: {
|
||||
type: String,
|
||||
default: '#2979ff'
|
||||
},
|
||||
// 弹出的z-index值
|
||||
zIndex: {
|
||||
type: [String, Number],
|
||||
default: 0
|
||||
},
|
||||
safeAreaInsetBottom: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 是否允许通过点击遮罩关闭Picker
|
||||
maskCloseAble: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 提供的默认选中的下标
|
||||
defaultValue: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [0];
|
||||
}
|
||||
},
|
||||
// 模式选择,single-column-单列,mutil-column-多列,mutil-column-auto-多列联动
|
||||
mode: {
|
||||
type: String,
|
||||
default: 'single-column'
|
||||
},
|
||||
// 自定义value属性名
|
||||
valueName: {
|
||||
type: String,
|
||||
default: 'value'
|
||||
},
|
||||
// 自定义label属性名
|
||||
labelName: {
|
||||
type: String,
|
||||
default: 'label'
|
||||
},
|
||||
// 自定义多列联动模式的children属性名
|
||||
childName: {
|
||||
type: String,
|
||||
default: 'children'
|
||||
},
|
||||
// 顶部标题
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 取消按钮的文字
|
||||
cancelText: {
|
||||
type: String,
|
||||
default: '取消'
|
||||
},
|
||||
// 确认按钮的文字
|
||||
confirmText: {
|
||||
type: String,
|
||||
default: '确认'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 用于列改变时,保存当前的索引,下一次变化时比较得出是哪一列发生了变化
|
||||
defaultSelector: [0],
|
||||
// picker-view的数据
|
||||
columnData: [],
|
||||
// 每次队列发生变化时,保存选择的结果
|
||||
selectValue: [],
|
||||
// 上一次列变化时的index
|
||||
lastSelectIndex: [],
|
||||
// 列数
|
||||
columnNum: 0,
|
||||
// 列是否还在滑动中,微信小程序如果在滑动中就点确定,结果可能不准确
|
||||
moving: false
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
// 在select弹起的时候,重新初始化所有数据
|
||||
value: {
|
||||
immediate: true,
|
||||
handler(val) {
|
||||
if (val) setTimeout(() => this.init(), 10);
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
uZIndex() {
|
||||
// 如果用户有传递z-index值,优先使用
|
||||
return this.zIndex ? this.zIndex : this.$u.zIndex.popup;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 标识滑动开始,只有微信小程序才有这样的事件
|
||||
pickstart() {
|
||||
// #ifdef MP-WEIXIN
|
||||
this.moving = true;
|
||||
// #endif
|
||||
},
|
||||
// 标识滑动结束
|
||||
pickend() {
|
||||
// #ifdef MP-WEIXIN
|
||||
this.moving = false;
|
||||
// #endif
|
||||
},
|
||||
init() {
|
||||
this.setColumnNum();
|
||||
this.setDefaultSelector();
|
||||
this.setColumnData();
|
||||
this.setSelectValue();
|
||||
},
|
||||
// 获取默认选中列下标
|
||||
setDefaultSelector() {
|
||||
// 如果没有传入默认选中的值,生成长度为columnNum,用0填充的数组
|
||||
this.defaultSelector = this.defaultValue.length == this.columnNum ? this.defaultValue : Array(this.columnNum).fill(0);
|
||||
this.lastSelectIndex = this.$u.deepClone(this.defaultSelector);
|
||||
},
|
||||
// 计算列数
|
||||
setColumnNum() {
|
||||
// 单列的列数为1
|
||||
if (this.mode == 'single-column') this.columnNum = 1;
|
||||
// 多列时,this.list数组长度就是列数
|
||||
else if (this.mode == 'mutil-column') this.columnNum = this.list.length;
|
||||
// 多列联动时,通过历遍this.list的第一个元素,得出有多少列
|
||||
else if (this.mode == 'mutil-column-auto') {
|
||||
let num = 1;
|
||||
let column = this.list;
|
||||
// 只要有元素并且第一个元素有children属性,继续历遍
|
||||
while (column[0][this.childName]) {
|
||||
column = column[0] ? column[0][this.childName] : {};
|
||||
num++;
|
||||
}
|
||||
this.columnNum = num;
|
||||
}
|
||||
},
|
||||
// 获取需要展示在picker中的列数据
|
||||
setColumnData() {
|
||||
let data = [];
|
||||
this.selectValue = [];
|
||||
if (this.mode == 'mutil-column-auto') {
|
||||
// 获得所有数据中的第一个元素
|
||||
let column = this.list[this.defaultSelector.length ? this.defaultSelector[0] : 0];
|
||||
// 通过循环所有的列数,再根据设定列的数组,得出当前需要渲染的整个列数组
|
||||
for (let i = 0; i < this.columnNum; i++) {
|
||||
// 第一列默认为整个list数组
|
||||
if (i == 0) {
|
||||
data[i] = this.list;
|
||||
column = column[this.childName];
|
||||
} else {
|
||||
// 大于第一列时,判断是否有默认选中的,如果没有就用该列的第一项
|
||||
data[i] = column;
|
||||
column = column[this.defaultSelector[i]][this.childName];
|
||||
}
|
||||
}
|
||||
} else if (this.mode == 'single-column') {
|
||||
data[0] = this.list;
|
||||
} else {
|
||||
data = this.list;
|
||||
}
|
||||
this.columnData = data;
|
||||
},
|
||||
// 获取默认选中的值,如果没有设置defaultValue,就默认选中每列的第一个
|
||||
setSelectValue() {
|
||||
let tmp = null;
|
||||
for (let i = 0; i < this.columnNum; i++) {
|
||||
tmp = this.columnData[i][this.defaultSelector[i]];
|
||||
let data = {
|
||||
value: tmp ? tmp[this.valueName] : null,
|
||||
label: tmp ? tmp[this.labelName] : null
|
||||
};
|
||||
// 判断是否存在额外的参数,如果存在,就返回
|
||||
if (tmp && tmp.extra) data.extra = tmp.extra;
|
||||
this.selectValue.push(data)
|
||||
}
|
||||
},
|
||||
// 列选项
|
||||
columnChange(e) {
|
||||
let index = null;
|
||||
let columnIndex = e.detail.value;
|
||||
// 由于后面是需要push进数组的,所以需要先清空数组
|
||||
this.selectValue = [];
|
||||
if (this.mode == 'mutil-column-auto') {
|
||||
// 对比前后两个数组,寻找变更的是哪一列,如果某一个元素不同,即可判定该列发生了变化
|
||||
this.lastSelectIndex.map((val, idx) => {
|
||||
if (val != columnIndex[idx]) index = idx;
|
||||
});
|
||||
this.defaultSelector = columnIndex;
|
||||
for (let i = index + 1; i < this.columnNum; i++) {
|
||||
// 当前变化列的下一列的数据,需要获取上一列的数据,同时需要指定是上一列的第几个的children,再往后的
|
||||
// 默认是队列的第一个为默认选项
|
||||
this.columnData[i] = this.columnData[i - 1][i - 1 == index ? columnIndex[index] : 0][this.childName];
|
||||
// 改变的列之后的所有列,默认选中第一个
|
||||
this.defaultSelector[i] = 0;
|
||||
}
|
||||
// 在历遍的过程中,可能由于上一步修改this.columnData,导致产生连锁反应,程序触发columnChange,会有多次调用
|
||||
// 只有在最后一次数据稳定后的结果是正确的,此前的历遍中,可能会产生undefined,故需要判断
|
||||
columnIndex.map((item, index) => {
|
||||
let data = this.columnData[index][columnIndex[index]];
|
||||
let tmp = {
|
||||
value: data ? data[this.valueName] : null,
|
||||
label: data ? data[this.labelName] : null,
|
||||
};
|
||||
// 判断是否有需要额外携带的参数
|
||||
if (data && data.extra !== undefined) tmp.extra = data.extra;
|
||||
this.selectValue.push(tmp);
|
||||
|
||||
})
|
||||
// 保存这一次的结果,用于下次列发生变化时作比较
|
||||
this.lastSelectIndex = columnIndex;
|
||||
} else if (this.mode == 'single-column') {
|
||||
let data = this.columnData[0][columnIndex[0]];
|
||||
// 初始默认选中值
|
||||
let tmp = {
|
||||
value: data ? data[this.valueName] : null,
|
||||
label: data ? data[this.labelName] : null,
|
||||
};
|
||||
// 判断是否有需要额外携带的参数
|
||||
if (data && data.extra !== undefined) tmp.extra = data.extra;
|
||||
this.selectValue.push(tmp);
|
||||
} else if (this.mode == 'mutil-column') {
|
||||
// 初始默认选中值
|
||||
columnIndex.map((item, index) => {
|
||||
let data = this.columnData[index][columnIndex[index]];
|
||||
// 初始默认选中值
|
||||
let tmp = {
|
||||
value: data ? data[this.valueName] : null,
|
||||
label: data ? data[this.labelName] : null,
|
||||
};
|
||||
// 判断是否有需要额外携带的参数
|
||||
if (data && data.extra !== undefined) tmp.extra = data.extra;
|
||||
this.selectValue.push(tmp);
|
||||
})
|
||||
}
|
||||
},
|
||||
close() {
|
||||
this.$emit('input', false);
|
||||
},
|
||||
// 点击确定或者取消
|
||||
getResult(event = null) {
|
||||
// #ifdef MP-WEIXIN
|
||||
if (this.moving) return;
|
||||
// #endif
|
||||
if (event) this.$emit(event, this.selectValue);
|
||||
this.close();
|
||||
},
|
||||
selectHandler() {
|
||||
this.$emit('click');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.u-select {
|
||||
&__action { position: relative; line-height: $u-form-item-height; height: $u-form-item-height;
|
||||
&__icon { position: absolute; right: 20rpx; top: 50%; transition: transform .4s; transform: translateY(-50%); z-index: 1;
|
||||
|
||||
&--reverse { transform: rotate(-180deg) translateY(50%); }
|
||||
}
|
||||
}
|
||||
|
||||
&__hader {
|
||||
&__title { color: $u-content-color; }
|
||||
}
|
||||
|
||||
&--border { border-radius: 6rpx; border-radius: 4px; border: 1px solid $u-form-item-border-color; }
|
||||
&__header { display: flex; align-items: center; justify-content: space-between; height: 80rpx; padding: 0 40rpx; }
|
||||
&__body { width: 100%; height: 500rpx; overflow: hidden; background-color: #fff;
|
||||
&__picker-view { height: 100%; box-sizing: border-box;
|
||||
&__item { display: flex; align-items: center; justify-content: center; font-size: 32rpx; color: $u-main-color; padding: 0 8rpx; }
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,264 +0,0 @@
|
||||
<template>
|
||||
<view class="coreshop-share-Box">
|
||||
<u-toast ref="uToast" />
|
||||
<view class="coreshop-share-pop">
|
||||
<view class="coreshop-share-item"
|
||||
v-for="(item, index) in providerList"
|
||||
:key="index"
|
||||
@click="clickHandler(item)">
|
||||
<image :src="item.img" mode=""></image>
|
||||
<view class="">{{ item.name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-bottomBox">
|
||||
<button class="coreshop-btn coreshop-btn-w coreshop-btn-square" @click="close()">关闭</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
// 商品id
|
||||
goodsId: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
// 分享的图片
|
||||
shareImg: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 分享标题
|
||||
shareTitle: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 分享内容
|
||||
shareContent: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 分享链接
|
||||
shareHref: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
//分享类型
|
||||
shareType: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
//拼团id
|
||||
groupId: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
//拼团的团队id
|
||||
teamId: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
providerList: [] // 分享通道 包含生成海报
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
/**
|
||||
*
|
||||
* H5+ 获取分享通道
|
||||
*
|
||||
*/
|
||||
uni.getProvider({
|
||||
service: 'share',
|
||||
success: (e) => {
|
||||
let data = []
|
||||
for (let i = 0; i < e.provider.length; i++) {
|
||||
switch (e.provider[i]) {
|
||||
case 'weixin':
|
||||
data.push({
|
||||
name: '分享到微信好友',
|
||||
cate: 'share',
|
||||
id: 'weixin',
|
||||
img: '/static/images/common/share-wechat.png',
|
||||
sort: 0
|
||||
})
|
||||
data.push({
|
||||
name: '分享到微信朋友圈',
|
||||
cate: 'share',
|
||||
id: 'weixin',
|
||||
type: 'WXSenceTimeline',
|
||||
img: '/static/images/common/share--wechat-friends.png',
|
||||
sort: 1
|
||||
})
|
||||
break;
|
||||
case 'qq':
|
||||
data.push({
|
||||
name: '分享到QQ',
|
||||
cate: 'share',
|
||||
id: 'qq',
|
||||
img: '/static/images/common/share-qq.png',
|
||||
sort: 3
|
||||
})
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
data.push({
|
||||
name: '生成海报',
|
||||
cate: 'poster',
|
||||
id: 'poster',
|
||||
img: '/static/images/common/share-poster.png',
|
||||
sort: 5
|
||||
})
|
||||
this.providerList = data.sort((x, y) => {
|
||||
return x.sort - y.sort
|
||||
});
|
||||
},
|
||||
fail: (e) => {
|
||||
// console.log('获取分享通道失败', e)
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
// 关闭弹出层
|
||||
close() {
|
||||
this.$emit('close')
|
||||
},
|
||||
// 点击操作
|
||||
clickHandler(e) {
|
||||
if (e.cate === 'poster') {
|
||||
this.createPoster()
|
||||
} else {
|
||||
// 去分享
|
||||
this.share(e)
|
||||
}
|
||||
},
|
||||
// 生成海报
|
||||
createPoster() {
|
||||
let data = {};
|
||||
if (this.shareType == 1) {
|
||||
//商品
|
||||
data = {
|
||||
page: 2, //商品
|
||||
url: this.$globalConstVars.shareUrl,
|
||||
params: {
|
||||
goodsId: this.goodsId
|
||||
},
|
||||
type: 3,//海报
|
||||
client: 2
|
||||
}
|
||||
let userToken = this.$db.get('userToken')
|
||||
if (userToken) {
|
||||
data.token = userToken
|
||||
}
|
||||
} else if (this.shareType == 3) {
|
||||
//拼团
|
||||
data = {
|
||||
page: 3, //商品
|
||||
url: this.$globalConstVars.shareUrl,
|
||||
params: {
|
||||
goodsId: this.goodsId,
|
||||
groupId: this.groupId,
|
||||
teamId: this.teamId
|
||||
},
|
||||
type: 3,//海报
|
||||
client: 2
|
||||
}
|
||||
let userToken = this.$db.get('userToken')
|
||||
if (userToken) {
|
||||
data.token = userToken
|
||||
}
|
||||
}
|
||||
this.$u.api.share(data).then(res => {
|
||||
if (res.status) {
|
||||
this.close()
|
||||
this.$u.route('/pages/share/sharePoster/sharePoster?poster=' + encodeURIComponent(res.data))
|
||||
} else {
|
||||
this.$u.toast(res.msg)
|
||||
}
|
||||
});
|
||||
},
|
||||
// 分享操作
|
||||
async share(e) {
|
||||
let shareOPtions = {
|
||||
provider: e.id,
|
||||
scene: e.type && e.type === 'WXSenceTimeline' ? 'WXSenceTimeline' : 'WXSceneSession', //WXSceneSession”分享到聊天界面,“WXSenceTimeline”分享到朋友圈,“WXSceneFavorite”分享到微信收藏
|
||||
type: this.shareType,
|
||||
success: (e) => {
|
||||
uni.showModal({
|
||||
content: '分享成功',
|
||||
showCancel: false
|
||||
})
|
||||
},
|
||||
fail: (e) => {
|
||||
uni.showModal({
|
||||
content: e.errMsg,
|
||||
showCancel: false
|
||||
})
|
||||
},
|
||||
complete: function () {
|
||||
// console.log('分享操作结束!')
|
||||
}
|
||||
}
|
||||
shareOPtions.summary = this.shareContent ? this.shareContent : ''
|
||||
shareOPtions.imageUrl = this.shareImg ? this.shareImg : ''
|
||||
shareOPtions.title = this.shareTitle ? this.shareTitle : ''
|
||||
shareOPtions.href = this.shareHref ? this.shareHref : ''
|
||||
|
||||
if (shareOPtions.type === 0 && plus.os.name === 'iOS') {//如果是图文分享,且是ios平台,则压缩图片
|
||||
shareOPtions.imageUrl = await this.compress()
|
||||
}
|
||||
if (shareOPtions.type === 1 && shareOPtions.provider === 'qq') {//如果是分享文字到qq,则必须加上href和title
|
||||
shareOPtions.href = this.shareHref
|
||||
shareOPtions.title = this.shareTitle
|
||||
}
|
||||
uni.share(shareOPtions);
|
||||
},
|
||||
// 压缩图片 图文分享要求分享图片大小不能超过20Kb
|
||||
compress() {
|
||||
// console.log('开始压缩');
|
||||
let img = this.shareImg;
|
||||
return new Promise((res) => {
|
||||
var localPath = plus.io.convertAbsoluteFileSystem(img.replace('file://', ''));
|
||||
// console.log('after' + localPath);
|
||||
// 压缩size
|
||||
plus.io.resolveLocalFileSystemURL(localPath, (entry) => {
|
||||
entry.file((file) => {// 可通过entry对象操作图片
|
||||
// console.log('getFile:' + JSON.stringify(file));
|
||||
if (file.size > 20480) {// 压缩后size 大于20Kb
|
||||
plus.zip.compressImage({
|
||||
src: img,
|
||||
dst: img.replace('.jpg', '2222.jpg').replace('.JPG', '2222.JPG'),
|
||||
width: '10%',
|
||||
height: '10%',
|
||||
quality: 1,
|
||||
overwrite: true
|
||||
}, (event) => {
|
||||
// console.log('success zip****' + event.size);
|
||||
let newImg = img.replace('.jpg', '2222.jpg').replace('.JPG', '2222.JPG');
|
||||
res(newImg);
|
||||
}, function (error) {
|
||||
uni.showModal({
|
||||
content: '分享图片太大,需要请重新选择图片!',
|
||||
showCancel: false
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
}, (e) => {
|
||||
// console.log('Resolve file URL failed: ' + e.message);
|
||||
uni.showModal({
|
||||
content: '分享图片太大,需要请重新选择图片!',
|
||||
showCancel: false
|
||||
})
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,241 +0,0 @@
|
||||
<template>
|
||||
<view class="coreshop-share-Box">
|
||||
<u-toast ref="uToast" />
|
||||
<view class="coreshop-share-pop">
|
||||
<view class="coreshop-share-item">
|
||||
<button class="coreshop-btn" open-type="share">
|
||||
<u-icon label="分享微信好友" labelPos="bottom" size="40" name="/static/images/common/share-friend.png"></u-icon>
|
||||
</button>
|
||||
</view>
|
||||
<view class="coreshop-share-item">
|
||||
<button class="coreshop-btn" @click="$u.throttle(createPoster, 500)">
|
||||
<u-icon label="生成海报" labelPos="bottom" size="40" name="/static/images/common/share-poster.png"></u-icon>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="coreshop-share-bottomBox">
|
||||
<button class="coreshop-btn coreshop-btn-w coreshop-btn-square" @click="close()">关闭</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
// 通用传参id
|
||||
objectId: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
// 商品id
|
||||
goodsId: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
// 分享的图片
|
||||
shareImg: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 分享标题
|
||||
shareTitle: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 分享内容
|
||||
shareContent: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 分享链接
|
||||
shareHref: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
//分享类型
|
||||
shareType: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
//拼团Id/团购Id/秒杀Id
|
||||
groupId: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
//拼团的团队id
|
||||
teamId: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
providerList: [] // 分享通道 包含生成海报
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// console.log("类型:" + this.shareType);
|
||||
},
|
||||
methods: {
|
||||
// 关闭弹出层
|
||||
close() {
|
||||
this.$emit('close')
|
||||
},
|
||||
// 生成海报
|
||||
createPoster() {
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
mask: true
|
||||
});
|
||||
this.close()
|
||||
let data = {};
|
||||
if (this.shareType == this.$globalConstVars.shareType.index) {
|
||||
data = {
|
||||
page: this.shareType, //商品
|
||||
url: this.$globalConstVars.shareUrl,
|
||||
params: {
|
||||
goodsId: this.goodsId
|
||||
},
|
||||
type: this.$globalConstVars.shareModel.poster,
|
||||
client: this.$globalConstVars.shareClient.wxMiNiProgram
|
||||
}
|
||||
let userToken = this.$db.get('userToken')
|
||||
if (userToken) {
|
||||
data.token = userToken
|
||||
}
|
||||
} else if (this.shareType == this.$globalConstVars.shareType.pinTuan) {
|
||||
data = {
|
||||
page: this.shareType,
|
||||
url: this.$globalConstVars.shareUrl,
|
||||
params: {
|
||||
groupId: this.groupId,
|
||||
goodsId: this.goodsId,
|
||||
teamId: this.teamId
|
||||
},
|
||||
type: this.$globalConstVars.shareModel.poster,
|
||||
client: this.$globalConstVars.shareClient.wxMiNiProgram
|
||||
}
|
||||
let userToken = this.$db.get('userToken')
|
||||
if (userToken) {
|
||||
data.token = userToken
|
||||
}
|
||||
}
|
||||
else if (this.shareType == this.$globalConstVars.shareType.addPinTuan) {
|
||||
data = {
|
||||
page: this.shareType, //拼团
|
||||
url: this.$globalConstVars.shareUrl,
|
||||
params: {
|
||||
goodsId: this.goodsId,
|
||||
groupId: this.groupId,
|
||||
teamId: this.teamId
|
||||
},
|
||||
type: this.$globalConstVars.shareModel.poster,
|
||||
client: this.$globalConstVars.shareClient.wxMiNiProgram
|
||||
}
|
||||
let userToken = this.$db.get('userToken')
|
||||
if (userToken) {
|
||||
data.token = userToken
|
||||
}
|
||||
}
|
||||
else if (this.shareType == this.$globalConstVars.shareType.group) {
|
||||
data = {
|
||||
page: this.shareType,
|
||||
url: this.$globalConstVars.shareUrl,
|
||||
params: {
|
||||
groupId: this.groupId
|
||||
},
|
||||
type: this.$globalConstVars.shareModel.poster,
|
||||
client: this.$globalConstVars.shareClient.wxMiNiProgram
|
||||
}
|
||||
let userToken = this.$db.get('userToken')
|
||||
if (userToken) {
|
||||
data.token = userToken
|
||||
}
|
||||
}
|
||||
else if (this.shareType == this.$globalConstVars.shareType.seckill) {
|
||||
data = {
|
||||
page: this.shareType,
|
||||
url: this.$globalConstVars.shareUrl,
|
||||
params: {
|
||||
groupId: this.groupId
|
||||
},
|
||||
type: this.$globalConstVars.shareModel.poster,
|
||||
client: this.$globalConstVars.shareClient.wxMiNiProgram
|
||||
}
|
||||
let userToken = this.$db.get('userToken')
|
||||
if (userToken) {
|
||||
data.token = userToken
|
||||
}
|
||||
}
|
||||
else if (this.shareType == this.$globalConstVars.shareType.goods) {
|
||||
data = {
|
||||
page: this.shareType, //拼团
|
||||
url: this.$globalConstVars.shareUrl,
|
||||
params: {
|
||||
goodsId: this.goodsId,
|
||||
},
|
||||
type: this.$globalConstVars.shareModel.poster,
|
||||
client: this.$globalConstVars.shareClient.wxMiNiProgram
|
||||
}
|
||||
let userToken = this.$db.get('userToken')
|
||||
if (userToken) {
|
||||
data.token = userToken
|
||||
}
|
||||
}
|
||||
else if (this.shareType == this.$globalConstVars.shareType.solitaire) {
|
||||
data = {
|
||||
page: this.shareType,
|
||||
url: this.$globalConstVars.shareUrl,
|
||||
params: {
|
||||
id: this.objectId
|
||||
},
|
||||
type: this.$globalConstVars.shareModel.poster,
|
||||
client: this.$globalConstVars.shareClient.wxMiNiProgram
|
||||
}
|
||||
let userToken = this.$db.get('userToken')
|
||||
if (userToken) {
|
||||
data.token = userToken
|
||||
}
|
||||
} else if (this.shareType == this.$globalConstVars.shareType.serviceGoods) {
|
||||
data = {
|
||||
page: this.shareType,
|
||||
url: this.$globalConstVars.shareUrl,
|
||||
params: {
|
||||
serviceGoodsId: this.objectId
|
||||
},
|
||||
type: this.$globalConstVars.shareModel.poster,
|
||||
client: this.$globalConstVars.shareClient.wxMiNiProgram
|
||||
}
|
||||
let userToken = this.$db.get('userToken')
|
||||
if (userToken) {
|
||||
data.token = userToken
|
||||
}
|
||||
}
|
||||
this.$u.api.share(data).then(res => {
|
||||
if (res.status) {
|
||||
uni.hideLoading();
|
||||
if (
|
||||
this.shareType == this.$globalConstVars.shareType.goods ||
|
||||
this.shareType == this.$globalConstVars.shareType.pinTuan ||
|
||||
this.shareType == this.$globalConstVars.shareType.addPinTuan ||
|
||||
this.shareType == this.$globalConstVars.shareType.seckill ||
|
||||
this.shareType == this.$globalConstVars.shareType.group ||
|
||||
this.shareType == this.$globalConstVars.shareType.serviceGoods
|
||||
) {
|
||||
//data.posterUrl = encodeURIComponent(res.data);
|
||||
data.params.posterUrl = res.data;
|
||||
data.params.shareType = this.shareType;
|
||||
|
||||
this.$u.route('/pages/share/shareNewPoster/shareNewPoster' + uni.$u.queryParams(data.params))
|
||||
} else {
|
||||
this.$u.route('/pages/share/sharePoster/sharePoster?poster=' + encodeURIComponent(res.data))
|
||||
}
|
||||
} else {
|
||||
uni.hideLoading();
|
||||
this.$u.toast(res.msg)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,44 @@
|
||||
.layout-share-popup {
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
.share-box {
|
||||
padding: 40rpx 100rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.share-item {
|
||||
position: relative;
|
||||
.button {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
opacity: 0;
|
||||
}
|
||||
.img {
|
||||
display: block;
|
||||
width: 90rpx;
|
||||
height: 90rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.tit {
|
||||
font-size: 24rpx;
|
||||
text-align: center;
|
||||
color: #2c2c2c;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.line {
|
||||
height: 15rpx;
|
||||
width: 100%;
|
||||
background-color: #f7f8fa;
|
||||
}
|
||||
.cancel {
|
||||
width: 100%;
|
||||
line-height: 80rpx;
|
||||
font-size: 28rpx;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<template>
|
||||
<uv-popup ref="sharePpopup" mode="bottom" @maskClick="handleClosePopup">
|
||||
<view class="layout-share-popup">
|
||||
<view class="share-box">
|
||||
<view class="share-item">
|
||||
<image class="img" src="/static/images/share-wx.png"></image>
|
||||
<view class="tit">分享微信好友</view>
|
||||
<button class="button" open-type="share"></button>
|
||||
</view>
|
||||
<view class="share-item" @click="handleSharePoster">
|
||||
<image class="img" src="/static/images/share-poster.png"></image>
|
||||
<view class="tit">生成海报分享</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class="cancel" @click="handleClosePopup">取消</view>
|
||||
</view>
|
||||
</uv-popup>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { watch, ref } from 'vue';
|
||||
import { queryShare } from '@/core/api'
|
||||
import { UserToken, shareUrl } from '@/core/consts'
|
||||
import { handleShowToast, handleRouteNavigateTo } from '@/core/utils'
|
||||
import { ShareModelEnum, ShareClientEnum, ShareEnum } from '@/core/enum'
|
||||
import { queryParams } from '@/uni_modules/uv-ui-tools/libs/function/index.js';
|
||||
|
||||
const sharePpopup = ref();
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
goodsDetailData : any,
|
||||
show : boolean,
|
||||
shareType : number,
|
||||
}>(), {
|
||||
goodsDetailData: {},
|
||||
show: false,
|
||||
shareType: 1,
|
||||
});
|
||||
|
||||
const emits = defineEmits(['handleClosePopup'])
|
||||
|
||||
watch(() => props.show, (newVal : boolean) => {
|
||||
if (newVal) {
|
||||
sharePpopup.value.open();
|
||||
} else {
|
||||
sharePpopup.value.close();
|
||||
}
|
||||
});
|
||||
|
||||
const handleClosePopup = () => {
|
||||
emits('handleClosePopup');
|
||||
}
|
||||
|
||||
/** 海报分享 */
|
||||
const handleSharePoster = async () => {
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
});
|
||||
let data : any = {
|
||||
page: props.shareType,
|
||||
url: shareUrl,
|
||||
params: {},
|
||||
type: ShareModelEnum.poster,
|
||||
client: ShareClientEnum.wxMiNiProgram
|
||||
}
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
data['token'] = uni.getStorageSync(UserToken)
|
||||
}
|
||||
if (props.shareType === ShareEnum.pinTuan || props.shareType === ShareEnum.addPinTuan) {
|
||||
data.params = {
|
||||
groupId: props.goodsDetailData?.pinTuanRule.id,
|
||||
goodsId: props.goodsDetailData.id,
|
||||
teamId: props.goodsDetailData.teamId || 0,
|
||||
}
|
||||
} else if (props.shareType === ShareEnum.group || props.shareType === ShareEnum.seckill) {
|
||||
data.params = {
|
||||
groupId: props.goodsDetailData?.groupId
|
||||
}
|
||||
} else if (props.shareType === ShareEnum.goods) {
|
||||
data.params = {
|
||||
goodsId: props.goodsDetailData?.id
|
||||
}
|
||||
} else if (props.shareType === ShareEnum.solitaire) {
|
||||
data.params = {
|
||||
id: props.goodsDetailData?.id
|
||||
}
|
||||
} else if (props.shareType === ShareEnum.serviceGoods) {
|
||||
data.params = {
|
||||
serviceGoodsId: props.goodsDetailData?.id
|
||||
}
|
||||
}
|
||||
const share = await queryShare(data);
|
||||
if (share.status) {
|
||||
uni.hideLoading();
|
||||
emits('handleClosePopup');
|
||||
if (props.shareType === ShareEnum.goods ||
|
||||
props.shareType === ShareEnum.pinTuan ||
|
||||
props.shareType === ShareEnum.addPinTuan ||
|
||||
props.shareType === ShareEnum.seckill ||
|
||||
props.shareType === ShareEnum.group ||
|
||||
props.shareType === ShareEnum.serviceGoods
|
||||
) {
|
||||
data.params.posterUrl = share.data;
|
||||
data.params.shareType = props.shareType;
|
||||
handleRouteNavigateTo(`/pages/subpackage/share/sharePoster/sharePoster` + queryParams(data.params));
|
||||
} else {
|
||||
handleRouteNavigateTo(`/pages/subpackage/share/qrCode/qrCode?poster=${encodeURIComponent(share.data)}`)
|
||||
}
|
||||
} else {
|
||||
uni.hideLoading();
|
||||
handleShowToast(share.msg);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import './coreshop-share.scss';
|
||||
</style>
|
||||
@@ -0,0 +1,19 @@
|
||||
.core-tabs-box {
|
||||
.scroll-view {
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
}
|
||||
.tab-item-box {
|
||||
display: inline-block;
|
||||
padding: 15rpx 30rpx;
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
background-color: #f7f7f7;
|
||||
margin-left: 20rpx;
|
||||
border-radius: 20px;
|
||||
}
|
||||
.tab-item-box.on {
|
||||
background-color: rgba(211, 49, 35, 0.1);
|
||||
color: #d33123;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<view class="core-tabs-box">
|
||||
<slot name="left"> </slot>
|
||||
<scroll-view :scroll-x="true" class="scroll-view" :scroll-left="state.scrollLeft" :scroll-with-animation="true">
|
||||
<view v-for="item, index in props.list" :key="index"
|
||||
:class="['tab-item-box', { 'on': index === state.current }]" @click="hanldeClickTab(item, index)">
|
||||
{{ item[props.keyNname] }}
|
||||
</view>
|
||||
</scroll-view>
|
||||
<slot name="right"></slot>
|
||||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { reactive, watch, getCurrentInstance } from 'vue';
|
||||
|
||||
const instance = getCurrentInstance();
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
current : number,
|
||||
keyNname : string,
|
||||
list : Array<any>,
|
||||
}>(), {
|
||||
current: 0,
|
||||
keyNname: 'name',
|
||||
list: () => [],
|
||||
});
|
||||
|
||||
const emit = defineEmits(['hanldeClickTab'])
|
||||
|
||||
const state = reactive<{
|
||||
arr : Array<any>,
|
||||
lineLeft : number,
|
||||
current : number,
|
||||
scrollLeft : number,
|
||||
}>({
|
||||
arr: [],
|
||||
lineLeft: 0,
|
||||
current: props.current,
|
||||
scrollLeft: 0,
|
||||
})
|
||||
|
||||
watch(() => props.list, (newVal : any) => {
|
||||
if (newVal) {
|
||||
state.current = 0;
|
||||
calculationLineLeftNum();
|
||||
}
|
||||
})
|
||||
|
||||
const calculationLineLeftNum = () => {
|
||||
const query = uni.createSelectorQuery().in(instance.proxy);
|
||||
query.selectAll('.tab-item-box')
|
||||
.boundingClientRect((rect : any) => {
|
||||
state.arr = [];
|
||||
rect.forEach((item : any) => {
|
||||
state.arr.push({
|
||||
width: item.width
|
||||
});
|
||||
});
|
||||
})
|
||||
.exec()
|
||||
}
|
||||
|
||||
const hanldeClickTab = (item : any, index : number) => {
|
||||
if (state.current != index) {
|
||||
state.current = index;
|
||||
let scrollLeft = 0;
|
||||
for (let i = 0; i < index - 1; i++) {
|
||||
scrollLeft += state.arr[i].width
|
||||
};
|
||||
state.scrollLeft = scrollLeft;
|
||||
emit('hanldeClickTab', item)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "./coreshop-tabs.scss";
|
||||
</style>
|
||||
@@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<view class="more-box" @click="hanldeClickViewMore">
|
||||
<text class="more-text" :style="{ 'color': props.color }">{{ props.title }}</text>
|
||||
<view class="more-icon">
|
||||
<uv-icon name="arrow-right" :color="props.color" :size="15"></uv-icon>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
const props = withDefaults(defineProps<{
|
||||
title : string,
|
||||
color : string,
|
||||
}>(), {
|
||||
title: '查看更多',
|
||||
color: '#6E737D'
|
||||
});
|
||||
|
||||
const emit = defineEmits(['hanldeClickViewMore']);
|
||||
|
||||
const hanldeClickViewMore = () => {
|
||||
emit('hanldeClickViewMore');
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.more-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.more-text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.more-icon {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
margin-top: 2rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,97 +0,0 @@
|
||||
<template>
|
||||
<view class="fy-dropdown-floor">
|
||||
<scroll-view :scroll-y="true" style="height: 220px;">
|
||||
<view class="fy-dropdown-floor_item" v-for="(item, index) in options" :key="index">
|
||||
<text class="fy-dropdown-floor_title">{{ item.title }}</text>
|
||||
<view class="fy-dropdown-floor_ul">
|
||||
<text :class="['fy-dropdown-floor_li', selected[item.key] == cell.value ? 'fy-dropdown-floor_li__active' : '']" v-for="(cell, cellIndex) in item.list" :key="cellIndex" @click.stop.prevent="handlerCellClick(item.key, cell.value)">{{ cell.text }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="fy-dropdown-button-list">
|
||||
<button class="fy-dropdown-button-item" @click.stop.prevent="handlerCancel"><text class="fy-dropdown-button-text" :style="{color: cancelColor}">取消</text></button>
|
||||
<text class="fy-dropdown-button-border-left"></text>
|
||||
<button class="fy-dropdown-button-item" @click.stop.prevent="handlerConfirm"><text class="fy-dropdown-button-text" :style="{color: confirmColor}">确定</text></button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
// 选项数据,如果传入了默认slot,此参数无效
|
||||
options: {
|
||||
type: Array, default () { return [] }
|
||||
},
|
||||
cancelColor: {
|
||||
type: String, default: '#333333'
|
||||
},
|
||||
confirmColor: {
|
||||
type: String, default: '#4cd964'
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
selected: {}, // 存储选中的值
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
options: {
|
||||
immediate: true, deep: true,
|
||||
handler: function(list) {
|
||||
for (var i = 0, len = list.length; i < len; i++) {
|
||||
if (list[i]['key']) {
|
||||
this.$set(this.selected, list[i]['key'], list[i]['default']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handlerCellClick(key, data) {
|
||||
this.$set(this.selected, key, data);
|
||||
},
|
||||
handlerCancel() {
|
||||
this.$emit('success', { cancel: true, type: 'column', })
|
||||
},
|
||||
handlerConfirm() {
|
||||
try {
|
||||
this.$emit('success', { confirm: true, type: 'column', data: JSON.parse(JSON.stringify(this.selected)) })
|
||||
} catch(err) {
|
||||
this.$emit('success', { confirm: true, type: 'column', data: JSON.parse(JSON.stringify(this.selected)) })
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 定义混入指令,用于在非nvue环境下的flex定义,因为nvue没有display属性,会报错
|
||||
@mixin vue-flex($direction: row) {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: $direction;
|
||||
}
|
||||
// @include vue-flex;
|
||||
|
||||
.fy-dropdown-floor{background-color: #ffffff;border-top: 1px solid #f2f2f2;}
|
||||
|
||||
.fy-dropdown-floor_item{margin-top: 42rpx;}
|
||||
.fy-dropdown-floor_title{font-size: 30rpx;color: #333333;padding-bottom: 6rpx;margin-left: 40rpx;font-weight: bold;}
|
||||
.fy-dropdown-floor_ul{@include vue-flex;align-items: center;flex-wrap: wrap;padding: 0 40rpx 0 20rpx;}
|
||||
.fy-dropdown-floor_li{border: 1px solid #EFEFEF;height: 52rpx;line-height: 49rpx;text-align: center;padding: 0 28rpx;border-radius: 26rpx;background-color: #EFEFEF;color: #999999;
|
||||
font-size: 26rpx;margin-left: 20rpx;margin-top: 20rpx;
|
||||
}
|
||||
.fy-dropdown-floor_li__active{border-color: #00BCD4;color: #00BCD4;background-color: #ffffff;}
|
||||
|
||||
|
||||
.fy-dropdown-button-list{@include vue-flex;align-items: center;border-top: 1px solid #f6f6f6;}
|
||||
.fy-dropdown-button-item{@include vue-flex;align-items: center;justify-content: center;flex: 1;height: 100rpx;background-color: #ffffff;border-radius: 0;border-width: 0rpx;
|
||||
/* #ifndef APP-NVUE */
|
||||
&::after{border: none;}
|
||||
/* #endif */
|
||||
}
|
||||
.fy-dropdown-button-text{font-size: 30rpx;}
|
||||
.fy-dropdown-button-border-left{width: 1px;height: 100rpx;background-color: #f2f2f2;transform: scaleX(0.7);}
|
||||
</style>
|
||||
@@ -1,11 +0,0 @@
|
||||
// 定义混入指令,用于在非nvue环境下的flex定义,因为nvue没有display属性,会报错
|
||||
@mixin vue-flex($direction: row) {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: $direction;
|
||||
}
|
||||
|
||||
.fy_dropdown-item_scroll{@include vue-flex(column);border-top: 1px solid #f2f2f2;}
|
||||
.fy_dropdown-item_scroll_cell{@include vue-flex(row);padding: 0 30rpx;justify-content: space-between;align-items: center;border-bottom: 1px solid #f6f6f6;background-color: #FFFFFF;}
|
||||
.fy_cell_title{font-size: 26rpx;text-align: left;color: #909399;}
|
||||
@@ -1,187 +0,0 @@
|
||||
<template>
|
||||
<view :class="['fy-dropdown-item', 'fy_dropdown-item']" @touchmove.stop.prevent="() => {}" :style="{'background-color': backgroundColor, 'height': activeItemHeight+'rpx'}" v-if="active">
|
||||
<template v-if="!custom">
|
||||
<template v-if="type == 'column'">
|
||||
<Fy-dropdown-column :options="options" @success="onCateSuccess" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<scroll-view :scroll-y="true" class="fy_dropdown-item_scroll" :style="getScrollStyle">
|
||||
<view v-for="(item, index) in options" :key="index" @click.stop.prevent="cellClick(item.value)" class="fy_dropdown-item_scroll_cell"
|
||||
:style="{'height': `${itemHeight}rpx`, 'line-height': `${itemHeight}rpx`}">
|
||||
<text class="fy_cell_title" :style="{ color: value == item.value ? activeColor : inactiveColor }">{{ item.label }}</text>
|
||||
<u-icon name="arrow-down" :color="activeColor" v-if="value == item.value" size="16"></u-icon>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
</template>
|
||||
<slot v-else></slot>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FyDropdownColumn from './fy-dropdown-column.vue';
|
||||
|
||||
/**
|
||||
* dropdown-item 下拉菜单
|
||||
* @description 该组件一般用于向下展开菜单,同时可切换多个选项卡的场景
|
||||
* @property {String | Number} v-model 双向绑定选项卡选择值
|
||||
* @property {Array[Object]} options 选项数据,如果传入了默认slot,此参数无效
|
||||
* @property {Boolean} disabled 是否禁用此选项卡(默认false)
|
||||
* @property {String | Number} duration 选项卡展开和收起的过渡时间,单位ms(默认300)
|
||||
* @property {String | Number} height 弹窗下拉内容的高度(内容超出将会滚动)(默认auto)
|
||||
* @example <fy-dropdown-item></fy-dropdown-item>
|
||||
*/
|
||||
export default {
|
||||
name: 'fy-dropdown-item',
|
||||
components: { FyDropdownColumn },
|
||||
props: {
|
||||
// 当前选中项的value值
|
||||
dropdownKey: {
|
||||
type: String, default: ''
|
||||
},
|
||||
// 当前选中项的value值
|
||||
value: {
|
||||
type: [Number, String, Array, Object], default: ''
|
||||
},
|
||||
// 选项数据,如果传入了默认slot,此参数无效
|
||||
options: {
|
||||
type: Array, default () { return [] }
|
||||
},
|
||||
// 是否禁用此菜单项
|
||||
disabled: {
|
||||
type: Boolean, default: false
|
||||
},
|
||||
backgroundColor: {
|
||||
type: String, default: 'transparent'
|
||||
},
|
||||
maxHeight: {
|
||||
type: Number, default: 800
|
||||
},
|
||||
itemHeight: {
|
||||
type: Number, default: 90
|
||||
},
|
||||
type: {
|
||||
type: String, default: ''
|
||||
},
|
||||
custom: {
|
||||
type: Boolean, default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
initComponent: false,
|
||||
activeItemHeight: 300,
|
||||
active: false, // 当前项是否处于展开状态
|
||||
// #ifndef MP
|
||||
parent: null,
|
||||
// #endif
|
||||
activeColor: '#00bcd4', // 激活时左边文字和右边对勾图标的颜色
|
||||
inactiveColor: '#606266', // 未激活时左边文字和右边对勾图标的颜色
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
getScrollHeight() {
|
||||
let height = this.options.length * this.itemHeight;
|
||||
if (height === 0) {
|
||||
return 300;
|
||||
} else if(height > this.maxHeight) {
|
||||
return this.maxHeight;
|
||||
} else {
|
||||
return height;
|
||||
}
|
||||
},
|
||||
getScrollStyle() {
|
||||
return { 'height': `${this.getScrollHeight}rpx` }
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.activeItemHeight = 300;
|
||||
// #ifdef MP
|
||||
this.parent = null;
|
||||
// #endif
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
// 获取父组件的参数,因为支付宝小程序不支持provide/inject的写法
|
||||
// this.$parent在非H5中,可以准确获取到父组件,但是在H5中,需要多次this.$parent.$parent.xxx
|
||||
// 这里默认值等于undefined有它的含义,因为最顶层元素(组件)的$parent就是undefined,意味着不传name
|
||||
// 值(默认为undefined),就是查找最顶层的$parent
|
||||
getParent(name = undefined) {
|
||||
try {
|
||||
let parent = this.$parent;
|
||||
// 通过while历遍,这里主要是为了H5需要多层解析的问题
|
||||
while (parent) {
|
||||
// 父组件
|
||||
if (parent.$options && parent.$options.name !== name) {
|
||||
// 如果组件的name不相等,继续上一级寻找
|
||||
parent = parent.$parent;
|
||||
} else {
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} catch(err) {
|
||||
console.log(err);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
// 将当前px转换为rpx
|
||||
getScaleToRpx(px) {
|
||||
try {
|
||||
const screenWidth = uni.getSystemInfoSync().screenWidth;
|
||||
const unit = 750 / screenWidth;
|
||||
return px * unit;
|
||||
} catch(err) {
|
||||
return px;
|
||||
}
|
||||
},
|
||||
init() {
|
||||
try {
|
||||
let parent = this.getParent.call(this, 'fy-dropdown');
|
||||
if (!parent) return;
|
||||
this.parent = parent;
|
||||
this.active = parent.currentKey == this.dropdownKey;
|
||||
|
||||
if (this.initComponent === false) {
|
||||
parent.childList.push(this); // 供父组件依次更新子组件显示内容
|
||||
}
|
||||
if (this.active === false) {
|
||||
this.initComponent = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.type === 'cate' || this.type === 'address') {
|
||||
this.activeItemHeight = this.getScaleToRpx(320) + 100;
|
||||
} else if(this.type === 'column') {
|
||||
this.activeItemHeight = this.getScaleToRpx(220) + 100;
|
||||
} else {
|
||||
this.activeItemHeight = this.getScrollHeight;
|
||||
}
|
||||
|
||||
this.initComponent = true;
|
||||
} catch(err) {
|
||||
console.log(err)
|
||||
}
|
||||
},
|
||||
// cell被点击
|
||||
cellClick(value) {
|
||||
// 修改通过v-model绑定的值
|
||||
this.$emit('input', value);
|
||||
// 通知父组件(fy-dropdown)收起菜单
|
||||
this.parent.close();
|
||||
// 发出事件,抛出当前勾选项的value
|
||||
this.$emit('change', value);
|
||||
},
|
||||
onCateSuccess(data) {
|
||||
this.parent.close();
|
||||
this.$emit('change', data);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import './fy-dropdown-item.scss';
|
||||
</style>
|
||||
@@ -1,17 +0,0 @@
|
||||
// 定义混入指令,用于在非nvue环境下的flex定义,因为nvue没有display属性,会报错
|
||||
@mixin vue-flex($direction: row) {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: $direction;
|
||||
}
|
||||
|
||||
.fy_dropdown {width: 750rpx;position: relative;}
|
||||
.fy_flex{@include vue-flex(row);align-items: center;}
|
||||
.fy_dropdown__menu{@include vue-flex(row);position: relative;align-items: center;justify-content: space-between;}
|
||||
.fy_border-bottom{border-bottom: 1px solid #f2f2f2;}
|
||||
.fy_dropdown__menu_mian{@include vue-flex(row);align-items: center;justify-content: space-between;flex: 1;background-color: #ffffff}
|
||||
.fy_dropdown__menu__center{@include vue-flex(row);align-items: center;justify-content: space-between;flex: 1;}
|
||||
.fy_dropdown__menu__item {@include vue-flex(row);justify-content: center;align-items: center;flex: 1;}
|
||||
.fy_dropdown__menu__item__text{font-size: 28rpx;color: #606266;}
|
||||
.fy_dropdown__menu__item__arrow{@include vue-flex(row);margin-left: 5rpx;margin-top: 3rpx;transition-property: transform;transition-duration: 0.3s; transform: scale(0.8);align-items: center;}
|
||||
@@ -1,222 +0,0 @@
|
||||
<template>
|
||||
<view class="fy_dropdown" @click.stop.prevent="() => {}">
|
||||
<view :class="['fy_dropdown__menu', borderBottom ? 'fy_border-bottom' : '']" id="fy_dropdown__menu" :style="{ 'height': `${height}rpx`, 'background-color': backgroundColor }">
|
||||
<view class="fy_dropdown__menu_mian">
|
||||
<view class="fy_dropdown__menu__left" :style="{ height: `${height}rpx` }">
|
||||
<slot name="left"></slot>
|
||||
</view>
|
||||
<view class="fy_dropdown__menu__center">
|
||||
<view class="fy_dropdown__menu__item" :style="{ height: `${height}rpx` }" v-for="(item, index) in menuList" :key="index" @click="handlerMenuClick(index, item.dropdownKey)">
|
||||
<view class="fy_flex">
|
||||
<text class="fy_dropdown__menu__item__text" v-if="item.title"
|
||||
:style="{ color: item.disabled ? '#c0c4cc' : (index === current || highlightIndex == index) ? activeColor : inactiveColor, fontSize: `${titleSize}rpx` }">{{item.title}}</text>
|
||||
<view class="fy_dropdown__menu__item__arrow" :style="{'transform': index === current ? 'scale(0.8) rotate(180deg)' : 'scale(1) rotate(0deg)'}">
|
||||
<u-icon :name="menuIcon" :color="index === current || highlightIndex == index ? activeColor : '#c0c4cc'" :size="menuIconSize"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="fy_dropdown__menu__right" :style="{ height: `${height}rpx` }">
|
||||
<slot name="right"></slot>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-transition :mode="['fade']" :show="active" :duration="duration" :customStyle="maskClass" @click="handlerMaskClick"></u-transition>
|
||||
<u-transition :mode="['fade']" :show="active" :duration="duration" :customStyle="transClass">
|
||||
<view class="fy_dropdown__content__popup">
|
||||
<slot></slot>
|
||||
</view>
|
||||
</u-transition>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* dropdown 下拉菜单
|
||||
* @description 该组件一般用于向下展开菜单,同时可切换多个选项卡的场景
|
||||
* @property {String} active-color 标题和选项卡选中的颜色(默认#00bcd4)
|
||||
* @property {String} inactive-color 标题和选项卡未选中的颜色(默认#606266)
|
||||
* @property {Boolean} close-on-click-mask 点击遮罩是否关闭菜单(默认true)
|
||||
* @property {Boolean} close-on-click-self 点击当前激活项标题是否关闭菜单(默认true)
|
||||
* @property {String | Number} duration 选项卡展开和收起的过渡时间,单位ms(默认300)
|
||||
* @property {String | Number} height 标题菜单的高度,单位任意(默认90)
|
||||
* @property {String | Number} border-radius 菜单展开内容下方的圆角值,单位任意(默认0)
|
||||
* @property {Boolean} border-bottom 标题菜单是否显示下边框(默认false)
|
||||
* @property {String | Number} title-size 标题的字体大小,单位任意,数值默认为rpx单位(默认28)
|
||||
* @event {Function} open 下拉菜单被打开时触发
|
||||
* @event {Function} close 下拉菜单被关闭时触发
|
||||
* @example <fy-dropdown></fy-dropdown>
|
||||
*/
|
||||
export default {
|
||||
name: 'fy-dropdown',
|
||||
props: {
|
||||
// 菜单标题和选项的激活态颜色
|
||||
activeColor: {
|
||||
type: String, default: '#00bcd4'
|
||||
},
|
||||
// 菜单标题和选项的未激活态颜色
|
||||
inactiveColor: {
|
||||
type: String, default: '#606266'
|
||||
},
|
||||
// 点击遮罩是否关闭菜单
|
||||
closeOnClickMask: {
|
||||
type: Boolean, default: true
|
||||
},
|
||||
// 点击当前激活项标题是否关闭菜单
|
||||
closeOnClickSelf: {
|
||||
type: Boolean, default: true
|
||||
},
|
||||
// 过渡时间
|
||||
duration: {
|
||||
type: [Number, String], default: 300
|
||||
},
|
||||
// 标题菜单的高度,单位任意,数值默认为rpx单位
|
||||
height: {
|
||||
type: [Number, String], default: 90
|
||||
},
|
||||
// 是否显示下边框
|
||||
borderBottom: {
|
||||
type: Boolean, default: false
|
||||
},
|
||||
// 标题的字体大小
|
||||
titleSize: {
|
||||
type: [Number, String], default: 28
|
||||
},
|
||||
// 菜单右侧的icon图标
|
||||
menuIcon: {
|
||||
type: String, default: 'arrow-down'
|
||||
},
|
||||
// 菜单右侧图标的大小
|
||||
menuIconSize: {
|
||||
type: [Number, String], default: 11
|
||||
},
|
||||
// 背景色
|
||||
backgroundColor: {
|
||||
type: String, default: 'transparent'
|
||||
},
|
||||
// 显示的菜单
|
||||
menuList: {
|
||||
type: Array, default() { return [] }
|
||||
},
|
||||
// h5的导航栏高度
|
||||
H5NavBarHeight: {
|
||||
type: Number, default: 44
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
titleHeight: 40,
|
||||
|
||||
active: false, // 下拉菜单的状态
|
||||
// 当前是第几个菜单处于激活状态,小程序中此处不能写成false或者"",否则后续将current赋值为0,
|
||||
// 无能的TX没有使用===而是使用==判断,导致程序认为前后二者没有变化,从而不会触发视图更新
|
||||
current: 99999,
|
||||
currentKey: '',
|
||||
// 让某个菜单保持高亮的状态
|
||||
highlightIndex: 99999,
|
||||
contentHeight: 0, // 内容高度
|
||||
|
||||
maskClass: { // 遮罩层样式
|
||||
'position': 'fixed', 'bottom': 0, 'top': 0, 'left': 0, 'right': 0, 'backgroundColor': 'rgba(0, 0, 0, 0.6)', 'z-index': 999999
|
||||
},
|
||||
transClass: { // 内容弹框样式
|
||||
'position': 'fixed', 'left': 0, 'right': 0, 'top': 0, 'z-index': 999999
|
||||
},
|
||||
|
||||
// #ifndef MP
|
||||
childList: [],
|
||||
// #endif
|
||||
timers: null
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// #ifdef MP
|
||||
// 供子组件调用,不能在data中声明变量,否则在微信小程序会造成循环引用而报错
|
||||
this.childList = [];
|
||||
// #endif
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.titleHeight = uni.upx2px(this.height);
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 点击菜单
|
||||
handlerMenuClick(index, dropdownKey) {
|
||||
// 判断是否被禁用
|
||||
if (this.menuList[index].disabled) return;
|
||||
// 如果点击时的索引和当前激活项索引相同,意味着点击了激活项,需要收起下拉菜单
|
||||
if (index == this.current && this.closeOnClickSelf) {
|
||||
return this.close();
|
||||
}
|
||||
|
||||
clearTimeout(this.timers);
|
||||
this.timers = setTimeout(() => {
|
||||
this.open(index, dropdownKey);
|
||||
clearTimeout(this.timers);
|
||||
}, 0);
|
||||
},
|
||||
// 打开下拉菜单
|
||||
open(index, dropdownKey) {
|
||||
// 重置高亮索引,否则会造成多个菜单同时高亮
|
||||
this.highlightIndex = 9999;
|
||||
// 展开时,设置下拉内容的样式
|
||||
// 标记展开状态以及当前展开项的索引
|
||||
this.active = true;
|
||||
this.current = index;
|
||||
this.currentKey = dropdownKey;
|
||||
|
||||
this.getContentHeight();
|
||||
|
||||
this.childList.forEach(item => item.init())
|
||||
|
||||
this.$emit('open', this.current);
|
||||
},
|
||||
// 设置下拉菜单处于收起状态
|
||||
close() {
|
||||
this.$emit('close', this.current);
|
||||
// 设置为收起状态,同时current归位,设置为空字符串
|
||||
this.active = false;
|
||||
this.current = 99999;
|
||||
this.currentKey = '';
|
||||
|
||||
// #ifndef MP
|
||||
this.childList = [];
|
||||
// #endif
|
||||
},
|
||||
// 点击遮罩
|
||||
handlerMaskClick() {
|
||||
// 如果不允许点击遮罩,直接返回
|
||||
if (!this.closeOnClickMask) return;
|
||||
this.close();
|
||||
},
|
||||
// 外部手动设置某个菜单高亮
|
||||
highlight(index = undefined) {
|
||||
this.highlightIndex = index !== undefined ? index : 99999;
|
||||
},
|
||||
// 获取下拉菜单内容的高度
|
||||
getContentHeight() {
|
||||
// #ifdef APP-NVUE
|
||||
uni.createSelectorQuery().in(this).select('#fy_dropdown__menu').boundingClientRect().exec(rect => {
|
||||
const data = rect[0];
|
||||
const top = data.top + this.titleHeight + 'px';
|
||||
this.maskClass.top = top;
|
||||
this.transClass.top = top;
|
||||
});
|
||||
// #endif
|
||||
|
||||
// #ifndef APP-NVUE
|
||||
uni.createSelectorQuery().in(this).select('.fy_dropdown__menu').boundingClientRect(rect => {
|
||||
const top = rect.top + this.titleHeight + 'px';
|
||||
this.maskClass.top = top;
|
||||
this.transClass.top = top;
|
||||
}).exec()
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import './fy-dropdown.scss';
|
||||
</style>
|
||||
@@ -1,128 +0,0 @@
|
||||
// const defaultOption = {
|
||||
// duration: 300,
|
||||
// timingFunction: 'linear',
|
||||
// delay: 0,
|
||||
// transformOrigin: '50% 50% 0'
|
||||
// }
|
||||
// #ifdef APP-NVUE
|
||||
const nvueAnimation = uni.requireNativePlugin('animation')
|
||||
// #endif
|
||||
class MPAnimation {
|
||||
constructor(options, _this) {
|
||||
this.options = options
|
||||
this.animation = uni.createAnimation(options)
|
||||
this.currentStepAnimates = {}
|
||||
this.next = 0
|
||||
this.$ = _this
|
||||
|
||||
}
|
||||
|
||||
_nvuePushAnimates(type, args) {
|
||||
let aniObj = this.currentStepAnimates[this.next]
|
||||
let styles = {}
|
||||
if (!aniObj) {
|
||||
styles = {
|
||||
styles: {},
|
||||
config: {}
|
||||
}
|
||||
} else {
|
||||
styles = aniObj
|
||||
}
|
||||
if (animateTypes1.includes(type)) {
|
||||
if (!styles.styles.transform) {
|
||||
styles.styles.transform = ''
|
||||
}
|
||||
let unit = ''
|
||||
if(type === 'rotate'){
|
||||
unit = 'deg'
|
||||
}
|
||||
styles.styles.transform += `${type}(${args+unit}) `
|
||||
} else {
|
||||
styles.styles[type] = `${args}`
|
||||
}
|
||||
this.currentStepAnimates[this.next] = styles
|
||||
}
|
||||
_animateRun(styles = {}, config = {}) {
|
||||
let ref = this.$.$refs['ani'].ref
|
||||
if (!ref) return
|
||||
return new Promise((resolve, reject) => {
|
||||
nvueAnimation.transition(ref, {
|
||||
styles,
|
||||
...config
|
||||
}, res => {
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
_nvueNextAnimate(animates, step = 0, fn) {
|
||||
let obj = animates[step]
|
||||
if (obj) {
|
||||
let {
|
||||
styles,
|
||||
config
|
||||
} = obj
|
||||
this._animateRun(styles, config).then(() => {
|
||||
step += 1
|
||||
this._nvueNextAnimate(animates, step, fn)
|
||||
})
|
||||
} else {
|
||||
this.currentStepAnimates = {}
|
||||
typeof fn === 'function' && fn()
|
||||
this.isEnd = true
|
||||
}
|
||||
}
|
||||
|
||||
step(config = {}) {
|
||||
// #ifndef APP-NVUE
|
||||
this.animation.step(config)
|
||||
// #endif
|
||||
// #ifdef APP-NVUE
|
||||
this.currentStepAnimates[this.next].config = Object.assign({}, this.options, config)
|
||||
this.currentStepAnimates[this.next].styles.transformOrigin = this.currentStepAnimates[this.next].config.transformOrigin
|
||||
this.next++
|
||||
// #endif
|
||||
return this
|
||||
}
|
||||
|
||||
run(fn) {
|
||||
// #ifndef APP-NVUE
|
||||
this.$.animationData = this.animation.export()
|
||||
this.$.timer = setTimeout(() => {
|
||||
typeof fn === 'function' && fn()
|
||||
}, this.$.durationTime)
|
||||
// #endif
|
||||
// #ifdef APP-NVUE
|
||||
this.isEnd = false
|
||||
let ref = this.$.$refs['ani'] && this.$.$refs['ani'].ref
|
||||
if(!ref) return
|
||||
this._nvueNextAnimate(this.currentStepAnimates, 0, fn)
|
||||
this.next = 0
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const animateTypes1 = ['matrix', 'matrix3d', 'rotate', 'rotate3d', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scale3d',
|
||||
'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'translate', 'translate3d', 'translateX', 'translateY',
|
||||
'translateZ'
|
||||
]
|
||||
const animateTypes2 = ['opacity', 'backgroundColor']
|
||||
const animateTypes3 = ['width', 'height', 'left', 'right', 'top', 'bottom']
|
||||
animateTypes1.concat(animateTypes2, animateTypes3).forEach(type => {
|
||||
MPAnimation.prototype[type] = function(...args) {
|
||||
// #ifndef APP-NVUE
|
||||
this.animation[type](...args)
|
||||
// #endif
|
||||
// #ifdef APP-NVUE
|
||||
this._nvuePushAnimates(type, args)
|
||||
// #endif
|
||||
return this
|
||||
}
|
||||
})
|
||||
|
||||
export function createAnimation(option, _this) {
|
||||
if(!_this) return
|
||||
clearTimeout(_this.timer)
|
||||
return new MPAnimation(option, _this)
|
||||
}
|
||||
@@ -1,276 +0,0 @@
|
||||
<template>
|
||||
<view v-if="isShow" ref="ani" :animation="animationData" :class="customClass" :style="transformStyles" @click="onClick"><slot></slot></view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createAnimation } from './createAnimation'
|
||||
|
||||
/**
|
||||
* Transition 过渡动画
|
||||
* @description 简单过渡动画组件
|
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=985
|
||||
* @property {Boolean} show = [false|true] 控制组件显示或隐藏
|
||||
* @property {Array|String} modeClass = [fade|slide-top|slide-right|slide-bottom|slide-left|zoom-in|zoom-out] 过渡动画类型
|
||||
* @value fade 渐隐渐出过渡
|
||||
* @value slide-top 由上至下过渡
|
||||
* @value slide-right 由右至左过渡
|
||||
* @value slide-bottom 由下至上过渡
|
||||
* @value slide-left 由左至右过渡
|
||||
* @value zoom-in 由小到大过渡
|
||||
* @value zoom-out 由大到小过渡
|
||||
* @property {Number} duration 过渡动画持续时间
|
||||
* @property {Object} styles 组件样式,同 css 样式,注意带’-‘连接符的属性需要使用小驼峰写法如:`backgroundColor:red`
|
||||
*/
|
||||
export default {
|
||||
name: 'uniTransition',
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
modeClass: {
|
||||
type: [Array, String],
|
||||
default() {
|
||||
return 'fade'
|
||||
}
|
||||
},
|
||||
duration: {
|
||||
type: Number,
|
||||
default: 300
|
||||
},
|
||||
styles: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
customClass:{
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isShow: false,
|
||||
transform: '',
|
||||
opacity: 1,
|
||||
animationData: {},
|
||||
durationTime: 300,
|
||||
config: {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
show: {
|
||||
handler(newVal) {
|
||||
if (newVal) {
|
||||
this.open()
|
||||
} else {
|
||||
// 避免上来就执行 close,导致动画错乱
|
||||
if (this.isShow) {
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 生成样式数据
|
||||
stylesObject() {
|
||||
let styles = {
|
||||
...this.styles,
|
||||
'transition-duration': this.duration / 1000 + 's'
|
||||
}
|
||||
let transform = ''
|
||||
for (let i in styles) {
|
||||
let line = this.toLine(i)
|
||||
transform += line + ':' + styles[i] + ';'
|
||||
}
|
||||
return transform
|
||||
},
|
||||
// 初始化动画条件
|
||||
transformStyles() {
|
||||
return 'transform:' + this.transform + ';' + 'opacity:' + this.opacity + ';' + this.stylesObject
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// 动画默认配置
|
||||
this.config = {
|
||||
duration: this.duration,
|
||||
timingFunction: 'ease',
|
||||
transformOrigin: '50% 50%',
|
||||
delay: 0
|
||||
}
|
||||
this.durationTime = this.duration
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* ref 触发 初始化动画
|
||||
*/
|
||||
init(obj = {}) {
|
||||
if (obj.duration) {
|
||||
this.durationTime = obj.duration
|
||||
}
|
||||
this.animation = createAnimation(Object.assign(this.config, obj))
|
||||
},
|
||||
/**
|
||||
* 点击组件触发回调
|
||||
*/
|
||||
onClick() {
|
||||
this.$emit('click', {
|
||||
detail: this.isShow
|
||||
})
|
||||
},
|
||||
/**
|
||||
* ref 触发 动画分组
|
||||
* @param {Object} obj
|
||||
*/
|
||||
step(obj, config = {}) {
|
||||
if (!this.animation) return
|
||||
for (let i in obj) {
|
||||
try {
|
||||
if(typeof obj[i] === 'object'){
|
||||
this.animation[i](...obj[i])
|
||||
}else{
|
||||
this.animation[i](obj[i])
|
||||
}
|
||||
} catch (e) {
|
||||
// console.error(`方法 ${i} 不存在`)
|
||||
}
|
||||
}
|
||||
this.animation.step(config)
|
||||
return this
|
||||
},
|
||||
/**
|
||||
* ref 触发 执行动画
|
||||
*/
|
||||
run(fn) {
|
||||
if (!this.animation) return
|
||||
this.animation.run(fn)
|
||||
},
|
||||
// 开始过度动画
|
||||
open() {
|
||||
clearTimeout(this.timer)
|
||||
this.transform = ''
|
||||
this.isShow = true
|
||||
let { opacity, transform } = this.styleInit(false)
|
||||
if (typeof opacity !== 'undefined') {
|
||||
this.opacity = opacity
|
||||
}
|
||||
this.transform = transform
|
||||
// 确保动态样式已经生效后,执行动画,如果不加 nextTick ,会导致 wx 动画执行异常
|
||||
this.$nextTick(() => {
|
||||
// TODO 定时器保证动画完全执行,目前有些问题,后面会取消定时器
|
||||
this.timer = setTimeout(() => {
|
||||
this.animation = createAnimation(this.config, this)
|
||||
this.tranfromInit(false).step()
|
||||
this.animation.run()
|
||||
this.$emit('change', {
|
||||
detail: this.isShow
|
||||
})
|
||||
}, 20)
|
||||
})
|
||||
},
|
||||
// 关闭过度动画
|
||||
close(type) {
|
||||
if (!this.animation) return
|
||||
this.tranfromInit(true)
|
||||
.step()
|
||||
.run(() => {
|
||||
this.isShow = false
|
||||
this.animationData = null
|
||||
this.animation = null
|
||||
let { opacity, transform } = this.styleInit(false)
|
||||
this.opacity = opacity || 1
|
||||
this.transform = transform
|
||||
this.$emit('change', {
|
||||
detail: this.isShow
|
||||
})
|
||||
})
|
||||
},
|
||||
// 处理动画开始前的默认样式
|
||||
styleInit(type) {
|
||||
let styles = {
|
||||
transform: ''
|
||||
}
|
||||
let buildStyle = (type, mode) => {
|
||||
if (mode === 'fade') {
|
||||
styles.opacity = this.animationType(type)[mode]
|
||||
} else {
|
||||
styles.transform += this.animationType(type)[mode] + ' '
|
||||
}
|
||||
}
|
||||
if (typeof this.modeClass === 'string') {
|
||||
buildStyle(type, this.modeClass)
|
||||
} else {
|
||||
this.modeClass.forEach(mode => {
|
||||
buildStyle(type, mode)
|
||||
})
|
||||
}
|
||||
return styles
|
||||
},
|
||||
// 处理内置组合动画
|
||||
tranfromInit(type) {
|
||||
let buildTranfrom = (type, mode) => {
|
||||
let aniNum = null
|
||||
if (mode === 'fade') {
|
||||
aniNum = type ? 0 : 1
|
||||
} else {
|
||||
aniNum = type ? '-100%' : '0'
|
||||
if (mode === 'zoom-in') {
|
||||
aniNum = type ? 0.8 : 1
|
||||
}
|
||||
if (mode === 'zoom-out') {
|
||||
aniNum = type ? 1.2 : 1
|
||||
}
|
||||
if (mode === 'slide-right') {
|
||||
aniNum = type ? '100%' : '0'
|
||||
}
|
||||
if (mode === 'slide-bottom') {
|
||||
aniNum = type ? '100%' : '0'
|
||||
}
|
||||
}
|
||||
this.animation[this.animationMode()[mode]](aniNum)
|
||||
}
|
||||
if (typeof this.modeClass === 'string') {
|
||||
buildTranfrom(type, this.modeClass)
|
||||
} else {
|
||||
this.modeClass.forEach(mode => {
|
||||
buildTranfrom(type, mode)
|
||||
})
|
||||
}
|
||||
|
||||
return this.animation
|
||||
},
|
||||
animationType(type) {
|
||||
return {
|
||||
fade: type ? 1 : 0,
|
||||
'slide-top': `translateY(${type ? '0' : '-100%'})`,
|
||||
'slide-right': `translateX(${type ? '0' : '100%'})`,
|
||||
'slide-bottom': `translateY(${type ? '0' : '100%'})`,
|
||||
'slide-left': `translateX(${type ? '0' : '-100%'})`,
|
||||
'zoom-in': `scaleX(${type ? 1 : 0.8}) scaleY(${type ? 1 : 0.8})`,
|
||||
'zoom-out': `scaleX(${type ? 1 : 1.2}) scaleY(${type ? 1 : 1.2})`
|
||||
}
|
||||
},
|
||||
// 内置动画类型与实际动画对应字典
|
||||
animationMode() {
|
||||
return {
|
||||
fade: 'opacity',
|
||||
'slide-top': 'translateY',
|
||||
'slide-right': 'translateX',
|
||||
'slide-bottom': 'translateY',
|
||||
'slide-left': 'translateX',
|
||||
'zoom-in': 'scale',
|
||||
'zoom-out': 'scale'
|
||||
}
|
||||
},
|
||||
// 驼峰转中横线
|
||||
toLine(name) {
|
||||
return name.replace(/([A-Z])/g, '-$1').toLowerCase()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,456 +0,0 @@
|
||||
<!-- 步进器 -->
|
||||
<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>
|
||||
21
CoreCms.Net.Uni-App/CoreShop/config/env.js
Normal file
21
CoreCms.Net.Uni-App/CoreShop/config/env.js
Normal file
@@ -0,0 +1,21 @@
|
||||
// 不同的环境变量配置
|
||||
const development = {
|
||||
requestBaseUrl: 'https://api.test.pro.coreshop.cn',
|
||||
appid: '',
|
||||
}
|
||||
|
||||
const test = {
|
||||
requestBaseUrl: 'https://api.test.pro.coreshop.cn',
|
||||
appid: '',
|
||||
}
|
||||
|
||||
const production = {
|
||||
requestBaseUrl: 'https://api.test.pro.coreshop.cn',
|
||||
appid: '',
|
||||
}
|
||||
|
||||
export default {
|
||||
development,
|
||||
test,
|
||||
production
|
||||
}
|
||||
86
CoreCms.Net.Uni-App/CoreShop/core/api/activity.ts
Normal file
86
CoreCms.Net.Uni-App/CoreShop/core/api/activity.ts
Normal file
@@ -0,0 +1,86 @@
|
||||
import { post } from '@/core/utils/http';
|
||||
import { Response, AdvertPositionType, PinTuanListType } from '@/core/models';
|
||||
|
||||
/** 获取商品分类配置 */
|
||||
export const queryPositionList = (data : { code : string, platform : number }) : Promise<Response<AdvertPositionType>> => {
|
||||
return post('Api/Advert/GetPositionList', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取拼团列表 */
|
||||
export const queryPinTuanList = (data : any) : Promise<Response<Array<PinTuanListType>>> => {
|
||||
return post('Api/PinTuan/GetList', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取拼团商品详情 */
|
||||
export const queryPinTuanGoodsDetail = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/PinTuan/GetGoodsInfo', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取服务详情 */
|
||||
export const queryServiceDetail = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Service/GetDetails', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取活动详情 */
|
||||
export const queryActivityList = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Group/GetList', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取秒杀团购详情 */
|
||||
export const queryActivityDetial = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Group/GetGoodsDetial', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取接龙列表 */
|
||||
export const querySolitaireList = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Solitaire/GetList', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取接龙详情 */
|
||||
export const querySolitaireDetail = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Solitaire/GetDetail', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取表单列表 */
|
||||
export const queryFormList = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Form/GetList', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取表单详情 */
|
||||
export const queryFormDetial = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Form/GetFormDetial', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交表单 */
|
||||
export const queryAddSubmit = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Form/AddSubmit', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 生成服务购买订单 */
|
||||
export const queryAddServiceOrder = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Service/AddServiceOrder', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
37
CoreCms.Net.Uni-App/CoreShop/core/api/address.ts
Normal file
37
CoreCms.Net.Uni-App/CoreShop/core/api/address.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { post } from '@/core/utils/http';
|
||||
import { Response, AddressType, CityAddressType } from '@/core/models';
|
||||
|
||||
/** 获取用户默认收货地址 */
|
||||
export const queryUserDefaultShip = () : Promise<Response<AddressType>> => {
|
||||
return post('Api/User/GetUserDefaultShip', {}, true);
|
||||
}
|
||||
|
||||
/** 获取用户的收货地址列表 */
|
||||
export const queryUserShip = () : Promise<Response<Array<AddressType>>> => {
|
||||
return post('Api/User/GetUserShip', {}, true);
|
||||
}
|
||||
|
||||
/** 获取省市区 */
|
||||
export const queryAreas = () : Promise<Response<Array<CityAddressType>>> => {
|
||||
return post('Api/Common/GetAreas', {});
|
||||
}
|
||||
|
||||
/** 获取区域ID */
|
||||
export const queryAreaId = (data : any) : Promise<Response<number>> => {
|
||||
return post('Api/User/GetAreaId', { data, });
|
||||
}
|
||||
|
||||
/** 存储用户收货地址 */
|
||||
export const querySaveUserShip = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/SaveUserShip', { data, }, true);
|
||||
}
|
||||
|
||||
/** 收货地址删除 */
|
||||
export const queryRemoveShip = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/RemoveShip', { data, }, true);
|
||||
}
|
||||
|
||||
/** 获取收货地址详情 */
|
||||
export const queryShipDetail = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/GetShipDetail', { data, }, true);
|
||||
}
|
||||
30
CoreCms.Net.Uni-App/CoreShop/core/api/afterSales.ts
Normal file
30
CoreCms.Net.Uni-App/CoreShop/core/api/afterSales.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { post } from '@/core/utils/http';
|
||||
import { Response } from '@/core/models';
|
||||
|
||||
/** 获取售后单列表 */
|
||||
export const queryAftersalesList = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Order/AftersalesList', {
|
||||
data,
|
||||
}, true)
|
||||
}
|
||||
|
||||
/** 获取售后单详情 */
|
||||
export const queryAftersalesInfo = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Order/Aftersalesinfo', {
|
||||
data,
|
||||
}, true)
|
||||
}
|
||||
|
||||
/** 用户发送退货包裹 */
|
||||
export const querySendReship = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Order/SendReship', {
|
||||
data,
|
||||
}, true)
|
||||
}
|
||||
|
||||
/** 提交售后单 */
|
||||
export const queryAddAftersales = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Order/AddAftersales', {
|
||||
data,
|
||||
}, true)
|
||||
}
|
||||
72
CoreCms.Net.Uni-App/CoreShop/core/api/agent.ts
Normal file
72
CoreCms.Net.Uni-App/CoreShop/core/api/agent.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import { post } from '@/core/utils/http';
|
||||
import { Response } from '@/core/models';
|
||||
|
||||
/** 获取代理商进度状态 */
|
||||
export const queryAgentInfo = (data ?: any) : Promise<Response<any>> => {
|
||||
return post('Api/Agent/Info', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 申请代理商 */
|
||||
export const queryApplyAgent = (data ?: any) : Promise<Response<any>> => {
|
||||
return post('Api/Agent/ApplyAgent', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 代理团队统计 */
|
||||
export const queryAgentTeamSum = (data ?: any) : Promise<Response<any>> => {
|
||||
return post('Api/Agent/GetTeamSum', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 代理订单统计 */
|
||||
export const queryAgentOrderSum = (data ?: any) : Promise<Response<any>> => {
|
||||
return post('Api/Agent/GetOrderSum', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 我的代理订单 */
|
||||
export const queryAgentMyOrder = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Agent/MyOrder', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取代理池商品数据 */
|
||||
export const queryAgentGoodsPageList = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Agent/GetGoodsPageList', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取店铺信息 */
|
||||
export const queryAgentStoreInfot = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Agent/GetStoreInfo', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 店铺设置 */
|
||||
export const queryAgentSetStore = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Agent/SetStore', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取代理商排行 */
|
||||
export const queryAgentRanking = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Agent/GetAgentRanking', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 搜索获取门店订单列表 */
|
||||
export const queryOrderPageByMerchantSearch = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Store/GetOrderPageByMerchantSearch', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
38
CoreCms.Net.Uni-App/CoreShop/core/api/article.ts
Normal file
38
CoreCms.Net.Uni-App/CoreShop/core/api/article.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { post } from '@/core/utils/http';
|
||||
import { Response, NoticeType, ArticleClassifyType } from '@/core/models';
|
||||
|
||||
/** 获取文章分类 */
|
||||
export const queryArticleClassify = () : Promise<Response<Array<ArticleClassifyType>>> => {
|
||||
return post('Api/Article/GetArticleClassify', {});
|
||||
}
|
||||
|
||||
/** 获取文章列表 */
|
||||
export const queryArticleList = (data : any) : Promise<Response<Array<any>>> => {
|
||||
return post('Api/Article/GetArticleList', { data, });
|
||||
}
|
||||
|
||||
/** 获取文章详情 */
|
||||
export const queryArticleDetail = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Article/GetArticleDetail', { data, });
|
||||
}
|
||||
|
||||
/** 获取公告列表 */
|
||||
export const queryNoticeList = (data : any) : Promise<Response<Array<NoticeType>>> => {
|
||||
return post('Api/Notice/NoticeList', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取公告详情 */
|
||||
export const queryNoticeInfo = (data : any) : Promise<Response<NoticeType>> => {
|
||||
return post('Api/Notice/NoticeInfo', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取图文消息 */
|
||||
export const queryMessageDetil = (data : any) : Promise<Response<NoticeType>> => {
|
||||
return post('Api/Articles/GetWeChatMessage', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
52
CoreCms.Net.Uni-App/CoreShop/core/api/balance.ts
Normal file
52
CoreCms.Net.Uni-App/CoreShop/core/api/balance.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import { post } from '@/core/utils/http';
|
||||
import { Response, BankCardType, BalanceDetailType, CashType } from '@/core/models';
|
||||
|
||||
/** 充值规则列表 */
|
||||
export const queryTopUpTypeList = () : Promise<Response<any>> => {
|
||||
return post('Api/TopUp/TypeList', {}, true);
|
||||
}
|
||||
|
||||
/** 获取默认的银行卡 */
|
||||
export const queryDefaultBankCard = () : Promise<Response<BankCardType>> => {
|
||||
return post('Api/User/GetDefaultBankCard', {}, true);
|
||||
}
|
||||
|
||||
/** 去体现 */
|
||||
export const queryUserToCash = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/Cash', { data, }, true);
|
||||
}
|
||||
|
||||
/** 获取我的银行卡列表 */
|
||||
export const queryMyBankcardsList = () : Promise<Response<Array<BankCardType>>> => {
|
||||
return post('Api/User/GetMyBankcardsList', {}, true);
|
||||
}
|
||||
|
||||
/** 获取银行卡组织信息 */
|
||||
export const queryBankCardsOrganization = (data : any) : Promise<Response<Array<BankCardType>>> => {
|
||||
return post('Api/User/GetBankCardsOrganization', { data, }, true);
|
||||
}
|
||||
|
||||
/** 添加银行卡 */
|
||||
export const queryAddBankCards = (data : any) : Promise<Response<Array<BankCardType>>> => {
|
||||
return post('Api/User/AddBankCards', { data, }, true);
|
||||
}
|
||||
|
||||
/** 设置默认银行卡 */
|
||||
export const querySetDefaultBankCard = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/SetDefaultBankCard', { data, }, true);
|
||||
}
|
||||
|
||||
/** 删除银行卡 */
|
||||
export const queryRemovebankcard = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/Removebankcard', { data, }, true);
|
||||
}
|
||||
|
||||
/** 获取用户余额明细 */
|
||||
export const queryUserBalance = (data : any) : Promise<Response<Array<BalanceDetailType>>> => {
|
||||
return post('Api/User/UserBalance', { data, }, true);
|
||||
}
|
||||
|
||||
/** 用户提现列表 */
|
||||
export const queryCashList = (data : any) : Promise<Response<Array<CashType>>> => {
|
||||
return post('Api/User/CashList', { data, }, true);
|
||||
}
|
||||
54
CoreCms.Net.Uni-App/CoreShop/core/api/cart.ts
Normal file
54
CoreCms.Net.Uni-App/CoreShop/core/api/cart.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import { post } from '@/core/utils/http';
|
||||
import { Response } from '@/core/models';
|
||||
|
||||
/** 获取购物车列表 */
|
||||
export const queryCartList = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Cart/GetList', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 单个商品删除 */
|
||||
export const deleteGoodsSingle = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Cart/DoDelete', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 多个商品删除 */
|
||||
export const deleteGoodsSome = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Cart/DoDeleteByIds', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取购物车数量和商品总价格 */
|
||||
export const queryCartNumAndMoney = () : Promise<Response<{ count : number, money : number }>> => {
|
||||
return post('Api/User/GetCartNumberAndMoney', {}, true);
|
||||
}
|
||||
|
||||
/** 添加购物车 */
|
||||
export const queryAddCart = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Cart/AddCart', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取购物车数量 */
|
||||
export const queryCartNum = () : Promise<Response<number>> => {
|
||||
return post('Api/User/GetCartNumber', {}, true);
|
||||
}
|
||||
|
||||
/** 根据购物车已有数据获取能够使用的优惠券 */
|
||||
export const queryCartCoupon = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Cart/GetCartAvailableCoupon', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 移除购物车 */
|
||||
export const queryRemoveCart = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Cart/DoDelete', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
21
CoreCms.Net.Uni-App/CoreShop/core/api/checkIn.ts
Normal file
21
CoreCms.Net.Uni-App/CoreShop/core/api/checkIn.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { post } from '@/core/utils/http';
|
||||
import { Response } from '@/core/models';
|
||||
|
||||
/** 获取用户按月签到数据 */
|
||||
export const queryUserCheckByMonth = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/CheckIn/GetUserCheckByMonth', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取用户总签到次数 */
|
||||
export const queryUserCheckCount = () : Promise<Response<number>> => {
|
||||
return post('Api/CheckIn/GetUserCheckCount', {}, true);
|
||||
}
|
||||
|
||||
/** 签到接口 */
|
||||
export const queryUserCheckIn = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/CheckIn/DoUserCheckIn', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
54
CoreCms.Net.Uni-App/CoreShop/core/api/distribution.ts
Normal file
54
CoreCms.Net.Uni-App/CoreShop/core/api/distribution.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import { post } from '@/core/utils/http';
|
||||
import { Response } from '@/core/models';
|
||||
|
||||
/** 获取分销商进度状态 */
|
||||
export const queryDistributionInfo = (data ?: any) : Promise<Response<any>> => {
|
||||
return post('Api/Distribution/Info', { data, }, true);
|
||||
}
|
||||
|
||||
/** 申请分销商 */
|
||||
export const queryApplyDistribution = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Distribution/ApplyDistribution', { data, }, true);
|
||||
}
|
||||
|
||||
/** 分销团队统计 */
|
||||
export const queryTeamSum = () : Promise<Response<any>> => {
|
||||
return post('Api/Distribution/GetTeamSum', {}, true);
|
||||
}
|
||||
|
||||
/** 获取店铺信息 */
|
||||
export const queryDistributionStoreInfo = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Distribution/GetStoreInfo', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取我的上级邀请人 */
|
||||
export const queryDistributionMyInvite = () : Promise<Response<any>> => {
|
||||
return post('Api/User/GetMyInvite', {}, true);
|
||||
}
|
||||
|
||||
/** 用户推荐列表 */
|
||||
export const queryDistributionRecommend = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/Recommend', { data, }, true);
|
||||
}
|
||||
|
||||
/** 我的分销订单 */
|
||||
export const queryDistributionOrder = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Distribution/MyOrder', { data, }, true);
|
||||
}
|
||||
|
||||
/** 分销订单统计 */
|
||||
export const queryDistributionOrderSum = () : Promise<Response<any>> => {
|
||||
return post('Api/Distribution/GetOrderSum', {}, true);
|
||||
}
|
||||
|
||||
/** 获取分销商排行 */
|
||||
export const queryDistributionRanking = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Distribution/getDistributionRanking', { data, }, true);
|
||||
}
|
||||
|
||||
/** 店铺设置 */
|
||||
export const querySetStore = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Distribution/SetStore', { data, }, true);
|
||||
}
|
||||
7
CoreCms.Net.Uni-App/CoreShop/core/api/file.ts
Normal file
7
CoreCms.Net.Uni-App/CoreShop/core/api/file.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { uploadFile } from '@/core/utils/http';
|
||||
import { Response } from '@/core/models';
|
||||
|
||||
/** 获取商品分类配置 */
|
||||
export const queryUploadImages = (file : any) : Promise<Response<any>> => {
|
||||
return uploadFile('api/Common/UploadImages', file);
|
||||
}
|
||||
75
CoreCms.Net.Uni-App/CoreShop/core/api/goods.ts
Normal file
75
CoreCms.Net.Uni-App/CoreShop/core/api/goods.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import { post } from '@/core/utils/http';
|
||||
import { Response, GoodsListType, CategoriesType, GoodsPictureType, GoodsParamsType, ServiceGoodsType } from '@/core/models';
|
||||
|
||||
/** 获取商品分类配置 */
|
||||
export const queryAllCategories = () : Promise<Response<Array<CategoriesType>>> => {
|
||||
return post('Api/Good/GetAllCategories');
|
||||
}
|
||||
|
||||
/** 获取商品列表数据 */
|
||||
export const queryGoodsPageList = (data : any) : Promise<Response<GoodsListType>> => {
|
||||
return post('Api/Good/GetGoodsPageList', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 普通获取商品详情 */
|
||||
export const queryGoodsDetail = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Good/GetDetial', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取为您推荐商品 */
|
||||
export const queryGoodsRecommendList = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Good/GetGoodsRecommendList', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 带token获取商品详情 */
|
||||
export const queryGoodsDetailByToken = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Good/GetDetialByToken', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 商品关键词说明,例如常见问题等 */
|
||||
export const queryServiceDescriptionl = () : Promise<Response<any>> => {
|
||||
return post('Api/Common/GetServiceDescription');
|
||||
}
|
||||
|
||||
/** 获取商品评价 */
|
||||
export const queryGoodsComment = (data : any) : Promise<Response<GoodsPictureType>> => {
|
||||
return post('Api/Good/GetGoodsComment', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取商品参数 */
|
||||
export const queryGoodsParams = (data : any) : Promise<Response<Array<GoodsParamsType>>> => {
|
||||
return post('Api/Good/GetGoodsParams', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取商品促销列表 */
|
||||
export const queryPromotionList = (data : any) : Promise<Response<Array<any>>> => {
|
||||
return post('Api/Promotion/GetPromotionList', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取服务商品列表 */
|
||||
export const queryServicelist = (data : any) : Promise<Response<Array<ServiceGoodsType>>> => {
|
||||
return post('Api/Service/GetPageList', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 添加商品浏览足迹 */
|
||||
export const queryAddGoodsBrowsing = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/AddGoodsBrowsing', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
26
CoreCms.Net.Uni-App/CoreShop/core/api/home.ts
Normal file
26
CoreCms.Net.Uni-App/CoreShop/core/api/home.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { post } from '@/core/utils/http';
|
||||
import { Response, ShopConfigType, PageConfigType, RecordType } from '@/core/models';
|
||||
|
||||
/** 获取项目配置 */
|
||||
export const queryShopConfigV2 = () : Promise<Response<ShopConfigType>> => {
|
||||
return post('Api/Common/GetConfigV2');
|
||||
}
|
||||
|
||||
/** 查询首页配置 */
|
||||
export const queryPageConfig = (data : { code : string }) : Promise<Response<PageConfigType>> => {
|
||||
return post('Api/Page/GetPageConfig', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取日志 */
|
||||
export const queryRecord = (data : any) : Promise<Response<RecordType>> => {
|
||||
return post('Api/Page/GetRecord', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取订阅模板 */
|
||||
export const getSubscriptionTmplIds = () : Promise<Response<any>> => {
|
||||
return post('Api/WeChatAppletsMessage/Tmpl', {}, true);
|
||||
}
|
||||
38
CoreCms.Net.Uni-App/CoreShop/core/api/index.ts
Normal file
38
CoreCms.Net.Uni-App/CoreShop/core/api/index.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
/** 首页 */
|
||||
export * from './home';
|
||||
/** 商品 */
|
||||
export * from './goods';
|
||||
/** 活动 */
|
||||
export * from './activity';
|
||||
/** 购物车 */
|
||||
export * from './cart';
|
||||
/** 个人中心 */
|
||||
export * from './member';
|
||||
/** 登录 */
|
||||
export * from './login';
|
||||
/** 订单 */
|
||||
export * from './order';
|
||||
/** 地址 */
|
||||
export * from './address';
|
||||
/** 支付 */
|
||||
export * from './pay';
|
||||
/** 售后 */
|
||||
export * from './afterSales';
|
||||
/** 文件 */
|
||||
export * from './file';
|
||||
/** 邀请分享 */
|
||||
export * from './shareInvite';
|
||||
/** 门店地图 */
|
||||
export * from './storeMap';
|
||||
/** 文章 */
|
||||
export * from './article';
|
||||
/** 签到 */
|
||||
export * from './checkIn';
|
||||
/** 分销 */
|
||||
export * from './distribution';
|
||||
/** 代理 */
|
||||
export * from './agent';
|
||||
/** 关于余额模块 */
|
||||
export * from './balance';
|
||||
/** 商家管理 */
|
||||
export * from './merchant';
|
||||
37
CoreCms.Net.Uni-App/CoreShop/core/api/login.ts
Normal file
37
CoreCms.Net.Uni-App/CoreShop/core/api/login.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { post } from '@/core/utils/http';
|
||||
import { Response } from '@/core/models';
|
||||
|
||||
/** 获取商品分类配置 */
|
||||
export const queryLoginPhoneNumber = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/DecryptPhoneNumber', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 小程序解析code */
|
||||
export const queryLogin = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/OnLogin', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 支付宝解析code */
|
||||
export const queryAliPayAppAuthTokenBYCode = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/AliPayAuth/getAliPayAppAuthTokenBYCode', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 发送短信验证码 */
|
||||
export const sendSms = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/SendSms', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 短信验证码登录 */
|
||||
export const smsLogin = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/smsLogin', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
127
CoreCms.Net.Uni-App/CoreShop/core/api/member.ts
Normal file
127
CoreCms.Net.Uni-App/CoreShop/core/api/member.ts
Normal file
@@ -0,0 +1,127 @@
|
||||
import { post } from '@/core/utils/http';
|
||||
import { Response, UserInfoType, GoodsFootprintType } from '@/core/models';
|
||||
|
||||
/** 上传头像 */
|
||||
export const queryChangeAvatar = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/ChangeAvatar', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 编辑用户信息 */
|
||||
export const queryEditInfo = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/EditInfo', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 用户修改密码 */
|
||||
export const queryEditPwd = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/EditPwd', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取订单数量 */
|
||||
export const queryOrderStatusNum = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Order/GetOrderStatusNum', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取用户信息 */
|
||||
export const queryUserInfo = () : Promise<Response<UserInfoType>> => {
|
||||
return post('Api/User/GetUserInfo', {}, true);
|
||||
}
|
||||
|
||||
/** 判断用户是否是门店人员 */
|
||||
export const queryUserIsClerk = () : Promise<Response<any>> => {
|
||||
return post('Api/Store/IsClerk', {}, true);
|
||||
}
|
||||
|
||||
/** 获取商品浏览足迹 */
|
||||
export const queryGoodsBrowsing = (data : any) : Promise<Response<{
|
||||
count : number;
|
||||
list : Array<GoodsFootprintType>
|
||||
}>> => {
|
||||
return post('Api/User/Goodsbrowsing', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取商品收藏关注列表 */
|
||||
export const queryGoodscollectionList = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/GoodscollectionList', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 商品收藏 关注/取消 */
|
||||
export const queryGoodsCollection = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/GoodsCollectionCreateOrDelete', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 用户已领取的优惠券列表 */
|
||||
export const queryUserCoupon = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Coupon/UserCoupon', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 优惠券列表 */
|
||||
export const queryCouponList = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Coupon/CouponList', {
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 用户领取优惠券 */
|
||||
export const queryReceiveCoupon = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Coupon/GetCoupon', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取我的发票列表 */
|
||||
export const queryUserInvoiceList = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/UserInvoiceList', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 积分记录 */
|
||||
export const queryUserPointLog = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/UserPointLog', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 发票模糊查询 */
|
||||
export const queryTaxInfo = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Order/GetTaxCode', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取个人服务订单列表 */
|
||||
export const queryServicesPageList = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/GetServicesPageList', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取单个服务订单 */
|
||||
export const queryServicesById = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/GetServicesById', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取单个服务订单下面服务券 */
|
||||
export const queryServicesTickets = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/GetServicesTickets', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
87
CoreCms.Net.Uni-App/CoreShop/core/api/merchant.ts
Normal file
87
CoreCms.Net.Uni-App/CoreShop/core/api/merchant.ts
Normal file
@@ -0,0 +1,87 @@
|
||||
import { post } from '@/core/utils/http';
|
||||
import { Response } from '@/core/models';
|
||||
|
||||
/** 根据用户序列获取门店数据 */
|
||||
export const queryStoreByUserId = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Store/GetStoreByUserId', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取门店订单列表 */
|
||||
export const queryOrderPageByMerchant = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Store/GetOrderPageByMerchant', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取单个用户能管理的门店列表 */
|
||||
export const queryStoreListForUser = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Store/GetStoreListForUser', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取店铺提货单列表 */
|
||||
export const queryStoreLadingList = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Store/StoreLadingList', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 提货单删除 */
|
||||
export const queryLadingDelete = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Store/LadingDelete', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取提货单详情 */
|
||||
export const queryLadingInfo = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Store/LadingInfo', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 店铺提单核销操作 */
|
||||
export const queryLading = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Store/Lading', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
|
||||
/** 判断是否是店员 */
|
||||
export const queryIsClerk = (data ?: any) : Promise<Response<any>> => {
|
||||
return post('Api/Store/IsClerk', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 门店核销的服务券列表 */
|
||||
export const queryVerificationPageList = (data ?: any) : Promise<Response<any>> => {
|
||||
return post('Api/Service/VerificationPageList', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 删除核销券 */
|
||||
export const queryLogDelete = (data ?: any) : Promise<Response<any>> => {
|
||||
return post('Api/Service/LogDelete', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取服务券详情准备核销 */
|
||||
export const queryServiceVerificationTicketInfo = (data ?: any) : Promise<Response<any>> => {
|
||||
return post('Api/Service/GetTicketInfo', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 核销服务券 */
|
||||
export const queryVerificationTicket = (data ?: any) : Promise<Response<any>> => {
|
||||
return post('Api/Service/VerificationTicket', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
93
CoreCms.Net.Uni-App/CoreShop/core/api/order.ts
Normal file
93
CoreCms.Net.Uni-App/CoreShop/core/api/order.ts
Normal file
@@ -0,0 +1,93 @@
|
||||
import { post } from '@/core/utils/http';
|
||||
import { Response } from '@/core/models';
|
||||
|
||||
/** 获取不同类型营销下单支持的配送方式 */
|
||||
export const queryOrderDistributionModel = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Order/GetOrderDistributionModel', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取全部订单列表 */
|
||||
export const queryOrderList = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Order/GetOrderList', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 根据订单编号获取当前订单的支付信息 */
|
||||
export const queryOrderPayInfo = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Order/GetOrderPayInfo', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 确认收货 */
|
||||
export const queryOrderConfirm = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Order/OrderConfirm', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 查询当前订单是否接入微信发货信息管理 */
|
||||
export const queryOrderShippingList = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Order/OrderShippingList', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取订单详情 */
|
||||
export const queryOrderDetails = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Order/OrderDetails', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 取消订单 */
|
||||
export const queryCancelOrder = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Order/CancelOrder', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 订单评价接口 */
|
||||
export const submitOrderEvaluate = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/OrderEvaluate', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 判断用户下单可以使用多少积分 */
|
||||
export const queryUserPoint = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/GetUserPoint', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 根据订单id取拼团信息,用在订单详情页 */
|
||||
export const queryOrderPinTuanTeamInfo = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/PinTuan/GetPinTuanTeam', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 获取发票是否开具 */
|
||||
export const queryCheckInvoice = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Order/CheckInvoice', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 提交发票申请 */
|
||||
export const querySubmitInvoiceApply = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Order/SubmitInvoiceApply', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
|
||||
/** 物流信息接口 */
|
||||
export const queryLogisticsByApi = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Order/LogisticsByApi', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
32
CoreCms.Net.Uni-App/CoreShop/core/api/pay.ts
Normal file
32
CoreCms.Net.Uni-App/CoreShop/core/api/pay.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { post } from '@/core/utils/http';
|
||||
import { Response, PayMethodListType } from '@/core/models';
|
||||
|
||||
/** 获取不同类型营销下单支持的配送方式 */
|
||||
export const queryPayMethodList = () : Promise<Response<Array<PayMethodListType>>> => {
|
||||
return post('Api/Payments/GetList', {}, true);
|
||||
}
|
||||
|
||||
/** 生成订单 */
|
||||
export const queryCreateOrder = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Order/CreateOrder', { data, }, true);
|
||||
}
|
||||
|
||||
/** 获取支付信息 */
|
||||
export const queryPaymentsCheckpay = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Payments/CheckPay', { data, }, true);
|
||||
}
|
||||
|
||||
/** 获取单个充值规则 */
|
||||
export const queryTypeDetail = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/TopUp/getTypeDetail', { data, });
|
||||
}
|
||||
|
||||
/** 支付接口 */
|
||||
export const queryPay = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/Pay', { data, }, true);
|
||||
}
|
||||
|
||||
/** 获取支付单详情 */
|
||||
export const queryPaymentInfo = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Payments/GetInfo', { data, }, true);
|
||||
}
|
||||
24
CoreCms.Net.Uni-App/CoreShop/core/api/shareInvite.ts
Normal file
24
CoreCms.Net.Uni-App/CoreShop/core/api/shareInvite.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { post } from '@/core/utils/http';
|
||||
import { Response } from '@/core/models';
|
||||
|
||||
/** 统一分享 */
|
||||
export const queryShare = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/Share', { data, });
|
||||
}
|
||||
|
||||
/** 统一分享解码 */
|
||||
export const queryDeshare = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/deshare', { data, });
|
||||
}
|
||||
|
||||
/** 获取我的邀请信息 */
|
||||
export const queryMyInvite = () : Promise<Response<any>> => {
|
||||
return post('Api/User/MyInvite', {}, true);
|
||||
}
|
||||
|
||||
/** 设置我的上级邀请人 */
|
||||
export const setMyInvite = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/User/SetMyInvite', {
|
||||
data,
|
||||
}, true);
|
||||
}
|
||||
13
CoreCms.Net.Uni-App/CoreShop/core/api/storeMap.ts
Normal file
13
CoreCms.Net.Uni-App/CoreShop/core/api/storeMap.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { post } from '@/core/utils/http';
|
||||
import { Response, StoreListType } from '@/core/models';
|
||||
|
||||
/** 获取门店列表 */
|
||||
export const queryStoreList = (data : any) : Promise<Response<any>> => {
|
||||
return post('Api/Store/GetStoreList', { data, });
|
||||
}
|
||||
|
||||
|
||||
/** 获取默认的门店 */
|
||||
export const queryDefaultStore = () : Promise<Response<StoreListType>> => {
|
||||
return post('Api/Store/GetDefaultStore', {});
|
||||
}
|
||||
10
CoreCms.Net.Uni-App/CoreShop/core/consts/advertPosition.ts
Normal file
10
CoreCms.Net.Uni-App/CoreShop/core/consts/advertPosition.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
/**
|
||||
* 广告位置编码:设置的时候需要和后台的广告位置列表中的位置编码一致
|
||||
*
|
||||
* goodsClassifyBanner 商品分类页面的广告位
|
||||
*/
|
||||
export const advertPosition = {
|
||||
/** 商品分类轮播图 */
|
||||
'goodsClassifyBanner': 'TplIndexBanner1'
|
||||
}
|
||||
9
CoreCms.Net.Uni-App/CoreShop/core/consts/config.ts
Normal file
9
CoreCms.Net.Uni-App/CoreShop/core/consts/config.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
// 项目静态资源请求地址, 通常使用cnd存放静态资源 参考 cdnFilesUrl
|
||||
// 例如 填写https://files.cdn.coreshop.cn 页面上图片路径则为 https://files.cdn.coreshop.cn/static/images/back.png
|
||||
export const FileHost : string = "";
|
||||
|
||||
/** 分享初始化地址 */
|
||||
export const shareUrl = 'pages/share/jump/jump';
|
||||
|
||||
/** cdn路径 */
|
||||
export const cdnFilesUrl = 'https://files.cdn.coreshop.cn';
|
||||
8
CoreCms.Net.Uni-App/CoreShop/core/consts/index.ts
Normal file
8
CoreCms.Net.Uni-App/CoreShop/core/consts/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/** 配置 */
|
||||
export * from './config';
|
||||
|
||||
/** 广告位 */
|
||||
export * from './advertPosition';
|
||||
|
||||
/** 本地缓存 */
|
||||
export * from './storage';
|
||||
20
CoreCms.Net.Uni-App/CoreShop/core/consts/storage.ts
Normal file
20
CoreCms.Net.Uni-App/CoreShop/core/consts/storage.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
/** 用户token */
|
||||
export const UserToken : string = "userToken";
|
||||
|
||||
/** 推荐码 */
|
||||
export const Invitecode : string = "invitecode";
|
||||
|
||||
/** 选择地址 */
|
||||
export const addressUserShip : string = "addressUserShip";
|
||||
|
||||
/** 选择地门店 */
|
||||
export const userStore : string = "userStore";
|
||||
|
||||
/** 使用发票 */
|
||||
export const userInvoice : string = "userInvoice";
|
||||
|
||||
/** 历史搜索 */
|
||||
export const historySearch : string = "historySearch";
|
||||
|
||||
/** 选择银行卡 */
|
||||
export const selectBankCard : string = "selectBankCard";
|
||||
20
CoreCms.Net.Uni-App/CoreShop/core/enum/activity.enum.ts
Normal file
20
CoreCms.Net.Uni-App/CoreShop/core/enum/activity.enum.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
/** 秒杀活动是否开始 */
|
||||
export enum IsStartSeckillEnum {
|
||||
/** 即将开始 */
|
||||
pending = 0,
|
||||
/** 开始 */
|
||||
start = 1,
|
||||
/** 结束 */
|
||||
end = 2,
|
||||
}
|
||||
|
||||
/** 团购活动是否开始 */
|
||||
export enum IsStartGroupPurchaseEnum {
|
||||
/** 即将开始 */
|
||||
pending = 0,
|
||||
/** 开始 */
|
||||
start = 1,
|
||||
/** 结束 */
|
||||
end = 2,
|
||||
}
|
||||
4
CoreCms.Net.Uni-App/CoreShop/core/enum/address.enum.ts
Normal file
4
CoreCms.Net.Uni-App/CoreShop/core/enum/address.enum.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export enum AddressPageTitltEnum {
|
||||
add = 'add',
|
||||
edit = 'edit'
|
||||
}
|
||||
36
CoreCms.Net.Uni-App/CoreShop/core/enum/aftersales.enum.ts
Normal file
36
CoreCms.Net.Uni-App/CoreShop/core/enum/aftersales.enum.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
/** 售后单类型 */
|
||||
export enum AftersalesTypeEnum {
|
||||
/** 未收货 */
|
||||
no = 1,
|
||||
/** 已收货 */
|
||||
yes = 2,
|
||||
}
|
||||
|
||||
export enum AftersalesStatusEnum {
|
||||
/** 待审核 **/
|
||||
pendingReview = 1,
|
||||
|
||||
/** 审核通过**/
|
||||
approvedReview = 2,
|
||||
|
||||
/** 审核拒绝*/
|
||||
rejectedReview = 3,
|
||||
}
|
||||
|
||||
/** 退款单状态 */
|
||||
export enum AftersalesBillRefundStatusEnum {
|
||||
/** 未退款 */
|
||||
error = 1,
|
||||
/** 退款成功 */
|
||||
success = 2,
|
||||
}
|
||||
|
||||
/** 退货单状态 */
|
||||
export enum AftersalesBillReshipStatusEnum {
|
||||
/** 待发退货 */
|
||||
awaiting = 1,
|
||||
/** 待收退货 */
|
||||
pending = 2,
|
||||
/** 已收退货 */
|
||||
received = 3,
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user