pull/1/head
阿怪 1 year ago
commit 60bf302119

@ -0,0 +1,168 @@
<script>
export default {
onLaunch: function() {
console.log('App Launch')
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style scoped lang="scss">
/*每个页面公共css */
.page-bg-gray{
background: rgb(248, 248, 248);
}
.page-box{
/* height: 100%;
overflow: scroll; */
min-height: 100%;
}
uni-page-body,page{
height: 100%;
}
page{
font-size: 28rpx;
}
.text-ellipsis-1{ /*超出部分省略号 单行*/
overflow:hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 1;
display: -webkit-box;
-webkit-box-orient: vertical;
/* min-height: 38rpx; */
}
.icon-custom{
width: 32rpx;
height: 32rpx;
}
.small-text{
color: gray !important;
font-size: 24rpx;
font-weight: 100 !important;
}
.bold-text{
font-weight: 600;
font-size: 36rpx;
}
.margin-line{
height: 20rpx;
width: 100%;
background-color: rgb(248, 248, 248);
}
.clearCss{
opacity: 0 !important;
}
.shim{/* 垫片 */
width: 100%;
height: 140rpx;
}
.big-text{
font-size: 80rpx;
/* font-weight: 600; */
}
.red-text{
color: red;
}
.line{
height: 2rpx;
width: 100%;
background-color: #e7e7e7;
}
.num-show{
position: absolute;
width: 40rpx;
height: 40rpx;
color: white;
background: #7cc4e8;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
top: -24rpx;
right: -10rpx;
border: 2rpx solid white;
}
/* 通用卡片样式 */
.u-card{
background-color: white;
.u-card-row:last-child{
border-bottom: unset;
}
.u-card-row{
padding: 40rpx;
border-bottom: 2rpx solid #e7e7e7;
.u-card-row-btn{
color: #086EC7;
}
.u-card-row-top,.u-card-row-content{
display: flex;
align-items: center;
justify-content: space-between;
}
.u-card-row-top{
padding-bottom: 40rpx;
.u-card-left{
}
.u-card-right{
.u-card-right-btn{
color:#7cc4e8
}
}
}
.u-card-row-content{
.u-card-left{
// width: 50%;
}
.u-card-right{
// width: 50%;
display: flex;
}
}
}
}
//
.popup-content{
padding-top: 40rpx;
background-color: white;
border-radius: 20rpx 20rpx 0 0;
overflow: scroll;
}
.small-btn-css{
background: #7CC4E8;
color: white;
padding: 6rpx 40rpx;
border-radius: 40rpx;
font-size: 28rpx;
white-space: nowrap;
margin-left: 10rpx;
position: relative;
}
.cancel-btn{
display: block;
margin-top: 20rpx;
.add-btn{
background: white !important;
color: black !important;
border: 2rpx solid #7cc4e8 !important;
}
}
.invalidCss{
background-color: #767676 !important;
}
:deep(){
.uni-popup__wrapper{
bottom: -34px;
}
.popup-content{
bottom: -34px;
padding-bottom: 34px;
background-color: white;
}
}
</style>

@ -0,0 +1,404 @@
import net from './request.js';
// import store from '../store';
const API = {
/*
首页信息
*/
getIndexInfo: data => net.GET('/api/index/index'), // 首页信息
getIndexBanner: data => net.GET('/api/banner/index',data), // 轮播图
getIndexNotice: data => net.GET('/api/news/notice'), // 公告
getGoodsDetail: data => net.GET('/api/goods/detail',data),// 商品详情(普通商品)
getSeckillGoodsDetail: data => net.GET('/api/seckill_goods/detail',data),// 商品详情(秒杀)
getGroupGoodsDetail: data => net.GET('/api/group_goods/detail',data),// 商品详情(团购)
getGoodsList: data => net.GET('/api/goods/lists',data),// 商品列表(普通商品)
getSeckillGoodsList: data => net.GET('/api/seckill_goods/lists',data),// 商品列表(限时)
getGroupGoodsList: data => net.GET('/api/group_goods/lists?page=&keyword=',data),// 商品列表(团购)
getNewinfo: data => net.GET('/api/goods/getGoodsSpec',data), // 根据商品规格更新数据
getCategoryList:data => net.GET('/api/goods_category/lists'), // 获取商品分类
getCategory:data => net.GET('/api/goods/category',data), // 根据分类Id获取分类商品
getCartList:data => net.GET('/api/cart/lists',data), // 获取购物车列表
addCart:data => net.POST('/api/cart/add',data), // 加入购物车
delCart:data => net.POST('/api/cart/delete',data), // 删除购物车
updateCart:data => net.POST('/api/cart/edit',data), // 更新购物车
login:data => net.POST('/api/user/wechatLogin',data), // 登录
login_test:data => net.GET('/api/user/testLogin?id=1'), // 登录 测试专用
zhuce:data => net.POST('/api/user/profile',data), // 注册
getOrderList:data => net.GET('/api/order/lists',data), //订单列表
getOrderGroupList:data => net.GET('/api/group_order/lists',data), //订单列表(团购)
getOrderSeckillList:data => net.GET('/api/seckill_order/lists',data), //订单列表(秒杀)
pay:data => net.POST('/api/order/pay',data), //支付
payGroup:data => net.POST('/api/group_order/pay',data), //支付(团购)
paySeckill:data => net.POST('/api/seckill_order/pay',data), //支付(秒杀)
refund:data => net.POST('/api/order/refund',data), //退款
getOrderInviteList:data => net.GET('/api/invite/order',data), //分销订单
getOrderBaseinfo:data => net.POST('/api/order/preview',data), //获取订单提交页面的基本信息
getOrderGroupBaseinfo:data => net.POST('/api/group_order/preview',data), //获取订单提交页面的基本信息(团购)
getOrderSeckillBaseinfo:data => net.POST('/api/seckill_order/preview',data), //获取订单提交页面的基本信息(秒杀)
getOrderCartinfo:data => net.POST('/api/order/cartPreview',data), //获取订单提交页面的基本信息(购物车来的)
getDelivery:data => net.GET('/api/index/delivery',data), //获取配送相关的选项(普通商品)
staffApply:data => net.POST('/api/invite/apply',data), //业务员申请
deliveryApply:data => net.POST('/api/staff/apply',data), //配送员申请
getDeliveryArea:data => net.GET('/api/staff/getDeliveryArea'), //获取配送区域
getAddressList:data => net.GET('/api/address/lists'), //地址列表
getAddDetail:data => net.GET('/api/address/detail',data), //地址详情
addAddress:data => net.POST('/api/address/add',data), //新增地址
editAddress:data => net.POST('/api/address/edit',data), //修改地址
delAddress:data => net.GET('/api/address/delete',data), //删除地址
getDefaultAddress:data => net.GET('/api/address/getDefault'), //获取默认地址
orderSubmitFunc:data => net.POST('/api/order/order',data), //提交订单(普通订单)
orderSubmitCartFunc:data => net.POST('/api/order/cartOrder',data), //提交订单(购物车)
orderSubmitGroupFunc:data => net.POST('/api/group_order/order',data), //提交订单(团购订单)
orderSubmitSeckillFunc:data => net.POST('/api/seckill_order/order',data), //提交订单(秒杀订单)
orderDetail:data => net.GET('/api/order/detail',data), //订单详情-普通订单 (顾客)
orderGroupDetail:data => net.GET('/api/group_order/detail',data), //订单详情-团购订单
orderSeckillDetail:data => net.GET('/api/seckill_order/detail',data), //订单详情-秒杀订单
orderStaffDetail:data => net.GET('/api/staff/orderDetail',data), //订单详情-配送订单
orderLeaderDetail:data => net.GET('/api/leader/orderDetail',data), //订单详情-管理员订单
orderCancel:data => net.POST('/api/order/cancle',data), //取消订单
orderCancelGroup:data => net.POST('/api/group_order/cancle',data), //取消订单 (团购)
orderCancelSeckill:data => net.POST('/api/seckill_order/cancle',data), //取消订单 (秒杀)
/*
用户相关
*/
getUserInfo:data => net.GET('/api/user/userInfo',data), //获取用户信息
updateUserInfo:data => net.POST('/api/user/profile',data), //更新用户信息
rechargeFunc:data => net.POST('/api/recharge/recharge',data), //充值
withdrawalFunc:data => net.POST('/api/withdrawl/submit',data), //提现
vipBuy:data => net.POST('/api/vip/order',data), //购买VIP
vipConfig:data => net.GET('/api/vip/config'), //会员说明
/*
优惠券
*/
getCouponsList:data => net.GET('/api/coupon/userCoupons',data), //优惠券
getCouponsCenterList:data => net.GET('/api/coupon/lists',data), //领券中心
couponsCenterReceive:data => net.POST('/api/coupon/receive',data), //领取优惠
getMyStars:data => net.GET('/api/collect/lists',data), //我的收藏
/*
推广中心
*/
inviteCenter:data => net.GET('/api/invite/index',data), //首页
inviteCenterwithdrawl:data => net.POST('/api/withdrawl/submit',data), //提现
inviteCenterwithdrawlDetail:data => net.GET('/api/invite/withdrawlDetail',data), //提现明细
inviteCenterwithdrawlRecodes:data => net.GET('/api/invite/record',data), //提现明细(佣金)
getShareQrcode:data => net.GET('/api/user/getShareQrcode'), //用户分销二维码
/*
配置相关
*/
getConfig:data => net.GET('/api/index/config'),
setDeliveryTime:data => net.POST('/api/staff/setDeliveryTime',data), // 设置配送时间
getDeliveryTime:data => net.GET('/api/staff/getDeliveryTime'), // 获取配送时间
getStaffOrder:data => net.GET('/api/staff/orderLists',data), // 获取订单管理列表(配送员)
getManageOrder:data => net.GET('/api/leader/orderLists',data), // 获取订单管理列表(团长)
deliveryPhoto:data => net.POST('/api/staff/deliveryPhoto',data), // 送达拍照
reveiceOrder:data => net.POST('/api/staff/reveiceOrder',data), // 接单
reveiceOrderOk:data => net.POST('/api/leader/assignOrder',data), // 派单
getStaffList:data => net.GET('/api/leader/staffList'), // 配送员列表
goodsBuyFunc:data => net.POST('/api/leader/goodsBuy',data), // 商品申购
getRecordList:data => net.GET('/api/leader/recordList',data), // 货物入库
/**
*
* 登录类信息
*
*/
// 检查更新
getUpdateVersion:data => net.GET('/api/v1/index/version'),
// 获取定位
getLocationInfo:data => net.GET('/api/v1/index/ip',data),
// 验证码登陆
codeLogin: data => net.POST('/code/login', data),
// H5扫码登录邀请接口
inviteLogin: data => net.POST('/api/v1/invite/login', data),
// 发送手机验证码接口
sendVerifyCode: data => net.POST('/api/v1/sms/send', { send_type: 'student', ...data}),
// 注销账号
unRegister: data => net.POST('/api/v1/student/delete', data),
// 授权登录
accessLogin: (data, t = 'wx') => net.POST(`/api/v1/${t}/login`, data),
// 退出登录
logOut: data => net.POST('/api/v1/code/logout', data),
// 获取省份
getProvince: data => net.GET('/api/v1/colleges/getProvince', data),
// 根据学员所选择的教学点获取院校列表接口
collegesList: data => net.GET('/api/v1/colleges/list', data),
// 通过市反查省/自治区/直辖市
getProvinceByCity: data => net.GET('/api/v1/region/getProvinceByCity', data),
/**
*
* 用户信息
*
*/
// 学员个人信息接口
selectUserInfo: data => net.GET('/api/v1/student/info', data),
// 登录成功后填写学员信息接口
userUpdate: data => net.POST('/api/v1/student/update', data),
// 邀请二维码
qrcode: data => net.POST('/api/v1/student/invite/qrcode', data),
uploadBase64: data => net.POST('/api/v1/student/uploadBase64', data),
// 获取被邀请人列表接口
inviteList: data => net.GET('/api/v1/student/invite/list', data),
// 积分列表
scoreList: data => net.GET('/point', data),
// 余额明细
balanceList: data => net.POST('/api/v1/balance/detail/get/list', data),
// 模拟测试记录
recordList: data => net.GET('/api/v1/test-record/mock/examination/record', data),
// 练习题错误集详情
practiceList: data => net.GET('/api/v1/test-record/practice/list', data),
/**
*
* 首页数据
*
*/
// 首页配置获取
indexConfig: data => net.GET('/api/v1/index/config', data),
// 轮播
// indexBanner: data => net.GET('/app/banner', data),
indexBanner: data => net.POST('/api/v1/index/lbt', data),
// 获取咨询文章列表
// wzList: data => net.GET('/app/consult-wz', data),
wzList: data => net.POST('/api/v1/index/wz/list', data),
// 获取咨询文章
// wzInfo: id => net.GET(`/app/consult-wz/${id}`),
wzInfo: id => net.GET(`/api/v1/index/wz/${id}`),
// 获取课程分页
getCourseList: (data) => net.GET(`/app/course/page`,data),
// 获取推荐院校列表
// recommendwzList: data => net.GET('/app/academy', data),
recommendwzList: data => net.POST('/api/v1/index/academy/list', data),
// 获取推荐院校文章
// recommendwzInfo: id => net.GET(`/app/academy/${id}`),
recommendwzInfo: id => net.GET(`/api/v1/index/academy/${id}`),
// 推荐院校文章阅读量累计
// recomendaddReadNumber: data => net.PUT('/app/academy/num',data),
recomendaddReadNumber: data => net.POST('/api/v1/index/academy/add/num', data),
//获取考试大纲列表
syllabusList: data => net.POST('/api/v1/index/syllabus/list', data),
// 搜索
search: data => net.POST('/api/v1/index/search', data),
// 阅读量累计
addReadNumber: data => net.PUT('/app/consult-wz/num', data),
// 师资团队列表
lecturerList: data => net.GET('/api/v1/index/lecturer', data),
// 师资详情
lecturerDetail: id => net.GET(`/api/v1/index/lecturer/${id}`),
// 获取资料列表
indexMaterial: data => net.GET('/api/v1/index/material', data),
// indexMaterial: data => net.GET('/app/material', data),
// 获取资料详情
materialDetail: data => net.GET(`/api/v1/index/material/${data.id}`,{buyer_id:data.buyer_id}),
// 获取精品课程
indexBoutiqueCourse: data => net.GET('/api/v1/index/boutique/course', data),
// 获取精品课程详情
boutiqueCourseDetail: id => net.GET(`/api/v1/index/boutique/course/${id}`),
// 获取课程
courseList: data => net.POST('/api/v1/course/get', data),
// 获取套餐
comboList: data => net.POST('/api/v1/combo/course/get', data),
// courseList: data => net.GET('/app/course/page', data),
// 获取课程详情
courseDetail: (id, data) => net.GET(`/api/v1/course/${id}`, data),
// courseDetail: (id, data) => net.GET(`/app/course`, {id}),
// 获取线下课程
offlineCourseList: data => net.POST('/api/v1/offline/course/get', data),
// 获取线下课程详情
offlineCourseDetail: id => net.GET(`/api/v1/offline/course/${id}`),
// 获取套餐课程详情
getComboDetail: data => net.GET(`/api/v1/combo/course/${data.id}`,{buyer_id:data.buyer_id}),
// 获取直播课列表
// liveCourseList: data => net.GET('/api/v1/sys-course-live', data),
liveCourseList: data => net.GET('/api/v1/api-live-course', data),
// 直播课详情
viewCourse: (id, data) => net.GET('/api/v1/sys-course-live/'+id,{buyer_id:data.buyer_id}),
// 直播课详情 测试
viewCourse_test: (id, data) => net.GET('/api/v1/api-live-course/'+id,{buyer_id:data.buyer_id}),
/*题库 管理*/
//题库
getQuestionExercise:data => net.GET('/exercises', data),
// 科目
subjectList: data => net.GET('/api/v1/public/subject', data),
// subjectList: data => net.GET('/app/subject/list', data),
// 获取学员学习列表接口
learningList: data => net.GET('/api/v1/learning', data),
// 学习课程详情
learningDetail: data => net.GET(`/api/v1/learning/course/${data}`),
// 学习直播课程详情
learningLiveDetail: data => net.GET(`/api/v1/learning/course/live/${data}`),
// 学员学习计时接口
// "time_type": "stop" //计时类型 start-开始计时 stop-停止计时
studyDuration: data => net.POST('/api/v1/learning/course/duration', data),
// 学习统计API
courseStatistics: data => net.POST('/api/v1/learning/course/statistics', data),
// 题型分类
questionBankType: data => net.GET('/api/v1/questionBank/type', data),
// 网课、测试、题库详情
exercisesDetails: data => net.GET(`/api/v1/exercises/detail/${data}`),
// 测试练习题列表
testList: data => net.GET('/api/v1/exercises/test/list', data),
// 模拟试卷列表
examinationList: data => net.GET('/api/v1/examination/list', data),
// 获取题库、网课题目列表接口
exerciseSubjectList: data => net.GET('/api/v1/exercise/subject/list', data),
// 试题分类
exercisesType: data => net.GET('/api/v1/exercises/type', data),
// 模拟题详情
examinationDetail: id => net.GET(`/api/v1/examination/detail/${id}`),
// 开始答题
startTest: data => net.POST('/api/v1/exercises/start/answer', data),// question_bank_id
// 交卷
submitTest: data => net.POST('/api/v1/exercises/submit', data),
// 下一题
nextSubject: data => net.POST('/api/v1/exercises/next', data),
// 重新答题
againAnswer: data => net.POST('/api/v1/exercises/againAnswer', data),
// 答题成绩报告
scoreReport: data => net.GET('/api/v1/exercises/achievement/report', data),
// 获取团购列表
getGroupList: data => net.GET('/api/v1/group/page', data),
// 获取团购详情
getGroupPurchaseData: data => net.GET('/api/v1/group', data),
//发起拼团
starGroupPurchase:data => net.POST('/api/v1/group',data),
//加入拼团
joinGroupPurchase:data => net.POST('/api/v1/group/join',data),
/**
*
* 支付接口
*
*/
// 支付接口
wxOrAlipay: data => net.POST('/api/v1/pay', data),
// 获取openid
getOpenID: data => {
return uni.request({
url:'https://api.weixin.qq.com/sns/oauth2/access_token',
method:'GET',
// header: {
// ...header,
// ...headers
// },
data
})
},
// 余额支付
yuePay: data => net.POST('/api/v1/student/pay/balance', data),
//H5下单API
// v3_pay:data => net.POST('https://api.mch.weixin.qq.com/v3/pay/transactions/h5',data)
v3_pay:data => {
return uni.request({
url: 'https://api.mch.weixin.qq.com/v3/pay/transactions/h5',
method:'POST',
header: {
"Content-Type": "application/json",
},
data
})
},
//测试
pay_check:data => net.POST('/api/v1/wxpay/check',data),
pay_callback:data => net.POST('/api/v1/wxpay/callback',data),
/**
*
* 地址接口
*
*/
// 列表
addressList: data => net.POST('/api/v1/address', data), // student_id
// 新增/编辑
addressAction: data => net.POST(`/api/v1/address/add`, data),
editaddressAction: data => net.PUT(`/api/v1/address`, data),
// 删除
addressDelete: data => net.DELETE('/api/v1/address', data), // id
/**
*
* 购物车接口
*
*/
// 列表
cartList: data => net.POST('/api/v1/shopping/cart', data),
// 添加
cartAdd: data => net.POST('/api/v1/shopping/cart/add', data),
// 编辑
cartUpdate: data => net.POST('/api/v1/shopping/cart/update', data),
// 删除
cartDelete: data => net.POST('/api/v1/shopping/cart/delete', data), // id
/**
*
* 订单接口
*
*/
// 订单查询
orderList: data => net.POST('/api/v1/api-order/get/my/order/list', data),
// 确认收货
orderUpdate: data => net.POST('/api/v1/api-order/update/material/order', data),
// 删除
orderDelete: data => net.POST('/api/v1/api-order/delete/order', data),
/**
* 商品价格合计
* @param { order_count_list: [{ id: '', order_type: '', num: ''}] }
*
*/
orderCount: data => net.POST('/api/v1/api-order/order/count', data),
/**
* 资料在线课程的立即购买/购物车
* @param { goods: [{ id: '', order_type: '', num: ''}], student_id: '' }
*
*/
orderBuynow: data => net.POST('/api/v1/api-order/order/buynow', data),
// 新增资料订单
orderMaterialAdd: data => net.POST('/api/v1/api-order/add/material/order', data),
// 新增在线课程订单
orderOnlineAdd: data => net.POST('/api/v1/api-order/add/online/order', data),
// 直播课订单
orderLiveAdd: data => net.POST('/api/v1/api-order/add/live/order', data),
// 新增套餐课程订单
orderComboAdd: data => net.POST('/api/v1/api-order/add/combo/order', data),
// 新增线下订单==报名
orderOfflineAdd: data => net.POST('/api/v1/api-order/add/offline/order', data),
// 新增团购订单
orderGroupAdd: data => net.POST('/api/v1/api-order/add/group/order', data),
// 分享平台
shareProvider: () => net.getShareProvider(),
// 支付方式
paymentProvider: () => net.getPaymentProvider(),
// 物流查询
queryKuaidi: data => net.POST('/api/v1/kuaidi/poll/query', data),
// SHARE: () => net.SHARE(),
// 提现
transfer: data => net.POST('/api/v1/wxpay/transfer', data),
// 获取我的收藏分页列表
getStarList: data => net.POST('/api/v1/favorite/get', data),
// 取消收藏
cancelStar: data => net.DELETE('/api/v1/favorite',data),
//添加收藏
addStar:data => net.POST('/api/v1/favorite',data)
};
export default API

@ -0,0 +1,208 @@
import config from '../config'
// import store from '../store'
const loginUrl = 'pages/user/login';
export default {
REQUEST(url, method = 'GET', data, checkLogin = true, header) {
let token = uni.getStorageSync('access_token') || '';
const headers = {
"Content-Type": "application/json",
"Authorization": token,
"x-token": token,
"token":token,
// "X-Forwarded-For":'client_ip'
// 'Referer':'twzxjy.com'
}
var pages = getCurrentPages();
var page = pages[pages.length - 1];
return uni.request({
url: config.baseUrl + url,
method,
header: {
...header,
...headers
},
data
}).then(res => {
// console.log(res)
if (res.statusCode === 200 && res.data) {
if (res.data.code === 409) {
uni.showModal({
title:"提示",
content:"您的账号已在其他设备登录,已强制下线!",
confirmColor: '#006647',
showCancel: false,
success: (res) => {
if (res.confirm) {
uni.removeStorageSync('access_token');
uni.removeStorageSync('user_info');
if (checkLogin && page.route != loginUrl) {
uni.navigateTo({
url: '/' + loginUrl
});
}
}
}
});
return {
...res.data
}
}
if (res.data.code === 5) { // 用户认证失败
uni.removeStorageSync('access_token');
if(page.route != loginUrl && checkLogin) {
uni.navigateTo({
url: '/' + loginUrl
});
}
}
return res.data;
} else {
const reg = /abort/;
let code = 0;
let msg = (res[0] && res[0].errMsg) || '未知错误';
if ((res[0] && res[0].errMsg) && reg.test(res[0].errMsg)) {
msg = '网络请求中断'
}
return {
code,
msg,
data: null
}
}
}).catch(parmas => {
// console.log(params)
return parmas
//      return Promise.reject()
})
},
GET(url, body, checkLogin = true, header) {
return this.REQUEST(url, 'GET', body, checkLogin, header);
},
POST(url, body, checkLogin = true, header) {
return this.REQUEST(url, 'POST', body, checkLogin, header);
},
PUT(url, body, header) {
return this.REQUEST(url, 'PUT', body, header);
},
DELETE(url, body, header) {
return this.REQUEST(url, 'DELETE', body, header);
},
UPLOAD(data) {
return new Promise((resolve, reject) => {
let token = uni.getStorageSync('access_token') || '';
uni.uploadFile({
...data,
url: config.base_url + data.url,
header: {
"Access-Token": token
},
success(res) {
res.data = JSON.parse(res.data);
if (res.data.code === 401) {
uni.removeStorageSync('access_token');
uni.removeStorageSync('userInfo');
uni.navigateTo({
url: '/pages/login/login'
});
}
resolve(res);
},
fail(e) {
console.log(e);
reject(e)
},
});
});
},
getShareProvider: () => {
return uni.getProvider({
service: "share"
}).then(res => {
let data = []
for (let i = 0; i < res.provider.length; i++) {
switch (res.provider[i]) {
case 'weixin':
data.push({
name: '微信好友',
id: 'weixin',
icon: '/static/wx.png'
})
data.push({
name: '朋友圈',
id: 'weixin',
type: 'WXSenceTimeline',
icon: '/static/pyq.png'
})
break;
case 'qq':
data.push({
name: 'QQ好友',
id: 'qq',
icon: '/static/qq.png'
})
break;
default:
break;
}
}
return data;
}).catch(parmas => {
return Promise.reject()
});
},
getPaymentProvider: () => {
return uni.getProvider({
service: "payment"
}).then(res => {
let data = [];
const aliPay = {
name: '支付宝支付',
id: 'alipay',
icon: '/static/order/zfbp@3x.png'
};
const wxPay = {
name: '微信支付',
id: 'wxpay',
icon: '/static/order/wxp@3x.png'
};
const yuePay = {
name: '余额支付',
id: 'yepay',
icon: '/static/order/yep@3x.png'
}
for (let i = 0; i < res[1].provider.length; i++) {
switch (res[1].provider[i]) {
case 'alipay':
data.push({
...aliPay
})
break
case 'wxpay':
data.push({
...wxPay
})
break;
default:
break;
}
}
//#ifdef H5
return [aliPay, wxPay, yuePay];
//#endif
return [...data, yuePay];
}).catch(parmas => {
return Promise.reject()
});
}
}

BIN
components/.DS_Store vendored

Binary file not shown.

@ -0,0 +1,74 @@
<template>
<div class="skeleton animated">
<div class="skeleton-row" v-for="(item, index) in rowList" :style="item.style || {}" :key="index">
<div class="skeleton-row-item" v-for="(colItem, colIndex) in item.colItems"
:class="[colItem.childRowItems ? 'no-height' : '']" :key="colIndex" :style="colItem.style">
<template v-if="colItem.childRowItems">
<div class="skeleton-row-item" v-for="(childRowItem, childRowIndex) in colItem.childRowItems"
:key="childRowIndex" :style="childRowItem.style || {}"></div>
</template>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'Skeleton',
props: {
rowList: {
type: Array,
default: () => []
},
},
}
</script>
<style lang="scss" scoped>
.skeleton {
width: 100%;
--color: #F6F6F6;
&.animated {
animation: blink 1.2s ease-in-out infinite;
}
* {
box-sizing: border-box;
}
}
.skeleton-row {
display: flex;
width: 100%;
align-content: space-between;
}
.skeleton-row-item {
height: 26px;
border-radius: 12rpx;
display: inline-block;
&:not(.no-height) {
background: var(--color);
}
&.no-height {
height: auto;
}
}
@keyframes blink {
0% {
opacity: 1;
}
50% {
opacity: 0.6;
}
100% {
opacity: 1;
}
}
</style>

@ -0,0 +1,46 @@
<script setup>
//
import {watch,ref,reactive} from "vue"
// icons
import normal from "/static/default_icon.png"
import search_icon from "/static/default_search_icon.png"
// props
const props = defineProps(['type',"title","message"])
//
</script>
<template>
<view class="default-icon-box">
<view class="icon-box">
<image v-if="type=='search'" :src="search_icon" mode="widthFix"></image>
<image v-else :src="normal" mode="widthFix"></image>
</view>
<view class="text-box">
<view class="title-part">{{title?title:'暂无数据...'}}</view>
<view class="message-part empty-text">{{message?message:''}}</view>
</view>
</view>
</template>
<style scoped lang="scss">
.default-icon-box{
padding: 20rpx;
.icon-box{
text-align: center;
image{
width: 200rpx;
}
}
.text-box{
text-align: center;
margin-top: 20rpx;
font-size: 28rpx;
color:gray;
.title-part{
margin-bottom: 10rpx;
}
.message-part{
}
}
}
</style>

@ -0,0 +1,219 @@
<script setup>
import { ref} from "vue"
// typecategory- list
const props = defineProps(['info','type','list','title','buy_type']);
import goodsInfo from "@/components/goodsInfo.vue"
import goodsSpecs from "@/components/goodsSpecs.vue"
// import goodsCartPay from "@/components/goodsCartPay.vue"
import api from "@/api/index"
//
const detail_info = ref(null)
const show_state = ref(false)
// const isShow = ref(false)
//
function toDetail(item) { //
let url = ''
// if(props.buy_type == 'group') { //
// url = '/pages/goods/goodsDetail?info='+encodeURIComponent(JSON.stringify(item))+"&buy_type="+props.buy_type
// }
// else if(props.buy_type == 'limited'){ //
// }
// else{ //
// url = '/pages/goods/goodsDetail?info='+encodeURIComponent(JSON.stringify(item))+"&buy_type="+props.buy_type
// }
url = '/pages/goods/goodsDetail?id='+item.id+'&info='+encodeURIComponent(JSON.stringify(item))+"&buy_type="+props.buy_type
uni.navigateTo({
url
})
}
function toPlate() { //
let url = ''
// if(props.buy_type == 'group') { //
// url = "/pages/goods/goodsPlate?info="+JSON.stringify(props.info)
// }
// else{
// return
// }
url = "/pages/goods/goodsPlate?info="+encodeURIComponent(JSON.stringify(props.info))+"&buy_type="+props.buy_type
uni.navigateTo({
url
})
}
function addToCart(item) { //
getGoodsDetail(item.id)
return
// uni.showToast({
// title: '',
// icon:'success',
// duration: 2000,
// // mask:true
// });
}
async function getGoodsDetail(id) {//
const res = await api.getGoodsDetail({
id
})
if(res.code === 1) {
detail_info.value = res.data
detail_info.value = res.data
//
if(detail_info.value.goods_images) {
detail_info.value.goods_images = detail_info.value.goods_images.split(",")
detail_info.value.goods_images = detail_info.value.goods_images.map((item,i) => {
let o = {
image:item,
skip_url:'',
skip_url_type:2
}
return item = o
})
}
//
// console.log(detail_info.value)
show_state.value = !show_state.value
}
}
function afterChoose(params) { //
if(params.state === 1) {
// current_info.value.id
// getCartList() //
uni.showToast({
title: '已加入购物车!',
icon:'success',
duration: 2000,
// mask:true
});
// isShow.value = true
}
}
// function closedFunc() {
// isShow.value = false
// }
</script>
<template>
<view class="goods-card-box">
<!-- 展示分类 -->
<view class="category-box" v-if="type === 'category'">
<view class="gcb-title" style="justify-content: center;">
{{title}}
</view>
<view class="gcb-list">
<view class="gcb-list-card" v-for="(item,i) in list">
<!-- <img style="width:100%;border:1px solid #f1f1f1;border-radius: 5px;" :src="item.cover" alt=""> -->
<image style="width: 100%;border-radius: 5px;" :style="{ height: item.goods_image?'':'100rpx'}" :src="item.goods_image" mode="widthFix"></image>
<view class="g-show-name text-ellipsis-1">{{item.goods_name}}</view>
</view>
</view>
</view>
<!-- 商品分组 方式1-->
<view class="goods-box" v-if="type === 'goods'">
<view class="gcb-title" @tap="toPlate">
<view class="title-wrap">
{{title}}
</view>
<uni-icons class="toCss" type="right" color="white" size="16"></uni-icons>
</view>
<view class="gcb-list">
<view class="gcb-list-card" v-for="(item,i) in list">
<goodsInfo @tap="toDetail(item)" type=1 :info="item" >
<template v-if="buy_type=='activity'" #btn>
<view class="g-cart" @tap.stop="addToCart(item)">
<image src="@/static/cart.png" mode="widthFix" ></image>
</view>
</template>
</goodsInfo>
</view>
</view>
</view>
<goodsSpecs :goods_info="detail_info" @choosedOk="afterChoose" :show_state="show_state"></goodsSpecs>
<!-- <goodsCartPay :isShow="isShow" @closedState="closedFunc"></goodsCartPay> -->
</view>
</template>
<style lang="scss">
.gcb-title{
display: flex;
align-items: center;
}
.toCss{
position: absolute;
right: 10px;
// position: absolute; right: 10px; top: 30%;
}
.title-wrap{
position: relative;
top: 0;
left: 0;
width: 100%;
}
.g-cart{
image{
width: 40rpx;
height: 40rpx;
}
}
.g-buy-box{
display: flex;
justify-content: space-between;
align-items: center;
.g-price-box{
color: #FD5B4E;
display: flex;
align-items: end;
.g-price{
font-size: 18px;
margin-right: 10rpx;
font-weight: 600;
}
.g-price-o{
color: gray;
font-size: 28rpx;
text-decoration: line-through;
}
}
}
.g-desc{
color: gray;
font-size: 28rpx;
margin: 10px 0;
}
.g-show-name{
margin-top: 20rpx;
font-weight: bolder;
}
.gcb-title{
position: relative;
background: linear-gradient(0deg, #82c8ea, #abdef4);
color: white;
padding: 16rpx 0;
font-size: 36rpx;
font-weight: 600;
text-align: center;
}
.gcb-list{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: 0 20rpx;
.gcb-list-card{
// padding: 20rpx;
width: 48%;
margin: 20rpx 0;
}
}
.goods-card-box{
background: white;
border: 1px solid #82c8ea;
border-radius: 10px;
overflow: hidden;
margin-bottom: 40rpx;
border-top: unset;
.category-box{
text-align: center;
}
}
</style>

@ -0,0 +1,225 @@
<script setup>
//
import { onShow,onLoad,onHide } from "@dcloudio/uni-app"
import {ref,onMounted,nextTick,reactive,watch} from "vue"
import myButton from "@/components/myButton.vue"
import { useStore } from '@/store'
import api from "@/api/index"
import goodsInfo from "@/components/goodsInfo.vue"
const store = useStore()
const props = defineProps(['cart_show','cart_list']);
const emits = defineEmits(['del_cart'])
onLoad((e) => {
styleObject.value.height = store.systemInfo.screenHeight/1.8+'px'
// console.log(":",props.goods_info)
// getList()
})
watch(
() => props.cart_list,
(newVal, oldVal) => {
// info.value = newVal
list.value = newVal
console.log("cart_list新值",newVal)
updateList()
}
)
watch(
()=>props.cart_show,
(newVal, oldVal) => {
styleObject.value.height = store.systemInfo.screenHeight/1.8+'px'
cart_popup.value.open('bottom')
})
//
const list = ref([])
const cart_popup = ref()
const styleObject = ref({
height: '0px',
})
const total_num = ref(1)
const current_ = ref(0)
//
function updateList(){
// console.log(list.value)
if(list.value && list.value.length>0) {
for(let item of list.value) {
item.goods_image = item.goods.goods_image
item.goods_name = item.goods.goods_name
item.goods_id = item.goods.id
item.sell_price = item.price * item.num
item.single_price = item.price
item.desc = item.spec.name+',¥'+item.spec.sell_price
}
}
}
async function getList() { //
const res = await api.getCartList()
if(res.code ===1) {
list.value = res.data
}
}
function changeNumFunc(value){
setTimeout(() => {
// console.log(value,current_.value)
if(value>0) {
list.value[current_.value].num = value
list.value[current_.value].sell_price = list.value[current_.value].single_price * value
// list.value[current_.value].price = value
//
store.cartChange = !store.cartChange
emits('update_cart',[list.value[current_.value].id,list.value[current_.value].num])
}
else if(value<1) { //
// total_num.value = 1
store.cartChange = !store.cartChange
emits('del_cart',[list.value[current_.value].id])
}
else{ //
}
},0)
}
function lockItem(i) { //
current_.value = i
}
async function ofunc() { //
if(list.value.length > 0) {
uni.navigateTo({
url:'../order/order_submit?type=cart&info='+encodeURIComponent(JSON.stringify(props.cart_list))
})
}
}
async function clearFunc() { //
if(list.value.length<1) {
uni.showToast({
title:"没有商品哦~",
icon:"none"
})
return
}
uni.showModal({
title:'清除提示',
content:'确定要清除购物车吗?',
success:(val)=>{
console.log(val)
if(val.confirm) {
let arr = []
for(let item of list.value) {
arr.push(item.id)
}
store.cartChange = !store.cartChange
emits('del_cart',arr)
}
}
})
}
</script>
<template>
<view class="goodsCartBox">
<uni-popup ref="cart_popup" @change="change">
<view class="popup-content" :style="styleObject" >
<view class="pc-top">
<view class="pc-top-left">
已选商品
<text style="color: gray;">({{list.length}})</text>
</view>
<view class="pc-top-right" style="color: gray;" @click="clearFunc">
清空购物车
</view>
</view>
<view class="pc-content">
<view class="list-row" v-for="(item,i) in list" @tap="lockItem(i)">
<goodsInfo :type="2" :info="item" >
<template #btn>
<uni-number-box :value="item.num" @change="changeNumFunc" />
</template>
</goodsInfo>
</view>
</view>
<view class="pc-bottom" style="padding: 40rpx 0 ;">
<!-- 按钮 -->
<myButton v-if="list.length>0" style="width: 100%;" class="op-right" :type="2" @tap="ofunc(3)">
去结算
</myButton>
</view>
</view>
</uni-popup>
</view>
</template>
<style scoped lang="scss">
.pc-bottom{
z-index: 100;
position: fixed;
width: 100%;
bottom: 0;
background-color: white;
}
.goodsCartBox{
.popup-content{
position: relative;
padding-top: 40rpx;
background-color: white;
border-radius: 10px 10px 0 0;
overflow: scroll;
.pc-top{
position: fixed;
top: 34px;
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
box-sizing: border-box;
padding: 40rpx;
background-color: white;
z-index: 10;
}
.pc-content{
.list-row{
padding: 20rpx;
}
margin-bottom: 260rpx;
margin-top: 20rpx;
}
.pc-row{
padding:0 40rpx;
padding-bottom: 40rpx;
.pcr-title{
color: gray;
font-size: 30rpx;
padding: 20rpx 0;
}
.pc-choose-card-box{
.pc-choose-card{
display: inline-block;
background: #f1f1f1;
margin-right: 20rpx;
margin-bottom: 20rpx;
padding: 10rpx 20rpx;
border-radius: 10rpx;
// font-weight: bolder;
font-size: 28rpx;
}
}
}
.main-info{
display: flex;
// align-items:;
.pcr-left{
margin-right: 40rpx;
.pcrl-img-box{
border: 2rpx solid #dadada;
width: 180rpx;
height: 180rpx;
image{
width: 180rpx;
height: 180rpx;
}
}
}
.pcr-right{
.pcrr-row{
margin-bottom: 20rpx;
}
}
}
}
}
</style>

@ -0,0 +1,169 @@
<script setup>
//
import { onLoad,onShow } from "@dcloudio/uni-app"
import api from "@/api/index"
import {ref,onMounted,nextTick,watch} from "vue"
// import custom from "@/utils/index"
import { useStore } from '@/store'
const store = useStore()
// import searchBox from "@/components/searchBox.vue"
// import notice from "@/components/notice.vue"
// import goodsInfo from "@/components/goodsInfo.vue"
// import goodsSpecs from "@/components/goodsSpecs.vue"
import goodsCart from "@/components/goodsCart.vue"
const props = defineProps(['isShow']);
const emits = defineEmits([])
watch(() => {
return props.isShow
},(val1,val2) => {
console.log(props.isShow)
})
//
const cart_show = ref(false)
const current_ = ref(0)
const choosed_list = ref([])
const choosed_info_list = ref([])
const totalprice = ref(0)
const detail_info = ref(null)
//
function showCart() { //
cart_show.value = !cart_show.value
}
async function update_cart_func(params) {
// console.log(params)
const res = await api.updateCart({
cart_id:params[0],
num:params[1]
})
if(res.code === 1) {
getCartList()
}
}
const cart_list = ref(null)
async function getCartList() { //
const res = await api.getCartList()
// console.log(res)
if(res.code === 1) {
// if(res.data.length >0) {
cart_list.value = res.data
// console.log(cart_list.value)
totalprice.value = cart_list.value.reduce((total,item) => {
return total + parseFloat(item.price)
},0)
// choosed_list.value.push(item.id)
// totalprice.value += item.sell_price
// choosed_info_list.value.push(item)
// }
}
}
async function toPay() { //
//
const res = await api.getDefaultAddress()
if(res.code ===1 ) {
if(!res.data) { //
uni.