Feat:优惠券对接
This commit is contained in:
+128
-123
@@ -4,16 +4,16 @@ import request from "@/utils/request";
|
||||
* 省市区
|
||||
*/
|
||||
export function getCity(data) {
|
||||
return request.get("/city_list", data, {
|
||||
login: false
|
||||
});
|
||||
return request.get("/city_list", data, {
|
||||
login: false
|
||||
});
|
||||
}
|
||||
|
||||
export function district(data) {
|
||||
// return request.get("/city_list", data, {
|
||||
return request.get("/citys", data, {
|
||||
login: false
|
||||
});
|
||||
// return request.get("/city_list", data, {
|
||||
return request.get("/citys", data, {
|
||||
login: false
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -21,9 +21,9 @@ export function district(data) {
|
||||
* @param data object 用户账号密码
|
||||
*/
|
||||
export function login(data) {
|
||||
return request.post("/login", data, {
|
||||
login: false
|
||||
});
|
||||
return request.post("/login", data, {
|
||||
login: false
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,9 +31,9 @@ export function login(data) {
|
||||
* @param data object 用户手机号 也只能
|
||||
*/
|
||||
export function loginMobile(data) {
|
||||
return request.post("/login/mobile", data, {
|
||||
login: false
|
||||
});
|
||||
return request.post("/login/mobile", data, {
|
||||
login: false
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,9 +41,9 @@ export function loginMobile(data) {
|
||||
* @param data object 用户手机号
|
||||
*/
|
||||
export function registerVerify(data) {
|
||||
return request.post("/register/verify", data, {
|
||||
login: false
|
||||
});
|
||||
return request.post("/register/verify", data, {
|
||||
login: false
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,9 +51,9 @@ export function registerVerify(data) {
|
||||
* @param data object 用户手机号 验证码 密码
|
||||
*/
|
||||
export function register(data) {
|
||||
return request.post("/register", data, {
|
||||
login: false
|
||||
});
|
||||
return request.post("/register", data, {
|
||||
login: false
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,9 +61,9 @@ export function register(data) {
|
||||
* @param data object 用户手机号 验证码 密码
|
||||
*/
|
||||
export function registerReset(data) {
|
||||
return request.post("/register/reset", data, {
|
||||
login: false
|
||||
});
|
||||
return request.post("/register/reset", data, {
|
||||
login: false
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,7 +71,7 @@ export function registerReset(data) {
|
||||
* @param nil
|
||||
*/
|
||||
export function userBindParent(data) {
|
||||
return request.post("/user/spread", data);
|
||||
return request.post("/user/spread", data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,7 +79,7 @@ export function userBindParent(data) {
|
||||
* @param nil
|
||||
*/
|
||||
export function getUserLevelInfo() {
|
||||
return request.get("/user/levelInfo");
|
||||
return request.get("/user/levelInfo");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ export function getUserLevelInfo() {
|
||||
* @param nil
|
||||
*/
|
||||
export function saveUserProtocol(data) {
|
||||
return request.post("/user/saveGd", data);
|
||||
return request.post("/user/saveGd", data);
|
||||
}
|
||||
|
||||
|
||||
@@ -95,343 +95,346 @@ export function saveUserProtocol(data) {
|
||||
* 视频回放列表
|
||||
* */
|
||||
export function getVideoList(q) {
|
||||
return request.get("/video_list", q, {
|
||||
login: false
|
||||
});
|
||||
return request.get("/video_list", q, {
|
||||
login: false
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 领取优惠券列表
|
||||
* */
|
||||
export function getCoupon(q) {
|
||||
return request.get("/coupons", q, {
|
||||
login: true
|
||||
});
|
||||
return request.get("/coupons", q, {
|
||||
login: true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 点击领取优惠券
|
||||
* v9-2在用
|
||||
* */
|
||||
export function getCouponReceive(id) {
|
||||
return request.post("/coupon/receive", {
|
||||
couponId: id
|
||||
}, {
|
||||
login: true
|
||||
});
|
||||
return request.post("/coupon/receive", {
|
||||
couponId: id
|
||||
}, {
|
||||
login: true
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 批量领取优惠券
|
||||
* */
|
||||
export function couponReceiveBatch(couponId) {
|
||||
return request.post("/coupon/receive/batch", {
|
||||
couponId
|
||||
});
|
||||
return request.post("/coupon/receive/batch", {
|
||||
couponId
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 我的优惠券
|
||||
* v9-2在用
|
||||
* */
|
||||
export function getCouponsUser(type) {
|
||||
return request.get("/coupons/user/" + type);
|
||||
let url = '/coupons/user'
|
||||
if (type !== undefined && type !== null) url += `?filterType=${type}`
|
||||
return request.get(url)
|
||||
}
|
||||
|
||||
/*
|
||||
* 个人中心
|
||||
* */
|
||||
export function getUser() {
|
||||
return request.get("/user");
|
||||
return request.get("/user");
|
||||
}
|
||||
|
||||
/*
|
||||
* 用户信息
|
||||
* */
|
||||
export function getUserInfo() {
|
||||
return request.get("/userinfo", {
|
||||
login: true
|
||||
});
|
||||
return request.get("/userinfo", {
|
||||
login: true
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 小程序检查授权
|
||||
* */
|
||||
export function wxappCheckAuth(data) {
|
||||
return request.post("/wxapp/checkAuthCode", data, {
|
||||
login: false
|
||||
});
|
||||
return request.post("/wxapp/checkAuthCode", data, {
|
||||
login: false
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 小程序登陆
|
||||
* */
|
||||
export function wxappAuth(data) {
|
||||
return request.post("/wxapp/auth", data, {
|
||||
login: false
|
||||
});
|
||||
return request.post("/wxapp/auth", data, {
|
||||
login: false
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 个人中心(功能列表)
|
||||
* */
|
||||
export function getMenuUser() {
|
||||
return request.get("/menu/user");
|
||||
return request.get("/menu/user");
|
||||
}
|
||||
|
||||
/*
|
||||
* 用户设置支付密码
|
||||
* */
|
||||
export function setUserPayPwd(data) {
|
||||
return request.post("/user/savePayPass", data);
|
||||
return request.post("/user/savePayPass", data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 通知消息列表
|
||||
* */
|
||||
export function noticeList(data) {
|
||||
return request.get("/platNoticeSend/list", data, { login: true });
|
||||
return request.get("/platNoticeSend/list", data, {login: true});
|
||||
}
|
||||
|
||||
/*
|
||||
* 通知消息详情
|
||||
* */
|
||||
export function noticeDetail(data) {
|
||||
return request.post("/platNoticeSend/read", data, { login: true });
|
||||
return request.post("/platNoticeSend/read", data, {login: true});
|
||||
}
|
||||
|
||||
/*
|
||||
* 用户修改支付密码
|
||||
* */
|
||||
export function modifyUserPayPwd(data) {
|
||||
return request.post("/user/updatePayPass", data);
|
||||
return request.post("/user/updatePayPass", data);
|
||||
}
|
||||
|
||||
export function bankList(data) {
|
||||
return request.get("/api/yxBank/bank/list", data, { login: true });
|
||||
return request.get("/api/yxBank/bank/list", data, {login: true});
|
||||
}
|
||||
|
||||
export function bankCardList(data) {
|
||||
return request.get("/api/yxBankCard/bankCard/list", data, { login: true });
|
||||
return request.get("/api/yxBankCard/bankCard/list", data, {login: true});
|
||||
}
|
||||
|
||||
export function addBankCard(data) {
|
||||
return request.post("/api/yxBankCard/bankCard/add", data, { login: true });
|
||||
return request.post("/api/yxBankCard/bankCard/add", data, {login: true});
|
||||
}
|
||||
|
||||
export function deleteBankCard(data) {
|
||||
return request.post("/api/yxBankCard/bankCard/del", data, { login: true });
|
||||
return request.post("/api/yxBankCard/bankCard/del", data, {login: true});
|
||||
}
|
||||
|
||||
/*
|
||||
* 地址列表
|
||||
* */
|
||||
export function getAddressList(data) {
|
||||
return request.get("/address/list", data || {});
|
||||
return request.get("/address/list", data || {});
|
||||
}
|
||||
|
||||
/*
|
||||
* 删除地址
|
||||
* */
|
||||
export function getAddressRemove(id) {
|
||||
return request.post("/address/del", {
|
||||
id: id
|
||||
});
|
||||
return request.post("/address/del", {
|
||||
id: id
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 设置默认地址
|
||||
* */
|
||||
export function getAddressDefaultSet(id) {
|
||||
return request.post("/address/default/set", {
|
||||
id: id
|
||||
});
|
||||
return request.post("/address/default/set", {
|
||||
id: id
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取默认地址
|
||||
* */
|
||||
export function getAddressDefault() {
|
||||
return request.get("/address/default");
|
||||
return request.get("/address/default");
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取单个地址
|
||||
* */
|
||||
export function getAddress(id) {
|
||||
return request.get("/address/detail/" + id);
|
||||
return request.get("/address/detail/" + id);
|
||||
}
|
||||
|
||||
/*
|
||||
* 修改 添加地址
|
||||
* */
|
||||
export function postAddress(data) {
|
||||
return request.post("/address/edit", data);
|
||||
return request.post("/address/edit", data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取收藏产品
|
||||
* */
|
||||
export function getCollectUser(page, limit) {
|
||||
return request.get("/collect/user", {
|
||||
page: page,
|
||||
limit: limit
|
||||
});
|
||||
return request.get("/collect/user", {
|
||||
page: page,
|
||||
limit: limit
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 删除收藏产品
|
||||
* */
|
||||
export function getCollectDel(id, category) {
|
||||
return request.post("/collect/del", {
|
||||
id: id,
|
||||
category: category
|
||||
});
|
||||
return request.post("/collect/del", {
|
||||
id: id,
|
||||
category: category
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 批量收藏产品
|
||||
* */
|
||||
export function postCollectAll(data) {
|
||||
return request.post("/collect/all", data);
|
||||
return request.post("/collect/all", data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 添加收藏产品
|
||||
* */
|
||||
export function getCollectAdd(id, category) {
|
||||
return request.post("collect/add", {
|
||||
id: id,
|
||||
category: category
|
||||
});
|
||||
return request.post("collect/add", {
|
||||
id: id,
|
||||
category: category
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 签到配置
|
||||
* */
|
||||
export function getSignConfig() {
|
||||
return request.get("/sign/config");
|
||||
return request.get("/sign/config");
|
||||
}
|
||||
|
||||
/*
|
||||
* 签到里的签到列表
|
||||
* */
|
||||
export function getSignList(page, limit) {
|
||||
return request.get("/sign/list", {
|
||||
page: page,
|
||||
limit: limit
|
||||
});
|
||||
return request.get("/sign/list", {
|
||||
page: page,
|
||||
limit: limit
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 签到列表
|
||||
* */
|
||||
export function getSignMonth(page, limit) {
|
||||
return request.get("/sign/month", {
|
||||
page: page,
|
||||
limit: limit
|
||||
});
|
||||
return request.get("/sign/month", {
|
||||
page: page,
|
||||
limit: limit
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 签到用户信息
|
||||
* */
|
||||
export function postSignUser(sign) {
|
||||
return request.post("/sign/user", sign);
|
||||
return request.post("/sign/user", sign);
|
||||
}
|
||||
|
||||
/*
|
||||
* 签到
|
||||
* */
|
||||
export function postSignIntegral(sign) {
|
||||
return request.post("/sign/integral", sign);
|
||||
return request.post("/sign/integral", sign);
|
||||
}
|
||||
|
||||
/*
|
||||
* 推广数据
|
||||
* */
|
||||
export function getSpreadInfo() {
|
||||
return request.get("/commission");
|
||||
return request.get("/commission");
|
||||
}
|
||||
|
||||
/*
|
||||
* 推广人列表
|
||||
* */
|
||||
export function getSpreadUser(screen) {
|
||||
return request.post("/spread/people", screen);
|
||||
return request.post("/spread/people", screen);
|
||||
}
|
||||
|
||||
/*
|
||||
* 推广人订单
|
||||
* */
|
||||
export function getSpreadOrder(where) {
|
||||
return request.post("/spread/order", where);
|
||||
return request.post("/spread/order", where);
|
||||
}
|
||||
|
||||
/*
|
||||
* 资金明细(types|0=全部,1=消费,2=充值,3=返佣,4=提现)
|
||||
* */
|
||||
export function getCommissionInfo(q, types) {
|
||||
return request.get("/spread/commission/" + types, q);
|
||||
return request.get("/spread/commission/" + types, q);
|
||||
}
|
||||
|
||||
/*
|
||||
* 积分记录
|
||||
* */
|
||||
export function getIntegralList(q) {
|
||||
return request.get("/integral/list", q);
|
||||
return request.get("/integral/list", q);
|
||||
}
|
||||
|
||||
/*
|
||||
* 提现记录
|
||||
* */
|
||||
export function getWithdrawalRecordList(q) {
|
||||
return request.get("/list", q);
|
||||
return request.get("/list", q);
|
||||
}
|
||||
|
||||
/*
|
||||
* 提现银行
|
||||
* */
|
||||
export function getBank() {
|
||||
return request.get("/extract/bank");
|
||||
return request.get("/extract/bank");
|
||||
}
|
||||
|
||||
/*
|
||||
* 提现申请
|
||||
* */
|
||||
export function postCashInfo(cash) {
|
||||
return request.post("/extract/cash", cash);
|
||||
return request.post("/extract/cash", cash);
|
||||
}
|
||||
|
||||
/*
|
||||
* 会员中心
|
||||
* */
|
||||
export function getVipInfo() {
|
||||
return request.get("/user/level/grade");
|
||||
return request.get("/user/level/grade");
|
||||
}
|
||||
|
||||
/*
|
||||
* 会员等级任务
|
||||
* */
|
||||
export function getVipTask(id) {
|
||||
return request.get("/user/level/task/" + id);
|
||||
return request.get("/user/level/task/" + id);
|
||||
}
|
||||
|
||||
/*
|
||||
* 资金统计
|
||||
* */
|
||||
export function getBalance() {
|
||||
return request.get("/user/balance");
|
||||
return request.get("/user/balance");
|
||||
}
|
||||
|
||||
/*
|
||||
* 活动状态
|
||||
* */
|
||||
export function getActivityStatus() {
|
||||
return request.get("/user/activity", {}, {
|
||||
login: false
|
||||
});
|
||||
return request.get("/user/activity", {}, {
|
||||
login: false
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -439,87 +442,89 @@ export function getActivityStatus() {
|
||||
* */
|
||||
export function getSpreadImg(data) {
|
||||
|
||||
return request.get("/spread/banner", data);
|
||||
return request.get("/spread/banner", data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 用户修改信息
|
||||
* */
|
||||
export function postUserEdit(data) {
|
||||
return request.post("/user/edit", data);
|
||||
return request.post("/user/edit", data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 用户修改信息
|
||||
* */
|
||||
export function getChatRecord(to_uid, data) {
|
||||
return request.get("user/service/record/" + to_uid, data);
|
||||
return request.get("user/service/record/" + to_uid, data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 用户修改信息
|
||||
* */
|
||||
export function serviceList() {
|
||||
return request.get("user/service/list");
|
||||
return request.get("user/service/list");
|
||||
}
|
||||
|
||||
/*
|
||||
* 公众号充值
|
||||
* */
|
||||
export function rechargeWechat(data) {
|
||||
return request.post("/recharge/wechat", data);
|
||||
return request.post("/recharge/wechat", data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 退出登录
|
||||
* */
|
||||
export function getLogout() {
|
||||
return request.post("/auth/logout");
|
||||
return request.post("/auth/logout");
|
||||
}
|
||||
|
||||
/*
|
||||
* 绑定手机号(小程序方式)
|
||||
* */
|
||||
export function bindingPhone(data) {
|
||||
return request.post("wxapp/binding", data);
|
||||
return request.post("wxapp/binding", data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 绑定手机号(手机号,验证码方式)
|
||||
* */
|
||||
export function bindingPhoneByInput(data) {
|
||||
return request.post("/binding", data);
|
||||
return request.post("/binding", data);
|
||||
}
|
||||
|
||||
/*
|
||||
* h5切换公众号登陆
|
||||
* */
|
||||
export function switchH5Login() {
|
||||
return request.post("switch_h5", {
|
||||
from: "wechat"
|
||||
});
|
||||
return request.post("switch_h5", {
|
||||
from: "wechat"
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取推广人排行
|
||||
* */
|
||||
export function getRankList(q) {
|
||||
return request.get("rank", q);
|
||||
return request.get("rank", q);
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取佣金排名
|
||||
* */
|
||||
export function getBrokerageRank(q) {
|
||||
return request.get("brokerage_rank", q);
|
||||
return request.get("brokerage_rank", q);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测会员等级
|
||||
*/
|
||||
export function setDetection() {
|
||||
return request.get("user/level/detection");
|
||||
return request.get("user/level/detection");
|
||||
}
|
||||
|
||||
|
||||
export function getRechargeApi() {
|
||||
return request.get("recharge/index");
|
||||
return request.get("recharge/index");
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,6 +16,6 @@ export function fetchStore(page, cityName, name) {
|
||||
* */
|
||||
export function fetchCity(type) {
|
||||
return request.get(`/wenwan/cityList/${type}`, {}, {
|
||||
login: false
|
||||
login: true
|
||||
})
|
||||
}
|
||||
|
||||
+20
-4
@@ -74,6 +74,19 @@
|
||||
.cell:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.coupon-label {
|
||||
display: inline-block;
|
||||
height: 46rpx;
|
||||
box-sizing: border-box;
|
||||
margin-right: 10rpx;
|
||||
padding: 0 8rpx;
|
||||
border: 2rpx solid #FD5749;
|
||||
border-radius: 8rpx;
|
||||
color: #FD5749;
|
||||
font-size: 28rpx;
|
||||
line-height: 46rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.store-section {
|
||||
@@ -111,14 +124,15 @@
|
||||
height: 198rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.tag{
|
||||
.tag {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 92rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
.cover{
|
||||
|
||||
.cover {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 12rpx;
|
||||
@@ -162,12 +176,14 @@
|
||||
color: #ADADAD;
|
||||
}
|
||||
}
|
||||
.row:last-child{
|
||||
|
||||
.row:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.value {
|
||||
width: 100%;
|
||||
padding: 16rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+30
-6
@@ -26,6 +26,15 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
levelJump: (level, url, params) => {
|
||||
if (params) url += `?${params}`
|
||||
if (level === 1) {
|
||||
uni.switchTab({url})
|
||||
} else {
|
||||
uni.navigateTo({url})
|
||||
}
|
||||
},
|
||||
|
||||
navToGoods: (id) => {
|
||||
uni.navigateTo({
|
||||
url: "/pages/shop/GoodsCon/index?id=" + id
|
||||
@@ -36,14 +45,14 @@ export default {
|
||||
uni.navigateToMiniProgram({
|
||||
appId: "wx9ca93d1f2a9c8156",
|
||||
path: "pages/auth/login",
|
||||
success(msg){
|
||||
console.log("success",msg)
|
||||
success(msg) {
|
||||
console.log("success", msg)
|
||||
},
|
||||
fail(err){
|
||||
console.log("fail",err)
|
||||
fail(err) {
|
||||
console.log("fail", err)
|
||||
},
|
||||
complete(msg){
|
||||
console.log("complete",msg)
|
||||
complete(msg) {
|
||||
console.log("complete", msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -68,6 +77,21 @@ export default {
|
||||
res += chars[id];
|
||||
}
|
||||
return res;
|
||||
},
|
||||
|
||||
deepClone(val) {
|
||||
let oVal = Array.isArray(val) ? [] : {};
|
||||
for (let v in val) {
|
||||
if (val.hasOwnProperty(v)) {
|
||||
if ('object' === typeof val[v]) {
|
||||
//这里是深拷贝的关键所在(递归调用)
|
||||
oVal[v] = this.deepClone(val[v]);
|
||||
} else {
|
||||
oVal[v] = val[v];
|
||||
}
|
||||
}
|
||||
}
|
||||
return oVal;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
<template>
|
||||
<view class="components-coupons">
|
||||
<image class="coupons__cover" :src="data.image" mode="scaleToFill"/>
|
||||
|
||||
<view class="coupons__section flex jc-between ai-center">
|
||||
<view>有效期至:
|
||||
<text>{{ data.endTime }}</text>
|
||||
</view>
|
||||
<view class="coupons__tag coupons__tag-expire" v-if="data.status===2">已到期</view>
|
||||
<view class="coupons__tag" @click="goGoods()" v-if="data.status===0 && !radioModel">去使用</view>
|
||||
<view @click="selectCoupon">
|
||||
<radio :value="data.id" :checked="data.checked" color="#FF564A" v-if="radioModel && data.status===0"/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="coupons__rules">
|
||||
<view class="coupons__rules-title" @click="changeRules()">使用规则
|
||||
<image :class="{'open':isOpen}" :src="webUrl+'/20231125220409665027.png'" mode="scaleToFill"/>
|
||||
</view>
|
||||
<view v-html="data.description" v-show="isOpen"></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "Coupons",
|
||||
props: {
|
||||
data: Object,
|
||||
radioModel: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
checked: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
isOpen: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeRules() {
|
||||
this.isOpen = !this.isOpen
|
||||
},
|
||||
goGoods() {
|
||||
uni.switchTab({url:'/pages/home/landMark'})
|
||||
// this.$global.navToGoods(this.data.productId)
|
||||
},
|
||||
selectCoupon() {
|
||||
if (!this.radioModel) return
|
||||
this.$emit('change', this.data.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.components-coupons {
|
||||
width: 686rpx;
|
||||
box-sizing: border-box;
|
||||
border: 2rpx solid #FF564A;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
|
||||
image {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.coupons__cover {
|
||||
width: 100%;
|
||||
height: 300rpx;
|
||||
}
|
||||
|
||||
.coupons__section {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 18rpx 20rpx 16rpx 16rpx;
|
||||
font-size: 32rpx;
|
||||
line-height: 1;
|
||||
|
||||
text {
|
||||
color: #EA1C1C;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.coupons__tag {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 120rpx;
|
||||
height: 52rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 8rpx;
|
||||
border: 2px solid #0DC5C5;
|
||||
color: #0DC5C5;
|
||||
font-size: 32rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.coupons__tag-expire {
|
||||
border: 2rpx solid #BFBFBF;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.coupons__rules {
|
||||
padding: 0 20rpx 20rpx 16rpx;
|
||||
|
||||
.coupons__rules-title {
|
||||
color: #999999;
|
||||
font-size: 28rpx;
|
||||
|
||||
image {
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
margin-left: 6rpx;
|
||||
}
|
||||
|
||||
.open {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,128 @@
|
||||
<template>
|
||||
<view class="popup-coupons">
|
||||
<view class="popup-box">
|
||||
<view class="popup-title bold tc">选择优惠券</view>
|
||||
<SubSection :current="current" :can-use="canUse" :not-use="notUse" radioModel @change="changeNav"/>
|
||||
|
||||
<view class="list-box">
|
||||
<view style="margin-bottom: 20rpx" v-for="(item,index) in list" :key="index">
|
||||
<Coupons :data="item" radioModel @change="selectCoupon"/>
|
||||
</view>
|
||||
|
||||
<view class="tc" v-if="list.length===0">
|
||||
<image class="zero-coupons" :src="webUrl+'/20231201201733142658.png'" mode="scaleToFill"/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<button disabled></button>
|
||||
<view class="btn-done bold flex jc-center ai-center" :class="{'btn-disabled':current===1}" @click="setCoupon" v-if="current===0">确定
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SubSection from "@/components/SubSection.vue"
|
||||
import Coupons from '@/components/Coupons.vue'
|
||||
|
||||
export default {
|
||||
name: 'CouponsPopup',
|
||||
components: {SubSection, Coupons},
|
||||
props: {
|
||||
twoList: {
|
||||
type: Object,
|
||||
default: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
list() {
|
||||
let temp = this.current === 0 ? this.twoList['usable'] : this.twoList['unusable']
|
||||
return this.$global.deepClone(temp)
|
||||
},
|
||||
canUse() {
|
||||
return this.twoList['usable'].length
|
||||
},
|
||||
notUse() {
|
||||
return this.twoList['unusable'].length
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
current() {
|
||||
this.selectCoupon(this.couponId)
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
current: 0,
|
||||
couponId: 0
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.couponId = uni.getStorageSync('couponId') || 0
|
||||
this.selectCoupon(this.couponId)
|
||||
},
|
||||
methods: {
|
||||
changeNav(index) {
|
||||
this.current = index
|
||||
},
|
||||
selectCoupon(id) {
|
||||
const isCancel = this.couponId === id
|
||||
this.couponId = isCancel ? 0 : id
|
||||
|
||||
this.list?.forEach(item => {
|
||||
if (!isCancel) {
|
||||
item.checked = id === item.id
|
||||
} else {
|
||||
item.checked = false
|
||||
}
|
||||
})
|
||||
},
|
||||
setCoupon() {
|
||||
if (this.current === 1) return
|
||||
// if (this.couponId !== 0) {
|
||||
uni.setStorageSync('couponId', this.couponId)
|
||||
// }
|
||||
this.$emit('close')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.popup-coupons {
|
||||
.popup-box {
|
||||
padding: 34rpx 32rpx;
|
||||
}
|
||||
|
||||
.popup-title {
|
||||
margin-bottom: 20rpx;
|
||||
color: #333333;
|
||||
font-size: 36rpx;
|
||||
line-height: 52rpx;
|
||||
}
|
||||
|
||||
.list-box {
|
||||
max-height: 640rpx;
|
||||
margin-top: 32rpx;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.btn-done {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
background: #FF564A;
|
||||
color: #FFFFFF;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
|
||||
.btn-disabled {
|
||||
background: #BFBFBF;
|
||||
}
|
||||
|
||||
.zero-coupons {
|
||||
width: 400rpx;
|
||||
height: 366rpx;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -65,9 +65,6 @@ export default {
|
||||
data: function() {
|
||||
return {};
|
||||
},
|
||||
mounted: function() {
|
||||
console.log(this);
|
||||
},
|
||||
methods: {
|
||||
previewImg:function(imgUrl){
|
||||
uni.previewImage({
|
||||
@@ -107,7 +104,6 @@ export default {
|
||||
getCheckedValue: function() {
|
||||
let productAttr = this.attr.productAttr;
|
||||
let value = [];
|
||||
// console.log(productAttr)
|
||||
for (let i = 0; i < productAttr.length; i++) {
|
||||
for (let j = 0; j < productAttr[i].attrValueArr.length; j++) {
|
||||
if (productAttr[i].index === j) {
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<script>
|
||||
export default {
|
||||
name: "SubSection",
|
||||
props: {
|
||||
current: { // 当前选中
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
canUse: { // 可用
|
||||
type: [String, Number],
|
||||
default: 0
|
||||
},
|
||||
notUse: { // 不可用
|
||||
type: [String, Number],
|
||||
default: 0
|
||||
},
|
||||
radioModel: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
index: 0
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.index = this.current
|
||||
},
|
||||
methods: {
|
||||
change(index) {
|
||||
this.index = index
|
||||
this.$emit('change', index)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="sub-section flex">
|
||||
<view class="sub-section__item flex jc-center ai-center" :class="{'sub-section__active':index===0}"
|
||||
@click="change(0)">
|
||||
可使用 ({{ canUse }})
|
||||
</view>
|
||||
<view class="sub-section__item flex jc-center ai-center" :class="{'sub-section__active':index===1}"
|
||||
@click="change(1)">
|
||||
{{radioModel?'不可用':'已到期'}} ({{ notUse }})
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="less">
|
||||
.sub-section {
|
||||
width: 686rpx;
|
||||
height: 80rpx;
|
||||
box-sizing: border-box;
|
||||
border: 2rpx solid #FF564A;
|
||||
border-radius: 4rpx;
|
||||
font-size: 32rpx;
|
||||
|
||||
.sub-section__item {
|
||||
width: 50%;
|
||||
background: #FFFFFF;
|
||||
color: #333333;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.sub-section__active {
|
||||
background: #FF564A;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -19,29 +19,68 @@
|
||||
@up="upCallback" @down="downCallback" @init="mescrollInit" @emptyclick="emptyClick">
|
||||
|
||||
<view class="fixed-box">
|
||||
<view class="line-location flex ai-center" v-if="location">
|
||||
<view class="line-location flex ai-center">
|
||||
<image :src="webUrl+'/20220903142929759087.png'" mode="scaleToFill"></image>
|
||||
<text class="bold">当前定位:{{ location }}</text>
|
||||
<!-- @click="select(location)"-->
|
||||
<text class="bold" v-if="location">当前定位:{{ location }}</text>
|
||||
<view style="color:#f66" @click="reload()" v-else>定位失败
|
||||
<image :src="webUrl+'/20231215213824297278.png'" mode="scaleToFill"/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<image class="banner" :src="banner.icon" mode="scaleToFill" v-if="banner"
|
||||
@click="$global.commonJump(banner.url)"/>
|
||||
|
||||
<view class="top-box" v-if="listTop.length">
|
||||
<view class="tips">特别推荐</view>
|
||||
<view class="top-list custom-list flex ai-center">
|
||||
<view class="item" v-for="(item,index) in listTop" :key="index" @click="select(item)">
|
||||
<view class="has-goods" v-if="type===0 && item.hasData===0">暂无特产</view>
|
||||
<view class="has-goods" v-if="type>0 && type<6&& item.hasShop===0">暂无店铺</view>
|
||||
<image :src="item.icon" mode="scaleToFill"></image>
|
||||
<view class="one-t">{{ item.cityName }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="top-box" v-if="listTop.length">-->
|
||||
<!-- <view class="tips">特别推荐</view>-->
|
||||
<!-- <view class="top-list custom-list flex ai-center">-->
|
||||
<!-- <view class="item" v-for="(item,index) in listTop" :key="index" @click="select(item)">-->
|
||||
<!-- <view class="has-goods" v-if="type===0 && item.hasData===0">暂无特产</view>-->
|
||||
<!-- <view class="has-goods" v-if="type>0 && type<6&& item.hasShop===0">暂无店铺</view>-->
|
||||
<!-- <image :src="item.icon" mode="scaleToFill"></image>-->
|
||||
<!-- <view class="one-t">{{ item.cityName }}</view>-->
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
</view>
|
||||
|
||||
<view class="province-name">{{ provinceName }}</view>
|
||||
<!--9-2 推荐信息-->
|
||||
<view class="recommendInfo" v-if="recommendInfo && type<2">
|
||||
<template v-if="(type===0 && recommendInfo.hotelList) || (type===1 && recommendInfo.productList)">
|
||||
<view class="red-border-title">{{ recommendInfo.title }}</view>
|
||||
<image class="bg-custom" :src="recommendInfo.backgroundImage" mode="scaleToFill"/>
|
||||
|
||||
<scroll-view class="scroll-box flex" enable-flex scroll-x>
|
||||
<!-- :style="{'backgroundImage':`url(${recommendInfo.backgroundImage})`}"-->
|
||||
|
||||
|
||||
<view class="item flex-0 flex flex-col jc-between ai-center"
|
||||
v-for="(item,index) in recommendInfo.hotelList"
|
||||
:key="index" v-if="type===0" @click="goStore(item.hotelId)">
|
||||
<image class="cover" :src="item.hotelImage" mode="scaleToFill"/>
|
||||
<image class="logo" :src="item.hotelLogo" mode="scaleToFill"/>
|
||||
<view style="width: 100%">
|
||||
<view class="name tc one-t">{{ item.hotelName }}</view>
|
||||
<rich-text class="text tc one-t" :nodes="item.hotelText"/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="item flex-0 flex flex-col jc-between ai-center"
|
||||
v-for="(item,index) in recommendInfo.productList" :key="index" v-if="type===1"
|
||||
@click="$global.navToGoods(item.productId)">
|
||||
<image class="cover" :src="item.productImage" mode="scaleToFill"/>
|
||||
<image class="logo" :src="item.merLogo" mode="scaleToFill"/>
|
||||
<view style="width: 100%">
|
||||
<view class="name tc one-t">{{ item.productName }}</view>
|
||||
<rich-text class="text tc one-t" :nodes="item.productText"/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</scroll-view>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
<!-- province-name-->
|
||||
<view class="red-border-title" style="margin-left: 38rpx;">{{ provinceName }}</view>
|
||||
<view class="group-list custom-list flex flex-wrap">
|
||||
<view class="item" v-for="(item, index) in listCity" :key="index" @click="select(item)">
|
||||
<view class="has-goods" v-if="type===0 && item.hasData===0">暂无特产</view>
|
||||
@@ -102,7 +141,8 @@ export default {
|
||||
keyword: "",
|
||||
type: null,
|
||||
location: "",
|
||||
banner: {}
|
||||
banner: {},
|
||||
recommendInfo: null, // 推荐信息
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
@@ -114,11 +154,50 @@ export default {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
reload() {
|
||||
uni.getSetting({
|
||||
success(res) {
|
||||
if (res.authSetting['scope.userLocation']) {
|
||||
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '当前定位未开启,请点击确定手动开启定位',
|
||||
duration: 5000,
|
||||
success(result) {
|
||||
if (result.confirm) {
|
||||
uni.openSetting({
|
||||
success(openRes) {
|
||||
if (openRes.authSetting['scope.userLocation']) {
|
||||
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '你拒绝了授权,无法继续',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if (result.cancel) {
|
||||
uni.showToast({
|
||||
title: '你拒绝了授权,无法获取定位信息',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
async getMapData() {
|
||||
const map = await getLocation();
|
||||
const {latitude, longitude} = map[1];
|
||||
const address = await getCurAddress(latitude, longitude);
|
||||
this.location = address[1].data.result.ad_info.city;
|
||||
if (map) {
|
||||
const {latitude, longitude} = map[1];
|
||||
const address = await getCurAddress(latitude, longitude);
|
||||
this.location = address[1].data.result.ad_info.city;
|
||||
}
|
||||
},
|
||||
|
||||
init() {
|
||||
@@ -130,6 +209,7 @@ export default {
|
||||
this.listTop = this.listGroup[0].top;
|
||||
this.listCity = this.listGroup[0].city;
|
||||
this.provinceName = this.listGroup[0].label;
|
||||
this.recommendInfo = this.listGroup[0].recommendInfo
|
||||
this.banner = {
|
||||
icon: this.listGroup[0].icon,
|
||||
url: this.listGroup[0].uniappUrl
|
||||
@@ -143,6 +223,7 @@ export default {
|
||||
this.listTop = this.listGroup[index].top;
|
||||
this.listCity = this.listGroup[index].city;
|
||||
this.provinceName = this.listGroup[index].label;
|
||||
this.recommendInfo = this.listGroup[index].recommendInfo
|
||||
this.banner = {
|
||||
icon: this.listGroup[index].icon,
|
||||
url: this.listGroup[index].uniappUrl
|
||||
@@ -195,7 +276,13 @@ export default {
|
||||
uni.navigateBack()
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
goStore(id) {
|
||||
uni.navigateTo({
|
||||
url: "/pagesInn/inn/innHome?id=" + id
|
||||
})
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -307,8 +394,22 @@ export default {
|
||||
margin-left: 161rpx;
|
||||
margin-top: 110rpx;
|
||||
|
||||
.red-border-title {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
margin: 18rpx 0;
|
||||
padding: 8rpx 0 0 8rpx;
|
||||
border-left: 6rpx solid #FD574B;
|
||||
color: #262626;
|
||||
font-size: 30rpx;
|
||||
line-height: 30rpx;
|
||||
font-weight: bold;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.fixed-box {
|
||||
padding: 32rpx 0 44rpx 38rpx;
|
||||
padding: 32rpx 0 0 38rpx;
|
||||
|
||||
.line-location {
|
||||
font-size: 28rpx;
|
||||
@@ -338,6 +439,77 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
.recommendInfo {
|
||||
position: relative;
|
||||
margin-left: 38rpx;
|
||||
|
||||
.scroll-box {
|
||||
position: relative;
|
||||
width: 520rpx;
|
||||
height: 314rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 70rpx 20rpx 0 20rpx;
|
||||
border-radius: 20rpx;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 520rpx 314rpx;
|
||||
}
|
||||
|
||||
.item {
|
||||
position: relative;
|
||||
width: 136rpx;
|
||||
height: 220rpx;
|
||||
margin-right: 28rpx;
|
||||
border-radius: 8rpx;
|
||||
background: linear-gradient(180deg, #08255D 0%, #6FA2FF 100%);
|
||||
color: #FFFFFF;
|
||||
line-height: 1;
|
||||
//overflow: hidden;
|
||||
|
||||
image {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.cover {
|
||||
width: 136rpx;
|
||||
height: 136rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.logo {
|
||||
position: absolute;
|
||||
left: 68rpx;
|
||||
top: 136rpx;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.name {
|
||||
padding-bottom: 10rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.text {
|
||||
padding-bottom: 10rpx;
|
||||
font-size: 16rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.item::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: -14rpx;
|
||||
top: 26rpx;
|
||||
width: 2rpx;
|
||||
height: 172rpx;
|
||||
background: #D2E0E8;
|
||||
}
|
||||
.item:last-child::after{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.province-name {
|
||||
margin: 0 38rpx 24rpx;
|
||||
font-size: 28rpx;
|
||||
@@ -366,5 +538,13 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bg-custom {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 74rpx;
|
||||
width: 520rpx;
|
||||
height: 314rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
+22
-3
@@ -1,11 +1,30 @@
|
||||
// export const VUE_APP_API_URL = "https://shop.xdd618.com/api";
|
||||
export const VUE_APP_API_URL = "https://www.xdd618.com/api";
|
||||
// export const VUE_APP_API_URL = "https://www.xdd618.com/api";
|
||||
|
||||
// export const SERVICE_API_URL = "https://service-test.xdd618.com/api";
|
||||
export const SERVICE_API_URL = "https://service.xdd618.com/api";
|
||||
// export const SERVICE_API_URL = "https://service.xdd618.com/api";
|
||||
|
||||
// export const SOCKET_URL = "wss://service-test.xdd618.com/ws";
|
||||
export const SOCKET_URL = "wss://service.xdd618.com/ws";
|
||||
// export const SOCKET_URL = "wss://service.xdd618.com/ws";
|
||||
const NODE_ENV = process.env.VUE_APP_ENV || 'development'
|
||||
let BASE_URL = ''
|
||||
let SERVICE_URL = ''
|
||||
let SERVICE_WS_URL = ''
|
||||
if (NODE_ENV === 'development' || NODE_ENV === 'test') {
|
||||
BASE_URL = 'https://shop.xdd618.com/api'
|
||||
SERVICE_URL = 'https://service-test.xdd618.com/api'
|
||||
SERVICE_WS_URL = 'wss://service-test.xdd618.com/ws'
|
||||
}
|
||||
if (NODE_ENV === 'prod') {
|
||||
BASE_URL = 'https://www.xdd618.com/api'
|
||||
SERVICE_URL = 'https://service.xdd618.com/api'
|
||||
SERVICE_WS_URL = 'wss://service.xdd618.com/ws'
|
||||
}
|
||||
|
||||
export const VUE_APP_API_URL = BASE_URL
|
||||
export const SERVICE_API_URL = SERVICE_URL
|
||||
export const SOCKET_URL = SERVICE_WS_URL
|
||||
|
||||
|
||||
export const VUE_APP_RESOURCES_URL = "https://www.xdd618.com/api/file/pic";
|
||||
export const STATIC_RESOURCE_URL = "https://resource.xdd618.com/image"
|
||||
|
||||
+27
-4
@@ -77,7 +77,7 @@
|
||||
"miniapp-color-thief": "^1.0.5",
|
||||
"number-precision": "^1.5.2",
|
||||
"regenerator-runtime": "^0.12.1",
|
||||
"uview-ui": "2.0.31",
|
||||
"uview-ui": "2.0.36",
|
||||
"vconsole": "^3.14.6",
|
||||
"vue": "^2.6.11",
|
||||
"vue-ydui": "^1.2.6",
|
||||
@@ -117,7 +117,30 @@
|
||||
"resolutions": {
|
||||
"@babel/runtime": "~7.17.9"
|
||||
},
|
||||
"uni-app": {
|
||||
"scripts": {}
|
||||
}
|
||||
"uni-app": {
|
||||
"scripts": {
|
||||
"mp-weixin-test": {
|
||||
"title": "微信小程序(Test环境)",
|
||||
"env": {
|
||||
"UNI_PLATFORM": "mp-weixin",
|
||||
"VUE_APP_ENV": "test",
|
||||
"UNI_OUTPUT_DIR": "dist"
|
||||
},
|
||||
"define": {
|
||||
"CUSTOM-CONST": true
|
||||
}
|
||||
},
|
||||
"mp-weixin": {
|
||||
"title": "微信小程序(生产环境)",
|
||||
"env": {
|
||||
"UNI_PLATFORM": "mp-weixin",
|
||||
"VUE_APP_ENV": "prod",
|
||||
"UNI_OUTPUT_DIR": "dist"
|
||||
},
|
||||
"define": {
|
||||
"CUSTOM-CONST": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+17
-28
@@ -254,18 +254,6 @@
|
||||
"navigationBarTitleText": "用户vip"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/coupon/UserCoupon/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "优惠券"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/coupon/GetCoupon/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "领取优惠券"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/promotion/UserCash/index",
|
||||
"style": {
|
||||
@@ -743,6 +731,12 @@
|
||||
"navigationBarTitleText": "绑定手机号"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "views/myCoupons",
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的优惠券"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "views/payPassword",
|
||||
"style": {
|
||||
@@ -920,32 +914,27 @@
|
||||
]
|
||||
},
|
||||
"condition": {
|
||||
"current": 3,
|
||||
"current": 1,
|
||||
"list": [
|
||||
{
|
||||
"name": "商品详情",
|
||||
"path": "pages/shop/GoodsCon/index",
|
||||
"query": "id=303&from=famous"
|
||||
"query": "id=289"
|
||||
},
|
||||
{
|
||||
"name": "v9-2",
|
||||
"path": "pages/order/OrderSubmission/index",
|
||||
"query": "id=2539"
|
||||
},
|
||||
{
|
||||
"name": "DEBUG",
|
||||
"path": "pkg_product/views/healthList",
|
||||
"query": "id=32"
|
||||
},
|
||||
{
|
||||
"name": "节日",
|
||||
"path": "pkg_product/views/festival",
|
||||
"query": ""
|
||||
"path": "pages/shop/GoodsCon/index",
|
||||
"query": "id=466"
|
||||
},
|
||||
{
|
||||
"name": "非遗",
|
||||
"path": "pkg_product/views/heritage",
|
||||
"query": ""
|
||||
},
|
||||
{
|
||||
"name": "地标好物",
|
||||
"path": "pages/home/landMark",
|
||||
"query": ""
|
||||
"path": "pages/order/OrderSubmission/index",
|
||||
"query": "id=2597"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ export default {
|
||||
if (memCityName.length) {
|
||||
this.cityName = memCityName;
|
||||
uni.removeStorageSync("cityName")
|
||||
console.log("memCityName if")
|
||||
this.search();
|
||||
}
|
||||
},
|
||||
|
||||
+40
-9
@@ -66,10 +66,10 @@
|
||||
</view>
|
||||
<!-- 快捷跳转块v4end -->
|
||||
|
||||
<!-- <view style="padding-bottom:20rpx;background: #fff;">-->
|
||||
<!-- 转盘-->
|
||||
<!-- <image class="home-luck" :src="`${webUrl}/20220519145845818243.png`" mode="scaleToFill" @click="goLuck"></image>-->
|
||||
<!-- </view>-->
|
||||
<!-- <view style="padding-bottom:20rpx;background: #fff;">-->
|
||||
<!-- 转盘-->
|
||||
<!-- <image class="home-luck" :src="`${webUrl}/20220519145845818243.png`" mode="scaleToFill" @click="goLuck"></image>-->
|
||||
<!-- </view>-->
|
||||
|
||||
<!-- 伴手礼精品 -->
|
||||
<!-- <view class="wrapper hot" v-if="likeInfo.length > 0">-->
|
||||
@@ -244,7 +244,7 @@
|
||||
<!-- v9 老用户弹窗 -->
|
||||
<u-popup :show="isOldUser" mode="center" bgColor="transparent">
|
||||
<view class="popup-old-user flex flex-col ai-center">
|
||||
<image class="main" :src="oldUserPopup.image" mode="scaleToFill" @click="$global.commonJump(oldUserPopup.url)"/>
|
||||
<image class="main" :src="oldUserPopup.image" mode="scaleToFill" @click="tapOld()"/>
|
||||
<view class="icon-box flex jc-center ai-center" @click="changeOldPopup(false)">
|
||||
<image :src="webUrl+'/20230608112219219303.png'" mode="scaleToFill"/>
|
||||
</view>
|
||||
@@ -314,7 +314,7 @@ import hxNavbar from "@/components/hx-navbar/hx-navbar.vue"
|
||||
import imgBox from '@/components/imageTypeSet/imagebox.vue'
|
||||
import LsSwiper from '@/components//ls-swiper/index.vue'
|
||||
|
||||
import {noticeDetail, noticeList} from "@/api/user";
|
||||
import {getCouponReceive, noticeDetail, noticeList} from "@/api/user";
|
||||
import {getHomeData, getShareImage} from '@/api/public';
|
||||
import {getHomeHotelList} from "@/api/inn.js";
|
||||
import {getProducts} from "@/api/store";
|
||||
@@ -457,6 +457,7 @@ export default {
|
||||
},
|
||||
onLoad: function (options) {
|
||||
that = this;
|
||||
this.init();
|
||||
getShareImage().then(({data}) => this.shareAppImg = data);
|
||||
uni.getSystemInfo({
|
||||
success: (e) => {
|
||||
@@ -522,7 +523,6 @@ export default {
|
||||
this.getUnreadMsgList();
|
||||
}
|
||||
|
||||
this.init();
|
||||
//获取团购商品
|
||||
this.getGroupGoods();
|
||||
},
|
||||
@@ -668,6 +668,7 @@ export default {
|
||||
msgConfirm: function () {
|
||||
that.$refs.popup.close();
|
||||
},
|
||||
|
||||
getHotelList: function () {
|
||||
let that = this;
|
||||
|
||||
@@ -829,6 +830,36 @@ export default {
|
||||
|
||||
goFestival() {
|
||||
uni.navigateTo({url: '/pkg_product/views/festival'})
|
||||
},
|
||||
tapOld() {
|
||||
this.isOldUser =false
|
||||
const {type, text, jumpTime, pageLevel, url, params, couponId} = this.oldUserPopup
|
||||
if (couponId != null) {
|
||||
getCouponReceive(couponId).then(res => {
|
||||
if (res.status === 200) {
|
||||
uni.showToast({
|
||||
title: text,
|
||||
icon: 'none',
|
||||
success: () => {
|
||||
}
|
||||
})
|
||||
}
|
||||
}).catch((err) => {
|
||||
uni.showToast({
|
||||
title: err.data.msg+'',
|
||||
icon: 'none',
|
||||
duration:3000
|
||||
})
|
||||
})
|
||||
}
|
||||
// type 1-定时跳转,2-点击跳转,3-不跳转
|
||||
if (type === 1) {
|
||||
setTimeout(() => {
|
||||
this.$global.levelJump(pageLevel, url, params)
|
||||
}, jumpTime * 1000)
|
||||
} else if (type === 2) {
|
||||
this.$global.levelJump(pageLevel, url, params)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1735,8 +1766,8 @@ export default {
|
||||
|
||||
.swiper {
|
||||
position: absolute;
|
||||
left:20rpx;
|
||||
bottom:20rpx;
|
||||
left: 20rpx;
|
||||
bottom: 20rpx;
|
||||
width: 296rpx;
|
||||
height: 72rpx;
|
||||
overflow: hidden;
|
||||
|
||||
@@ -27,7 +27,7 @@ export default {
|
||||
return 718 / (this.mapData?.mapImageWidth || 1);
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
onLoad() {
|
||||
this.getNavList();
|
||||
},
|
||||
onReachBottom() {
|
||||
@@ -91,6 +91,7 @@ export default {
|
||||
<view class="search-box flex ai-center">
|
||||
<input type="text" v-model="keyword" placeholder="搜索商品" placeholder-style="color:#999"
|
||||
@confirm="search()"/>
|
||||
<image :src="webUrl+'/20231223183627184005.png'" mode="scaleToFill" style="width:30rpx;height:30rpx"/>
|
||||
</view>
|
||||
|
||||
<view class="map-box">
|
||||
|
||||
@@ -193,7 +193,7 @@
|
||||
<view class="conter" style="width: auto !important;">¥{{ force2Decimal(orderInfo.totalPrice) }}</view>
|
||||
</view>
|
||||
<view class="item acea-row row-between" v-if="orderInfo.couponPrice > 0">
|
||||
<view>优惠券抵扣:</view>
|
||||
<view class="flex-0">优惠券抵扣:</view>
|
||||
<view class="conter">-¥{{ force2Decimal(orderInfo.couponPrice) }}</view>
|
||||
</view>
|
||||
<view class="item acea-row row-between" v-if="orderInfo.useIntegral > 0">
|
||||
|
||||
@@ -1,31 +1,6 @@
|
||||
<template>
|
||||
<view class="order-submission" style="padding: 30rpx;">
|
||||
<view class="allAddress" style="background-color: #f6f6f6;">
|
||||
<!-- <view class="nav acea-row">
|
||||
<view
|
||||
class="item font-color-red"
|
||||
:class="shipping_type === 0 ? 'on' : 'on2'"
|
||||
@click="addressType(0)"
|
||||
v-if="systemStore"
|
||||
></view>
|
||||
<view
|
||||
class="item font-color-red"
|
||||
:class="shipping_type === 1 ? 'on' : 'on2'"
|
||||
@click="addressType(1)"
|
||||
v-if="storeSelfMention"
|
||||
></view>
|
||||
</view> -->
|
||||
|
||||
<!-- <view class="acea-row" style="padding-left: 28rpx;">
|
||||
<view v-if="systemStore" class="item" style="position: relative;" @click="addressType(0)">
|
||||
<text :class="shipping_type === 0 ? 'on' :''" class="goods-detail-title">送货上门</text>
|
||||
<text v-if="shipping_type === 0" class="pink-dot"></text>
|
||||
</view>
|
||||
<view v-if="storeSelfMention" class="item" style="position: relative;margin-left: 40rpx;" @click="addressType(1)">
|
||||
<text :class="shipping_type === 1 ? 'on' :''" class="goods-detail-title">到店自取</text>
|
||||
<text v-if="shipping_type === 1" class="pink-dot"></text>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view
|
||||
class="address acea-row row-middle"
|
||||
@@ -42,7 +17,7 @@
|
||||
<text class="phone">{{ addressInfo.phone }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<!-- <text class="default font-color-lightred" v-if="addressInfo.isDefault">[默认]</text> -->
|
||||
|
||||
{{ addressInfo.province }}{{ addressInfo.city }}{{ addressInfo.district }}{{ addressInfo.detail }}
|
||||
</view>
|
||||
</view>
|
||||
@@ -74,42 +49,8 @@
|
||||
|
||||
<OrderGoods :evaluate="0" :cartInfo="orderGroupInfo.cartInfo" title="商品列表"></OrderGoods>
|
||||
|
||||
|
||||
<view class="wrapper" style="margin: 30rpx 0;border-radius: 16rpx;">
|
||||
|
||||
<!-- 优惠券开始 -->
|
||||
<!-- <view class="item acea-row row-between-wrapper" @click="couponTap" v-if="deduction === false">
|
||||
<view>优惠券</view>
|
||||
<view class="discount">
|
||||
{{ usableCoupon.couponTitle || "请选择" }}
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- 优惠券结束 -->
|
||||
|
||||
<!-- 积分抵扣开始 -->
|
||||
<!-- <view
|
||||
class="item acea-row row-between-wrapper"
|
||||
v-if="deduction === false && enableIntegral === true"
|
||||
>
|
||||
<view>积分抵扣</view>
|
||||
<view class="discount">
|
||||
<view class="select-btn">
|
||||
<view class="checkbox-wrapper">
|
||||
<checkbox-group @change="changeUseIntegral">
|
||||
<label class="well-check">
|
||||
<text class="integral">
|
||||
当前积分
|
||||
<text class="num font-color-red">{{ userInfo.integral || 0 }}</text>
|
||||
</text>
|
||||
<checkbox value="true" :checked="useIntegral ? true : false"></checkbox>
|
||||
</label>
|
||||
</checkbox-group>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- 积分抵扣结束 -->
|
||||
|
||||
<view class="item acea-row row-between-wrapper" style="flex-wrap: nowrap;" v-if="shipping_type === 0">
|
||||
<view class="acea-row row-middle" style="flex-wrap: nowrap;">
|
||||
@@ -117,13 +58,6 @@
|
||||
mode=""></image>
|
||||
<text class="">快递费用</text>
|
||||
</view>
|
||||
<!-- <view class="discount">
|
||||
{{
|
||||
orderGroupInfo.priceGroup.storePostage > 0
|
||||
? force2Decimal(orderGroupInfo.priceGroup.storePostage)
|
||||
: (orderPrice.payPostage>0?force2Decimal(orderPrice.payPostage):"免运费")
|
||||
}}
|
||||
</view> -->
|
||||
<view class="discount" style="width: auto !important;">
|
||||
{{ orderPrice.payPostage > 0 ? force2Decimal(orderPrice.payPostage) : "免运费" }}
|
||||
</view>
|
||||
@@ -148,7 +82,7 @@
|
||||
mode=""></image>
|
||||
<text class="">备注信息(150字以内)</text>
|
||||
</view>
|
||||
<textarea v-model="mark" ></textarea>
|
||||
<textarea v-model="mark"></textarea>
|
||||
</view>
|
||||
</view>
|
||||
<view class="wrapper" style="margin: 30rpx 0;border-radius: 16rpx;">
|
||||
@@ -237,6 +171,25 @@
|
||||
<view class="money">-¥{{ force2Decimal(orderPrice.deductionPrice) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="coupon-cell flex jc-between ai-center" @click="changeCoupons">
|
||||
<view class="title">优惠券:</view>
|
||||
<view class="flex ai-center">
|
||||
<text style="color:#999999" v-if="couponList.usable.length===0">无</text>
|
||||
<view class="flex ai-center" v-else>
|
||||
<text style="color:#FF564A">{{ couponIndex < 0 ? '去选择' : -couponList.usable[couponIndex].couponPrice }}
|
||||
</text>
|
||||
<view class="iconfont icon-jiantou" style="flex-shrink: 0;"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- v9 优惠券开始 -->
|
||||
<u-popup :show="show" :round="10" mode="bottom" closeOnClickOverlay @close="changeCoupons">
|
||||
<CouponsPopup :two-list="couponList" @close="changeCoupons" v-if="couponList.usable"/>
|
||||
</u-popup>
|
||||
<!-- v9 优惠券结束 -->
|
||||
|
||||
<view style="height:80rpx"></view>
|
||||
<view class="footer acea-row row-between-wrapper" style="height: 80rpx;">
|
||||
<view style="margin-left: 30rpx;">
|
||||
@@ -248,14 +201,6 @@
|
||||
</view>
|
||||
<view class="settlement acea-row row-middle row-center" @click="subscribePay">立即结算</view>
|
||||
</view>
|
||||
<CouponListWindow
|
||||
v-on:couponchange="changecoupon($event)"
|
||||
v-model="showCoupon"
|
||||
:price="orderPrice.totalPrice"
|
||||
:checked="usableCoupon.id"
|
||||
@checked="changeCoupon"
|
||||
:cartid="cartid"
|
||||
></CouponListWindow>
|
||||
<AddressWindow
|
||||
@checked="changeAddress"
|
||||
@redirect="addressRedirect"
|
||||
@@ -263,23 +208,15 @@
|
||||
:checked="addressInfo.id"
|
||||
ref="mychild"
|
||||
></AddressWindow>
|
||||
<!-- <uni-popup ref="popup" type="bottom">
|
||||
<blPaymentPasswordInput hideTopBorder ref="secrity" @input="onInput" @confirm="onConfirm">
|
||||
<block slot='header' style='width: 100%;'>
|
||||
<view style="font-size: 36rpx;color: #8B8F99;margin: 10rpx 0;">请输入支付密码</view>
|
||||
</block>
|
||||
</blPaymentPasswordInput>
|
||||
</uni-popup> -->
|
||||
|
||||
<passkeyborad :money="orderPrice.payPrice" showMoney :show="isShowPayPwdPop" ref='payPwdPop' @close="pwdPopClose"
|
||||
@finish="pwdPopFinish"></passkeyborad>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import passkeyborad from '@/components/yzc-paykeyboard/yzc-paykeyboard'
|
||||
import OrderGoods from "@/components/OrderGoods";
|
||||
import CouponListWindow from "@/components/CouponListWindow";
|
||||
import AddressWindow from "@/components/AddressWindow";
|
||||
import {createOrder, postOrderComputed, postOrderConfirm} from "@/api/order";
|
||||
import {mapGetters} from "vuex";
|
||||
@@ -287,6 +224,7 @@ import {weappPay} from "@/libs/wechat";
|
||||
import {isNullOrEmpty, isWeixin} from "@/utils";
|
||||
import blPaymentPasswordInput from '@/components/blPaymentPasswordInput.vue';
|
||||
import uniPopup from '@/components/uni-popup/uni-popup.vue';
|
||||
import CouponsPopup from "@/components/CouponsPopup.vue"
|
||||
|
||||
const NAME = "OrderSubmission",
|
||||
_isWeixin = isWeixin();
|
||||
@@ -294,11 +232,11 @@ export default {
|
||||
name: NAME,
|
||||
components: {
|
||||
OrderGoods,
|
||||
CouponListWindow,
|
||||
AddressWindow,
|
||||
blPaymentPasswordInput,
|
||||
uniPopup,
|
||||
passkeyborad
|
||||
passkeyborad,
|
||||
CouponsPopup
|
||||
},
|
||||
props: {},
|
||||
data: function () {
|
||||
@@ -312,16 +250,13 @@ export default {
|
||||
enableIntegralNum: 0,
|
||||
isWeixin: _isWeixin,
|
||||
pinkId: 0,
|
||||
// active: _isWeixin ? "weixin" : "yue",
|
||||
active: "weixin",
|
||||
showCoupon: false,
|
||||
showAddress: false,
|
||||
addressInfo: {},
|
||||
couponId: 0,
|
||||
orderGroupInfo: {
|
||||
priceGroup: {}
|
||||
},
|
||||
usableCoupon: {},
|
||||
addressLoaded: false,
|
||||
useIntegral: false,
|
||||
orderPrice: {
|
||||
@@ -334,46 +269,34 @@ export default {
|
||||
contactsTel: "",
|
||||
storeSelfMention: 0,
|
||||
cartid: "",
|
||||
payPassword: null
|
||||
payPassword: null,
|
||||
// v9-2
|
||||
couponList: {},
|
||||
couponId: 0,
|
||||
couponIndex: -1,
|
||||
show: false
|
||||
};
|
||||
},
|
||||
computed: mapGetters(["userInfo", "storeItems"]),
|
||||
watch: {
|
||||
useIntegral() {
|
||||
this.computedPrice();
|
||||
this.computedPrice('useIntegral');
|
||||
},
|
||||
// $yroute(n) {
|
||||
// if (n.name === NAME){
|
||||
// this.getCartInfo();
|
||||
// // this.$store.dispatch("getUser", true);
|
||||
// }
|
||||
// },
|
||||
shipping_type() {
|
||||
this.computedPrice();
|
||||
this.computedPrice('shipping_type');
|
||||
},
|
||||
couponId() {
|
||||
this.couponIndex = this.couponList['usable']?.findIndex(item => item.id === this.couponId)
|
||||
this.computedPrice('couponId')
|
||||
}
|
||||
},
|
||||
// mounted: function() {
|
||||
// let that = this;
|
||||
// // this.$store.dispatch("getUser", true);
|
||||
// that.getCartInfo();
|
||||
// console.log(that.$yroute);
|
||||
// if (that.$yroute.query.pinkid !== undefined) {
|
||||
// that.pinkId = that.$yroute.query.pinkid;
|
||||
// }
|
||||
// if (that.$yroute.query.id !== undefined) {
|
||||
// that.cartid = that.$yroute.query.id;
|
||||
// console.log(that.cartid)
|
||||
// }
|
||||
// },
|
||||
onLoad: function () {
|
||||
//获取用户信息
|
||||
// this.$store.dispatch("getUser", true);
|
||||
let that = this;
|
||||
uni.$on('chooseAddress', (res) => {
|
||||
console.log('监听到选择收货地址:' + JSON.stringify(res));
|
||||
that.addressInfo = res;
|
||||
//地址切换也要重新计算一下
|
||||
that.computedPrice();
|
||||
that.computedPrice('onLoad chooseAddress');
|
||||
})
|
||||
that.getCartInfo();
|
||||
console.log(that.$yroute);
|
||||
@@ -404,27 +327,13 @@ export default {
|
||||
force2Decimal(value) {
|
||||
return this.$force2Decimal(value);
|
||||
},
|
||||
addressType: function (index) {
|
||||
if (index && !this.systemStore.id) {
|
||||
uni.showToast({
|
||||
title: "暂无门店信息,您无法选择到店自提!",
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.shipping_type = index;
|
||||
},
|
||||
changeUseIntegral: function (e) {
|
||||
// this.computedPrice();
|
||||
this.useIntegral = e.mp.detail.value[0];
|
||||
},
|
||||
computedPrice() {
|
||||
computedPrice(f) {
|
||||
console.log(f)
|
||||
let shipping_type = this.shipping_type;
|
||||
postOrderComputed(this.orderGroupInfo.orderKey, {
|
||||
addressId: this.addressInfo.id,
|
||||
useIntegral: this.useIntegral ? 1 : 0,
|
||||
couponId: this.usableCoupon.id || 0,
|
||||
couponId: this.couponId || 0,
|
||||
shipping_type: parseInt(shipping_type) + 1
|
||||
}).then(res => {
|
||||
const data = res.data;
|
||||
@@ -456,11 +365,12 @@ export default {
|
||||
that.offlinePayStatus = res.data.offline_pay_status;
|
||||
that.orderGroupInfo = res.data;
|
||||
that.deduction = res.data.deduction;
|
||||
that.usableCoupon = res.data.usableCoupon || {};
|
||||
that.couponList = res.data.couponList
|
||||
that.addressInfo = res.data.addressInfo || {};
|
||||
that.systemStore = res.data.systemStore || {};
|
||||
that.storeSelfMention = res.data.storeSelfMention;
|
||||
that.computedPrice();
|
||||
that.couponId = uni.getStorageSync('couponId') || 0
|
||||
that.computedPrice()
|
||||
})
|
||||
.catch(err => {
|
||||
uni.showToast({
|
||||
@@ -471,13 +381,6 @@ export default {
|
||||
});
|
||||
},
|
||||
addressTap: function () {
|
||||
|
||||
// this.showAddress = true;
|
||||
// if (!this.addressLoaded) {
|
||||
// this.addressLoaded = true;
|
||||
// this.$refs.mychild.getAddressList();
|
||||
// }
|
||||
|
||||
//改用跳转页面方式
|
||||
this.$yrouter.push({
|
||||
path: "/pages/user/address/AddressManagement/index",
|
||||
@@ -485,34 +388,18 @@ export default {
|
||||
choosMode: 1
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
addressRedirect() {
|
||||
this.addressLoaded = false;
|
||||
this.showAddress = false;
|
||||
},
|
||||
couponTap: function () {
|
||||
this.showCoupon = true;
|
||||
},
|
||||
changeCoupon: function (coupon) {
|
||||
if (!coupon) {
|
||||
this.usableCoupon = {
|
||||
couponTitle: "不使用优惠券",
|
||||
id: 0
|
||||
};
|
||||
} else {
|
||||
this.usableCoupon = coupon;
|
||||
}
|
||||
this.computedPrice();
|
||||
},
|
||||
payItem: function (index) {
|
||||
this.active = index;
|
||||
},
|
||||
changeAddress(addressInfo) {
|
||||
this.addressInfo = addressInfo;
|
||||
//地址切换也要重新计算一下
|
||||
this.computedPrice();
|
||||
this.computedPrice('changeAddress');
|
||||
},
|
||||
pwdPopClose() {
|
||||
this.isShowPayPwdPop = false;
|
||||
@@ -527,17 +414,10 @@ export default {
|
||||
},
|
||||
// 支付密码输入确认
|
||||
onConfirm(e) {
|
||||
let password = e.value;
|
||||
|
||||
// if(password)
|
||||
console.log('password:' + password);
|
||||
|
||||
this.payPassword = password;
|
||||
this.payPassword = e.value;
|
||||
this.$refs.popup.close();//关闭支付密码弹窗
|
||||
this.$refs.secrity.clear();//清空支付密码
|
||||
this.createOrder(true);
|
||||
|
||||
|
||||
},
|
||||
subscribePay() {
|
||||
uni.requestSubscribeMessage({
|
||||
@@ -629,7 +509,7 @@ export default {
|
||||
phone: this.contactsTel,
|
||||
addressId: this.addressInfo.id,
|
||||
useIntegral: this.useIntegral ? 1 : 0,
|
||||
couponId: this.usableCoupon.id || 0,
|
||||
couponId: this.couponId || 0,
|
||||
payType: this.active,
|
||||
pinkId: this.pinkId,
|
||||
seckillId: this.orderGroupInfo.seckill_id,
|
||||
@@ -646,6 +526,7 @@ export default {
|
||||
if (this.active == 'yue') {
|
||||
params.passwordPay = this.payPassword;
|
||||
}
|
||||
uni.removeStorageSync('couponId')
|
||||
|
||||
var that = this;
|
||||
createOrder(this.orderGroupInfo.orderKey, params)
|
||||
@@ -731,12 +612,6 @@ export default {
|
||||
});
|
||||
});
|
||||
break;
|
||||
// 下面为原先微信支付方式,
|
||||
// pay(data.result.jsConfig).finally(() => {
|
||||
// this.$yrouter.replace({
|
||||
// path: "/pages/order/OrderDetails/index" ,query: { id: data.result.orderId}
|
||||
// });
|
||||
// });
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
@@ -755,12 +630,18 @@ export default {
|
||||
that.$refs.payPwdPop.clear();//清空支付密码
|
||||
that.$refs.payPwdPop.close();//关闭支付密码弹窗
|
||||
});
|
||||
}
|
||||
},
|
||||
// v9-2
|
||||
changeCoupons() {
|
||||
if (this.couponList.usable.length === 0) return
|
||||
this.show = !this.show
|
||||
this.couponId = uni.getStorageSync('couponId') || 0
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
|
||||
<style scoped lang="less">
|
||||
.pink-dot {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
@@ -829,15 +710,6 @@ export default {
|
||||
|
||||
.order-submission .allAddress {
|
||||
width: 100%;
|
||||
// background-image: linear-gradient(to bottom, #00c17b 0%, #00c17b 100%);
|
||||
// background-image: -webkit-linear-gradient(
|
||||
// to bottom,
|
||||
// #00c17b 0%,
|
||||
// #00c17b 100%
|
||||
// );
|
||||
// background-image: -moz-linear-gradient(to bottom, #00c17b 0%, #00c17b 100%);
|
||||
// padding-top: 1 * 100rpx;
|
||||
// padding-top: 40rpx;
|
||||
}
|
||||
|
||||
.order-submission .allAddress .nav {
|
||||
@@ -922,4 +794,12 @@ export default {
|
||||
.order-submission .wrapper .item .discount input::placeholder {
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.coupon-cell {
|
||||
margin-top: 12rpx;
|
||||
padding: 30rpx;
|
||||
border-radius: 16rpx;
|
||||
background-color: #FFFFFF;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -198,39 +198,27 @@
|
||||
<text v-if="tempName">{{ tempName }}</text>
|
||||
<text>销量:{{ dayInfo.sales }}{{ dayInfo.unitName }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 优惠券选择开始 -->
|
||||
<!-- <view
|
||||
class="coupon acea-row row-between-wrapper"
|
||||
@click="couponTap"
|
||||
v-if="couponList.length"
|
||||
>
|
||||
<text class="hide line1 acea-row">
|
||||
<text>优惠券:</text>
|
||||
<text
|
||||
class="activity"
|
||||
v-for="(item, couponListEq) in couponList"
|
||||
:key="couponListEq"
|
||||
>满{{ item.use_min_price }}减{{ item.coupon_price }}</text>
|
||||
</text>
|
||||
<view class="iconfont icon-jiantou"></view>
|
||||
</view> -->
|
||||
<!-- 优惠券选择结束 -->
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 已选规格开始 -->
|
||||
<!-- <view class="attribute acea-row row-between-wrapper" @click="selecAttrTap">-->
|
||||
<!-- <view>-->
|
||||
<!-- <text>{{ attrTxt }}:</text>-->
|
||||
<!-- <text class="atterTxt">{{ attrValue }}</text>-->
|
||||
<!-- </view>-->
|
||||
<!-- <view class="iconfont icon-jiantou"></view>-->
|
||||
<!-- </view>-->
|
||||
<!-- 已选规格结束 -->
|
||||
<!-- v9 优惠券开始 -->
|
||||
<u-popup :show="show" :round="10" mode="bottom" closeOnClickOverlay @close="changeCoupons()">
|
||||
<CouponsPopup :two-list="couponList" @close="changeCoupons"/>
|
||||
</u-popup>
|
||||
<!-- v9 优惠券结束 -->
|
||||
|
||||
<!-- v6服务项目开始 -->
|
||||
<view class="service-section goods-section" v-if="storeInfo && storeInfo.isTickets!=1">
|
||||
<view class="cell flex jc-between ai-center" @click="changeCoupons()" v-if="couponList['usable'].length>0">
|
||||
<view>
|
||||
<text class="coupon-label tc" v-for="(item,index) in couponList.usable" :key="index" v-if="index<2">
|
||||
{{ item.couponTitle }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="value">优惠详情
|
||||
<uni-icons type="right" size="13" color="#707070"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="cell flex jc-between ai-center" @click="selecAttrTap">
|
||||
<view class="flex ai-center">
|
||||
<view class="after-title">规格</view>
|
||||
@@ -459,7 +447,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<CouponPop v-on:changeFun="changeFun" :coupon="coupon"></CouponPop>
|
||||
<!-- <CouponPop v-on:changeFun="changeFun" :coupon="coupon"></CouponPop>-->
|
||||
<ProductWindow v-on:changeFun="changeFun" :attr="attr" :cartNum="cart_num"/>
|
||||
<StorePoster v-on:setPosterImageStatus="setPosterImageStatus" :posterImageStatus="posterImageStatus"
|
||||
:posterData="posterData" :goodId="id"></StorePoster>
|
||||
@@ -488,13 +476,12 @@
|
||||
<script>
|
||||
import ProductConSwiper from "@/components/ProductConSwiper";
|
||||
import UserEvaluation from "@/components/UserEvaluation";
|
||||
import CouponPop from "@/components/CouponPop";
|
||||
import ProductWindow from "@/components/ProductWindow";
|
||||
import StorePoster from "@/components/StorePoster";
|
||||
import ShareInfo from "@/components/ShareInfo";
|
||||
import CountDown from "@/components/CountDown";
|
||||
import {getCartCount, getProductCode, getProductDetail, postCartAdd} from "@/api/store";
|
||||
import {getCollectAdd, getCollectDel, getCoupon, userBindParent} from "@/api/user";
|
||||
import {userBindParent} from "@/api/user";
|
||||
import {handleQrCode, isWeixin} from "@/utils";
|
||||
import {getHomeData} from "@/api/public";
|
||||
import {getDailyGoods, getPreSale, getYxStoreSeckill} from "@/api/goods";
|
||||
@@ -503,6 +490,8 @@ import {diffDay, formatDateTime} from "@/utils/index";
|
||||
import {getCurAddress, getLocation, getUrlParam} from "@/utils/common.js";
|
||||
import cookie from "@/utils/store/cookie";
|
||||
import {famousGoodsShareImage, secKillGoodsShareImage} from "@/api/share";
|
||||
import CouponsPopup from "@/components/CouponsPopup.vue"
|
||||
import { formatContent } from '@/utils/util.js'
|
||||
|
||||
export default {
|
||||
name: "GoodsCon",
|
||||
@@ -510,10 +499,10 @@ export default {
|
||||
CountDown,
|
||||
ProductConSwiper,
|
||||
UserEvaluation,
|
||||
CouponPop,
|
||||
ProductWindow,
|
||||
StorePoster,
|
||||
ShareInfo
|
||||
ShareInfo,
|
||||
CouponsPopup
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
@@ -549,7 +538,7 @@ export default {
|
||||
killInfo: {},
|
||||
dayInfo: {},
|
||||
storeInfo: {},
|
||||
couponList: [],
|
||||
couponList: {},
|
||||
attrTxt: "请选择",
|
||||
attrValue: "",
|
||||
cart_num: 1, //购买数量
|
||||
@@ -581,7 +570,9 @@ export default {
|
||||
isWenwan: 0,
|
||||
postAddress: null,
|
||||
exSliceEnd: 3,
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
// v9-2
|
||||
show: false,
|
||||
};
|
||||
},
|
||||
computed: mapGetters(["isLogin", "location", "userInfo"]),
|
||||
@@ -597,12 +588,18 @@ export default {
|
||||
params += `&activityId=${this.activityId}`
|
||||
}
|
||||
|
||||
if (result.status === 200) {
|
||||
if (result?.status === 200) {
|
||||
resolve({
|
||||
title: this.storeInfo.storeName,
|
||||
path: '/pages/shop/GoodsCon/index' + params,
|
||||
imageUrl: result.data
|
||||
})
|
||||
} else {
|
||||
resolve({
|
||||
title: this.storeInfo.storeName,
|
||||
path: '/pages/shop/GoodsCon/index' + params,
|
||||
imageUrl: this.storeInfo.image
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -610,6 +607,7 @@ export default {
|
||||
// test data
|
||||
console.log("getLaunchOptionsSync", uni.getLaunchOptionsSync());
|
||||
console.log("getEnterOptionsSync", uni.getEnterOptionsSync());
|
||||
uni.removeStorageSync('couponId')
|
||||
|
||||
let url = handleQrCode();
|
||||
if (url && url.productId) {
|
||||
@@ -950,6 +948,10 @@ export default {
|
||||
if (this.$deviceType == "app") {
|
||||
from.from = "app";
|
||||
}
|
||||
if (that.source === 'kill') {
|
||||
from.seckillId = that.activityId
|
||||
}
|
||||
|
||||
uni.showLoading({
|
||||
title: "加载中",
|
||||
mask: true
|
||||
@@ -961,7 +963,7 @@ export default {
|
||||
// /\<img/gi,
|
||||
// '<img style="display:block;max-width:100%;height:auto;"'
|
||||
// );
|
||||
that.$set(that, "storeInfo", res.data.storeInfo);
|
||||
that.$set(that, "storeInfo", formatContent(res.data.storeInfo));
|
||||
that.isWenwan = res.data.isWenwan;
|
||||
|
||||
// 给 attr 赋值,将请求回来的规格赋值给 attr
|
||||
@@ -969,7 +971,11 @@ export default {
|
||||
that.$set(that.attr, "productAttr", res.data.productAttr);
|
||||
that.$set(that, "productValue", res.data.productValue);
|
||||
}
|
||||
that.attr.defaultSku = res.data.defaultSku
|
||||
that.attr.defaultSkuIndex = res.data.defaultSkuIndex
|
||||
|
||||
res.data.couponList['unusable']?.map(item => item.status = 2)
|
||||
that.$set(that, 'couponList', res.data.couponList)
|
||||
that.$set(that, "replyCount", res.data.replyCount);
|
||||
that.$set(that, "replyChance", res.data.replyChance);
|
||||
that.reply = res.data.reply ? [res.data.reply] : [];
|
||||
@@ -1028,11 +1034,14 @@ export default {
|
||||
let productAttr = this.attr.productAttr;
|
||||
let value = [];
|
||||
for (let i = 0; i < productAttr.length; i++) {
|
||||
this.$set(productAttr[i], "index", 0);
|
||||
value.push(productAttr[i].attrValueArr[0]);
|
||||
this.$set(productAttr[i], "index", this.attr.defaultSkuIndex[i]);
|
||||
value.push(productAttr[i].attrValueArr[1]);
|
||||
}
|
||||
//sort();排序函数:数字-英文-汉字;
|
||||
let productSelect = this.productValue[value.sort().join(",")];
|
||||
// let productSelect = this.productValue[value.sort().join(",")];
|
||||
|
||||
const skuKey = this.attr.defaultSku?.join(',')
|
||||
let productSelect = this.productValue[skuKey]
|
||||
if (productSelect && productAttr.length) {
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
@@ -1045,7 +1054,8 @@ export default {
|
||||
this.$set(this.attr.productSelect, "stock", productSelect.stock);
|
||||
this.$set(this.attr.productSelect, "unique", productSelect.unique);
|
||||
this.$set(this.attr.productSelect, "cart_num", 1);
|
||||
this.$set(this, "attrValue", value.sort().join(","));
|
||||
// this.$set(this, "attrValue", value.sort().join(","));
|
||||
this.$set(this, "attrValue", skuKey);
|
||||
this.$set(this, "attrTxt", "已选择");
|
||||
} else if (!productSelect && productAttr.length) {
|
||||
this.$set(
|
||||
@@ -1121,33 +1131,7 @@ export default {
|
||||
let value = opt.value === undefined ? "" : opt.value;
|
||||
this[action] && this[action](value);
|
||||
},
|
||||
//打开优惠券插件;
|
||||
couponTap: function () {
|
||||
let that = this;
|
||||
that.coupons();
|
||||
that.coupon.coupon = true;
|
||||
},
|
||||
changecoupon: function (msg) {
|
||||
this.coupon.coupon = msg;
|
||||
this.coupons();
|
||||
},
|
||||
currentcoupon: function (res) {
|
||||
let that = this;
|
||||
that.coupon.coupon = false;
|
||||
that.$set(that.coupon.list[res], "is_use", true);
|
||||
},
|
||||
//可领取优惠券接口;
|
||||
coupons: function () {
|
||||
let that = this,
|
||||
q = {
|
||||
page: 1,
|
||||
limit: 20
|
||||
};
|
||||
getCoupon(q).then(res => {
|
||||
that.$set(that, "couponList", res.data || []);
|
||||
that.$set(that.coupon, "list", res.data);
|
||||
});
|
||||
},
|
||||
|
||||
//打开属性插件;
|
||||
selecAttrTap: function () {
|
||||
this.attr.cartAttr = true;
|
||||
@@ -1184,21 +1168,6 @@ export default {
|
||||
this.$set(this, "attrTxt", "请选择");
|
||||
}
|
||||
},
|
||||
//收藏商品
|
||||
setCollect: function () {
|
||||
let that = this,
|
||||
id = that.storeInfo.id,
|
||||
category = "product";
|
||||
if (that.storeInfo.userCollect) {
|
||||
getCollectDel(id, category).then(function () {
|
||||
that.storeInfo.userCollect = !that.storeInfo.userCollect;
|
||||
});
|
||||
} else {
|
||||
getCollectAdd(id, category).then(function () {
|
||||
that.storeInfo.userCollect = !that.storeInfo.userCollect;
|
||||
});
|
||||
}
|
||||
},
|
||||
// 点击加入购物车按钮
|
||||
joinCart: function () {
|
||||
if (this.isOpen === true && this.attr.productSelect.stock === 0) return;
|
||||
@@ -1322,7 +1291,11 @@ export default {
|
||||
},
|
||||
listenerActionClose: function () {
|
||||
this.posters = false;
|
||||
}
|
||||
},
|
||||
// v9-2
|
||||
changeCoupons() {
|
||||
this.show = !this.show
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
<template>
|
||||
<view class="shoppingCart">
|
||||
<!-- <hx-navbar
|
||||
title="购物车"
|
||||
:fixed="true"
|
||||
:back="false"
|
||||
:left-slot="false"
|
||||
:right-slot="false"
|
||||
color="#ffffff"
|
||||
statusBarFontColor="#ffffff"
|
||||
:bgImgHeight="bgImgHeight"
|
||||
:background-color="[254,82,97]"
|
||||
:background-img="webUrl+'/20200729160752671638.png'"/> -->
|
||||
<hx-navbar
|
||||
title="购物车"
|
||||
:fixed="true"
|
||||
@@ -31,28 +20,11 @@
|
||||
<view>
|
||||
<text class="num" style="color: #666666;">共{{ count }}件商品</text>
|
||||
</view>
|
||||
<!-- <view
|
||||
v-if="cartList.valid.length > 0"
|
||||
class="administrate acea-row row-center-wrapper font-color-white"
|
||||
@click="manage"
|
||||
>{{ footerswitch ? '取消' : '管理' }}</view> -->
|
||||
<view class="top-delete-btn acea-row row-middle" @click="delgoods">
|
||||
<image class="delete-icon" :src="webUrl+'/20210806133058078099.png'" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
<view style="border-top: 1px solid #f5f5f5" v-if="$store.getters.token||userInfo.uid">
|
||||
<!-- <view style="margin-top: 80rpx;" v-if="$store.getters.token||userInfo.uid"> -->
|
||||
<!-- <view class="labelNav acea-row row-around row-middle">
|
||||
<view class="item">
|
||||
<text class="iconfont icon-xuanzhong"></text>100%正品保证
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="iconfont icon-xuanzhong"></text>所有商品精挑细选
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="iconfont icon-xuanzhong"></text>售后无忧
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view v-if="validList.length > 0 || cartList.invalid.length > 0">
|
||||
<view class="list">
|
||||
@@ -529,6 +501,14 @@ export default {
|
||||
plus: function (index) {
|
||||
let that = this;
|
||||
let list = that.cartList.valid[index];
|
||||
if (list.cartNum + 1 > list.trueStock) {
|
||||
uni.showToast({
|
||||
title: '该商品库存不足,无法继续增加',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
list.cartNum++;
|
||||
if (list.attrInfo) {
|
||||
if (list.cartNum >= list.attrInfo.stock) {
|
||||
|
||||
+13
-36
@@ -218,6 +218,14 @@
|
||||
</view>
|
||||
<view class="serviceList acea-row row-middle">
|
||||
|
||||
<view class="item" @click="goCoupons()">
|
||||
<view class="pictrue">
|
||||
<image :src="webUrl+'/20231130162907823563.png'"/>
|
||||
</view>
|
||||
<view class="cell">我的优惠券</view>
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view>
|
||||
|
||||
<view class="item" @click="goGroupManage()">
|
||||
<view class="pictrue">
|
||||
<image :src="webUrl+'/20221010165555111608.png'"/>
|
||||
@@ -280,39 +288,13 @@
|
||||
<view class="cell">客服历史会话</view>
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view>
|
||||
<!-- <template v-for="(item, MyMenusIndex) in MyMenus">
|
||||
<view
|
||||
class="item"
|
||||
:key="MyMenusIndex"
|
||||
@click="goPages(MyMenusIndex)"
|
||||
>
|
||||
<view class="pictrue">
|
||||
<image :src="item.pic" />
|
||||
</view>
|
||||
<view class="cell">{{ item.name }}</view>
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view>
|
||||
</template> -->
|
||||
|
||||
|
||||
<!-- <view class="item" @click="goPages2()">
|
||||
<view class="pictrue"></view>
|
||||
<view class="cell">hexiao</view>
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- 我的服务结束 -->
|
||||
|
||||
</view>
|
||||
<!-- <view class="by">
|
||||
<view>
|
||||
<text class="by-text">www.yixiang.co提供技术支持</text>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<uni-popup ref="popup" type="center">
|
||||
<!-- <view class="acea-row row-column row-middle" style="position: relative;background-color: #fff;width: 440rpx;border-radius: 20rpx;"> -->
|
||||
<view class="acea-row row-column row-middle"
|
||||
style="position: relative;background-color: #fff;border-radius: 20rpx;">
|
||||
<view class="acea-row row-center" style="border-radius: 50%;margin-top: -52rpx;background-color: #fff;">
|
||||
@@ -626,6 +608,11 @@ export default {
|
||||
// }
|
||||
// })
|
||||
},
|
||||
goCoupons() {
|
||||
uni.navigateTo({
|
||||
url: '/pkg_user/views/myCoupons'
|
||||
})
|
||||
},
|
||||
goGroupManage() {
|
||||
this.$yrouter.push("/pages/user/promotion/UserPromotion/index");
|
||||
},
|
||||
@@ -924,16 +911,6 @@ page {
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.by {
|
||||
text-align: center;
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
|
||||
.by-text {
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.header {
|
||||
background: linear-gradient(90deg, rgba(254, 150, 107, 1) 0%, rgba(255, 88, 75, 1) 100%);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
<view class="article-box">
|
||||
<view class="line-location flex ai-center">
|
||||
<image :src="webUrl+'/20220903142929759087.png'" mode="scaleToFill"></image>
|
||||
<text class="bold" @click="goCity">当前城市:{{ cityName }}</text>
|
||||
<!-- @click="goCity"-->
|
||||
<text class="bold">当前城市:{{ cityName }}</text>
|
||||
</view>
|
||||
|
||||
<scroll-view class="list flex flex-wrap" :style="{'height':listHeight}" :enable-flex="true"
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
<template>
|
||||
<view class="pkg-user-coupons">
|
||||
<SubSection :current="current" :can-use="canUse" :not-use="notUse" @change="changeNav"/>
|
||||
|
||||
<Coupons class="coupons" :data="item" v-for="(item,index) in list" :key="index"/>
|
||||
|
||||
<image class="zero-coupons" :src="webUrl+'/20231201201733142658.png'" mode="scaleToFill" v-if="list.length===0"/>
|
||||
<!-- <view>-->
|
||||
<!-- <button @tap="startRecord">开始录音</button>-->
|
||||
<!-- <button @tap="endRecord">停止录音</button>-->
|
||||
<!-- <button @tap="playVoice">播放录音</button>-->
|
||||
<!-- </view>-->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SubSection from "@/components/SubSection.vue";
|
||||
import Coupons from "@/components/Coupons.vue";
|
||||
import {getCouponsUser} from "@/api/user";
|
||||
|
||||
const recorderManager = uni.getRecorderManager();
|
||||
const innerAudioContext = uni.createInnerAudioContext();
|
||||
|
||||
innerAudioContext.autoplay = true;
|
||||
|
||||
export default {
|
||||
name: "myCoupons",
|
||||
components: {SubSection, Coupons},
|
||||
data() {
|
||||
return {
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
voicePath: '',
|
||||
current: 0,
|
||||
canUse: 0,
|
||||
notUse: 0,
|
||||
list: []
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// let self = this;
|
||||
// recorderManager.onStop(function (res) {
|
||||
// console.log('recorder stop' + JSON.stringify(res));
|
||||
// self.voicePath = res.tempFilePath;
|
||||
// });
|
||||
|
||||
this.fetchList(1)
|
||||
this.fetchList(2)
|
||||
},
|
||||
methods: {
|
||||
startRecord() {
|
||||
console.log('开始录音');
|
||||
|
||||
recorderManager.start();
|
||||
},
|
||||
endRecord() {
|
||||
console.log('录音结束');
|
||||
recorderManager.stop();
|
||||
},
|
||||
playVoice() {
|
||||
console.log('播放录音');
|
||||
|
||||
if (this.voicePath) {
|
||||
innerAudioContext.src = this.voicePath;
|
||||
innerAudioContext.play();
|
||||
}
|
||||
},
|
||||
|
||||
changeNav(index) {
|
||||
this.current = index
|
||||
this.fetchList(index + 1)
|
||||
},
|
||||
fetchList(type) {
|
||||
// type 1-可使用,2-已到期
|
||||
getCouponsUser(type).then(({data}) => {
|
||||
if (this.current + 1 === type) this.list = data
|
||||
this.list?.forEach(item => {
|
||||
item.isOpen = false
|
||||
})
|
||||
if (type === 1) this.canUse = data.length
|
||||
if (type === 2) this.notUse = data.length
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.pkg-user-coupons {
|
||||
padding: 40rpx 32rpx;
|
||||
|
||||
/deep/ .components-coupons {
|
||||
margin-top: 32rpx;
|
||||
}
|
||||
|
||||
.zero-coupons {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%,-50%);
|
||||
width: 400rpx;
|
||||
height: 366rpx;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 www.uviewui.com
|
||||
Copyright (c) 2023 www.uviewui.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
SOFTWARE.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
## 2.0.34(2022-09-25)
|
||||
## 2.0.36(2023-03-27)
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖
|
||||
|
||||
1. 重构`deepClone` & `deepMerge`方法
|
||||
2. 其他优化
|
||||
## 2.0.34(2022-09-24)
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖
|
||||
|
||||
1. `u-input`、`u-textarea`增加`ignoreCompositionEvent`属性
|
||||
|
||||
@@ -211,7 +211,7 @@ export default {
|
||||
let style = {};
|
||||
if (this.color) {
|
||||
// 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色
|
||||
style.color = this.plain ? this.color : "#EEEEEE";
|
||||
style.color = this.plain ? this.color : "white";
|
||||
if (!this.plain) {
|
||||
// 非镂空,背景色使用自定义的颜色
|
||||
style["background-color"] = this.color;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
class="u-calendar-header__subtitle"
|
||||
v-if="showSubtitle"
|
||||
>{{ subtitle }}</text>
|
||||
<!-- <view class="u-calendar-header__weekdays">
|
||||
<view class="u-calendar-header__weekdays">
|
||||
<text class="u-calendar-header__weekdays__weekday">一</text>
|
||||
<text class="u-calendar-header__weekdays__weekday">二</text>
|
||||
<text class="u-calendar-header__weekdays__weekday">三</text>
|
||||
@@ -16,7 +16,7 @@
|
||||
<text class="u-calendar-header__weekdays__weekday">五</text>
|
||||
<text class="u-calendar-header__weekdays__weekday">六</text>
|
||||
<text class="u-calendar-header__weekdays__weekday">日</text>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -10,37 +10,15 @@
|
||||
<view class="u-calendar-month__days__day" v-for="(item1, index1) in item.date" :key="index1"
|
||||
:style="[dayStyle(index, index1, item1)]" @tap="clickHandler(index, index1, item1)"
|
||||
:class="[item1.selected && 'u-calendar-month__days__day__select--selected']">
|
||||
<view class="u-calendar-month__days__day__select flex-column" >
|
||||
<view class="u-calendar-month__days__day__select__info day-info"
|
||||
<view class="u-calendar-month__days__day__select" :style="[daySelectStyle(index, index1, item1)]">
|
||||
<text class="u-calendar-month__days__day__select__info"
|
||||
:class="[item1.disabled && 'u-calendar-month__days__day__select__info--disabled']"
|
||||
:style="[daySelectStyle(index, index1, item1)]">
|
||||
<text :style="[textStyle(item1)]">
|
||||
{{ item1.day }}
|
||||
</text>
|
||||
</view>
|
||||
<!-- <text v-if="getBottomInfo(index, index1, item1)"
|
||||
:style="[textStyle(item1)]">{{ item1.day }}</text>
|
||||
<text v-if="getBottomInfo(index, index1, item1)"
|
||||
class="u-calendar-month__days__day__select__buttom-info"
|
||||
:class="[item1.disabled && 'u-calendar-month__days__day__select__buttom-info--disabled']"
|
||||
:style="[textStyle(item1)]">{{ getBottomInfo(index, index1, item1) }}</text> -->
|
||||
<!-- <text v-if="item1.dot" class="u-calendar-month__days__day__select__dot"></text> -->
|
||||
<view class="align-center justify-around" v-if="getBottomInfo(index, index1, item1).text">
|
||||
<text
|
||||
class="font-sm mr-1"
|
||||
:class="[
|
||||
{'grey--text' : getBottomInfo(index, index1, item1).status == 0 },
|
||||
{'error--text' : getBottomInfo(index, index1, item1).status == 1 },
|
||||
{'success--text' : getBottomInfo(index, index1, item1).status == 2 }]"
|
||||
>
|
||||
{{ getBottomInfo(index, index1, item1).text }}
|
||||
</text>
|
||||
<text
|
||||
v-if="item1.dot"
|
||||
:class="[
|
||||
{'grey' : getBottomInfo(index, index1, item1).status == 0 },
|
||||
{'error' : getBottomInfo(index, index1, item1).status == 1 },
|
||||
{'success' : getBottomInfo(index, index1, item1).status == 2 }]"
|
||||
class="day_dot" ></text>
|
||||
</view>
|
||||
:style="[textStyle(item1)]">{{ getBottomInfo(index, index1, item1) }}</text>
|
||||
<text v-if="item1.dot" class="u-calendar-month__days__day__select__dot"></text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -203,11 +181,10 @@
|
||||
if (this.mode === 'single') {
|
||||
if (date === this.selected[0]) {
|
||||
// 因为需要对nvue的兼容,只能这么写,无法缩写,也无法通过类名控制等等
|
||||
style.borderRadius = '50%'
|
||||
// style.borderTopLeftRadius = '3px'
|
||||
// style.borderBottomLeftRadius = '3px'
|
||||
// style.borderTopRightRadius = '3px'
|
||||
// style.borderBottomRightRadius = '3px'
|
||||
style.borderTopLeftRadius = '3px'
|
||||
style.borderBottomLeftRadius = '3px'
|
||||
style.borderTopRightRadius = '3px'
|
||||
style.borderBottomRightRadius = '3px'
|
||||
}
|
||||
} else if (this.mode === 'range') {
|
||||
if (this.selected.length >= 2) {
|
||||
@@ -373,7 +350,6 @@
|
||||
},
|
||||
// 点击某一个日期
|
||||
clickHandler(index1, index2, item) {
|
||||
this.$emit('select', item)
|
||||
if (this.readonly) {
|
||||
return;
|
||||
}
|
||||
@@ -478,25 +454,7 @@
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "../../libs/css/components.scss";
|
||||
.align-center{
|
||||
flex-direction: row !important;
|
||||
align-items: center !important;
|
||||
}
|
||||
.day-info{
|
||||
background: #Fff;
|
||||
border-radius: 50%;
|
||||
height: 60rpx;
|
||||
width: 60rpx;
|
||||
line-height: 60rpx;
|
||||
}
|
||||
.flex-column{
|
||||
flex-direction: column !important
|
||||
}
|
||||
.day_dot{
|
||||
width: 30rpx;
|
||||
height: 15rpx;
|
||||
border-radius: 15rpx;
|
||||
}
|
||||
|
||||
.u-calendar-month-wrapper {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
:maxMonth="monthNum"
|
||||
:readonly="readonly"
|
||||
:maxRange="maxRange"
|
||||
@select="$emit('select', $event)"
|
||||
:rangePrompt="rangePrompt"
|
||||
:showRangePrompt="showRangePrompt"
|
||||
:allowSameDay="allowSameDay"
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<slot name="right-icon" v-if="$slots['right-icon']">
|
||||
</slot>
|
||||
<u-icon v-else :name="rightIcon" :custom-style="rightIconStyle" :color="disabled ? '#c8c9cc' : 'info'"
|
||||
:size="size === 'large' ? 36 : 32"></u-icon>
|
||||
:size="size === 'large' ? 18 : 16"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<u-line v-if="border"></u-line>
|
||||
|
||||
@@ -210,5 +210,5 @@ export default {
|
||||
'uicon-man-delete': '\ue61a',
|
||||
'uicon-man-delete-fill': '\ue66a',
|
||||
'uicon-zh': '\ue70a',
|
||||
'uicon-en': '\ue692',
|
||||
'uicon-en': '\ue692'
|
||||
}
|
||||
|
||||
@@ -23,13 +23,13 @@
|
||||
v-if="label !== ''"
|
||||
class="u-icon__label"
|
||||
:style="{
|
||||
color: labelColor,
|
||||
fontSize: $u.addUnit(labelSize),
|
||||
marginLeft: labelPos == 'right' ? $u.addUnit(space) : 0,
|
||||
marginTop: labelPos == 'bottom' ? $u.addUnit(space) : 0,
|
||||
marginRight: labelPos == 'left' ? $u.addUnit(space) : 0,
|
||||
marginBottom: labelPos == 'top' ? $u.addUnit(space) : 0,
|
||||
}"
|
||||
color: labelColor,
|
||||
fontSize: $u.addUnit(labelSize),
|
||||
marginLeft: labelPos == 'right' ? $u.addUnit(space) : 0,
|
||||
marginTop: labelPos == 'bottom' ? $u.addUnit(space) : 0,
|
||||
marginRight: labelPos == 'left' ? $u.addUnit(space) : 0,
|
||||
marginBottom: labelPos == 'top' ? $u.addUnit(space) : 0,
|
||||
}"
|
||||
>{{ label }}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
* @event {Function} confirm 点击确认按钮时触发
|
||||
* @event {Function} cancel 点击取消按钮时触发
|
||||
* @event {Function} close 点击遮罩关闭出发,closeOnClickOverlay为true有效
|
||||
* @example <u-loadmore :status="status" icon-type="iconType" load-text="loadText" />
|
||||
* @example <u-modal :show="true" title="title" content="content"></u-modal>
|
||||
*/
|
||||
export default {
|
||||
name: 'u-modal',
|
||||
@@ -146,7 +146,7 @@
|
||||
},
|
||||
// 点击遮罩
|
||||
// 从原理上来说,modal的遮罩点击,并不是真的点击到了遮罩
|
||||
// 因为modal依赖于popup的中部弹窗类型,中部弹窗比较特殊,虽有然遮罩,但是为了让弹窗内容能flex居中
|
||||
// 因为modal依赖于popup的中部弹窗类型,中部弹窗比较特殊,虽然有遮罩,但是为了让弹窗内容能flex居中
|
||||
// 多了一个透明的遮罩,此透明的遮罩会覆盖在灰色的遮罩上,所以实际上是点击不到灰色遮罩的,popup内部在
|
||||
// 透明遮罩的子元素做了.stop处理,所以点击内容区,也不会导致误触发
|
||||
clickHandler() {
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
export default {
|
||||
props: {
|
||||
// 是否两行
|
||||
isTwoLine: {
|
||||
default: false
|
||||
},
|
||||
twoLineText: {
|
||||
default: ''
|
||||
},
|
||||
// 是否开启顶部安全区适配
|
||||
safeAreaInsetTop: {
|
||||
type: Boolean,
|
||||
|
||||
@@ -43,17 +43,12 @@
|
||||
</slot>
|
||||
</view>
|
||||
<slot name="center">
|
||||
<view class="flex-column">
|
||||
<text
|
||||
class="u-line-1 u-navbar__content__title"
|
||||
:style="[{
|
||||
width: $u.addUnit(titleWidth),
|
||||
}, $u.addStyle(titleStyle)]"
|
||||
>{{ title }}</text>
|
||||
<text class="u-line-1 u-navbar__content__title font-xs grey--text" v-if="isTwoLine">
|
||||
{{ twoLineText }}
|
||||
</text>
|
||||
</view>
|
||||
<text
|
||||
class="u-line-1 u-navbar__content__title"
|
||||
:style="[{
|
||||
width: $u.addUnit(titleWidth),
|
||||
}, $u.addStyle(titleStyle)]"
|
||||
>{{ title }}</text>
|
||||
</slot>
|
||||
<view
|
||||
class="u-navbar__content__right"
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<u-icon
|
||||
name="close"
|
||||
color="#909399"
|
||||
size="36"
|
||||
size="18"
|
||||
bold
|
||||
></u-icon>
|
||||
</view>
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
},
|
||||
// 组件选中激活时的颜色
|
||||
elActiveColor() {
|
||||
return this.activeColor ? this.activeColor : (this.parentData.activeColor ? this.parentData.activeColor : '#0052D9');
|
||||
return this.activeColor ? this.activeColor : (this.parentData.activeColor ? this.parentData.activeColor : '#2979ff');
|
||||
},
|
||||
// 组件选未中激活时的颜色
|
||||
elInactiveColor() {
|
||||
@@ -246,7 +246,7 @@
|
||||
$u-radio-square-border-radius:3px !default;
|
||||
$u-radio-checked-color:#fff !default;
|
||||
$u-radio-checked-background-color:red !default;
|
||||
$u-radio-checked-border-color: #0052D9 !default;
|
||||
$u-radio-checked-border-color: #2979ff !default;
|
||||
$u-radio-disabled-background-color:#ebedf0 !default;
|
||||
$u-radio-disabled--checked-color:#c8c9cc !default;
|
||||
$u-radio-label-margin-left: 5px !default;
|
||||
|
||||
@@ -10,10 +10,6 @@ export default {
|
||||
icon: String,
|
||||
default: uni.$u.props.tabbarItem.icon
|
||||
},
|
||||
iconSize: {
|
||||
icon: String,
|
||||
default: 20
|
||||
},
|
||||
// 右上角的角标提示信息
|
||||
badge: {
|
||||
type: [String, Number, null],
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
v-if="icon"
|
||||
:name="icon"
|
||||
:color="isActive? parentData.activeColor : parentData.inactiveColor"
|
||||
:size="iconSize"
|
||||
:size="20"
|
||||
></u-icon>
|
||||
<template v-else>
|
||||
<slot
|
||||
|
||||
@@ -83,7 +83,7 @@ export default {
|
||||
},
|
||||
// 文字装饰,下划线,中划线等,可选值 none|underline|line-through
|
||||
decoration: {
|
||||
tepe: String,
|
||||
type: String,
|
||||
default: uni.$u.props.text.decoration
|
||||
},
|
||||
// 外边距,对象、字符串,数值形式均可
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 此版本发布于2022-00-24
|
||||
const version = '2.0.34'
|
||||
// 此版本发布于2023-03-27
|
||||
const version = '2.0.36'
|
||||
|
||||
// 开发环境才提示,生产环境不会提示
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
|
||||
@@ -2,8 +2,8 @@ import test from './test.js'
|
||||
import { round } from './digit.js'
|
||||
/**
|
||||
* @description 如果value小于min,取min;如果value大于max,取max
|
||||
* @param {number} min
|
||||
* @param {number} max
|
||||
* @param {number} min
|
||||
* @param {number} max
|
||||
* @param {number} value
|
||||
*/
|
||||
function range(min = 0, max = 0, value = 0) {
|
||||
@@ -13,7 +13,7 @@ function range(min = 0, max = 0, value = 0) {
|
||||
/**
|
||||
* @description 用于获取用户传递值的px值 如果用户传递了"xxpx"或者"xxrpx",取出其数值部分,如果是"xxxrpx"还需要用过uni.upx2px进行转换
|
||||
* @param {number|string} value 用户传递值的px值
|
||||
* @param {boolean} unit
|
||||
* @param {boolean} unit
|
||||
* @returns {number|string}
|
||||
*/
|
||||
function getPx(value, unit = false) {
|
||||
@@ -41,7 +41,7 @@ function sleep(value = 30) {
|
||||
}
|
||||
/**
|
||||
* @description 运行期判断平台
|
||||
* @returns {string} 返回所在平台(小写)
|
||||
* @returns {string} 返回所在平台(小写)
|
||||
* @link 运行期判断平台 https://uniapp.dcloud.io/frame?id=判断平台
|
||||
*/
|
||||
function os() {
|
||||
@@ -49,7 +49,7 @@ function os() {
|
||||
}
|
||||
/**
|
||||
* @description 获取系统信息同步接口
|
||||
* @link 获取系统信息同步接口 https://uniapp.dcloud.io/api/system/info?id=getsysteminfosync
|
||||
* @link 获取系统信息同步接口 https://uniapp.dcloud.io/api/system/info?id=getsysteminfosync
|
||||
*/
|
||||
function sys() {
|
||||
return uni.getSystemInfoSync()
|
||||
@@ -179,22 +179,34 @@ function addUnit(value = 'auto', unit = uni?.$u?.config?.unit ?? 'px') {
|
||||
/**
|
||||
* @description 深度克隆
|
||||
* @param {object} obj 需要深度克隆的对象
|
||||
* @param cache 缓存
|
||||
* @returns {*} 克隆后的对象或者原值(不是对象)
|
||||
*/
|
||||
function deepClone(obj) {
|
||||
// 对常见的“非”值,直接返回原来值
|
||||
if ([null, undefined, NaN, false].includes(obj)) return obj
|
||||
if (typeof obj !== 'object' && typeof obj !== 'function') {
|
||||
// 原始类型直接返回
|
||||
return obj
|
||||
}
|
||||
const o = test.array(obj) ? [] : {}
|
||||
for (const i in obj) {
|
||||
if (obj.hasOwnProperty(i)) {
|
||||
o[i] = typeof obj[i] === 'object' ? deepClone(obj[i]) : obj[i]
|
||||
function deepClone(obj, cache = new WeakMap()) {
|
||||
if (obj === null || typeof obj !== 'object') return obj;
|
||||
if (cache.has(obj)) return cache.get(obj);
|
||||
let clone;
|
||||
if (obj instanceof Date) {
|
||||
clone = new Date(obj.getTime());
|
||||
} else if (obj instanceof RegExp) {
|
||||
clone = new RegExp(obj);
|
||||
} else if (obj instanceof Map) {
|
||||
clone = new Map(Array.from(obj, ([key, value]) => [key, deepClone(value, cache)]));
|
||||
} else if (obj instanceof Set) {
|
||||
clone = new Set(Array.from(obj, value => deepClone(value, cache)));
|
||||
} else if (Array.isArray(obj)) {
|
||||
clone = obj.map(value => deepClone(value, cache));
|
||||
} else if (Object.prototype.toString.call(obj) === '[object Object]') {
|
||||
clone = Object.create(Object.getPrototypeOf(obj));
|
||||
cache.set(obj, clone);
|
||||
for (const [key, value] of Object.entries(obj)) {
|
||||
clone[key] = deepClone(value, cache);
|
||||
}
|
||||
} else {
|
||||
clone = Object.assign({}, obj);
|
||||
}
|
||||
return o
|
||||
cache.set(obj, clone);
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -205,24 +217,27 @@ function deepClone(obj) {
|
||||
*/
|
||||
function deepMerge(target = {}, source = {}) {
|
||||
target = deepClone(target)
|
||||
if (typeof target !== 'object' || typeof source !== 'object') return false
|
||||
if (typeof target !== 'object' || target === null || typeof source !== 'object' || source === null) return target;
|
||||
const merged = Array.isArray(target) ? target.slice() : Object.assign({}, target);
|
||||
for (const prop in source) {
|
||||
if (!source.hasOwnProperty(prop)) continue
|
||||
if (prop in target) {
|
||||
if (typeof target[prop] !== 'object') {
|
||||
target[prop] = source[prop]
|
||||
} else if (typeof source[prop] !== 'object') {
|
||||
target[prop] = source[prop]
|
||||
} else if (target[prop].concat && source[prop].concat) {
|
||||
target[prop] = target[prop].concat(source[prop])
|
||||
} else {
|
||||
target[prop] = deepMerge(target[prop], source[prop])
|
||||
}
|
||||
if (!source.hasOwnProperty(prop)) continue;
|
||||
const sourceValue = source[prop];
|
||||
const targetValue = merged[prop];
|
||||
if (sourceValue instanceof Date) {
|
||||
merged[prop] = new Date(sourceValue);
|
||||
} else if (sourceValue instanceof RegExp) {
|
||||
merged[prop] = new RegExp(sourceValue);
|
||||
} else if (sourceValue instanceof Map) {
|
||||
merged[prop] = new Map(sourceValue);
|
||||
} else if (sourceValue instanceof Set) {
|
||||
merged[prop] = new Set(sourceValue);
|
||||
} else if (typeof sourceValue === 'object' && sourceValue !== null) {
|
||||
merged[prop] = deepMerge(targetValue, sourceValue);
|
||||
} else {
|
||||
target[prop] = source[prop]
|
||||
merged[prop] = sourceValue;
|
||||
}
|
||||
}
|
||||
return target
|
||||
return merged;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -327,7 +342,7 @@ if (!String.prototype.padStart) {
|
||||
/**
|
||||
* @description 时间戳转为多久之前
|
||||
* @param {String|Number} timestamp 时间戳
|
||||
* @param {String|Boolean} format
|
||||
* @param {String|Boolean} format
|
||||
* 格式化规则如果为时间格式字符串,超出一定时间范围,返回固定的时间格式;
|
||||
* 如果为布尔值false,无论什么时间,都返回多久以前的格式
|
||||
* @returns {string} 转化后的内容
|
||||
@@ -517,7 +532,7 @@ function priceFormat(number, decimals = 0, decimalPoint = '.', thousandsSeparato
|
||||
while (re.test(s[0])) {
|
||||
s[0] = s[0].replace(re, `$1${sep}$2`)
|
||||
}
|
||||
|
||||
|
||||
if ((s[1] || '').length < prec) {
|
||||
s[1] = s[1] || ''
|
||||
s[1] += new Array(prec - s[1].length + 1).join('0')
|
||||
@@ -531,7 +546,7 @@ function priceFormat(number, decimals = 0, decimalPoint = '.', thousandsSeparato
|
||||
* 比如以30位阈值,那么300大于30,可以理解为用户想要的是300ms,而不是想花300s去执行一个动画
|
||||
* @param {String|number} value 比如: "1s"|"100ms"|1|100
|
||||
* @param {boolean} unit 提示: 如果是false 默认返回number
|
||||
* @return {string|number}
|
||||
* @return {string|number}
|
||||
*/
|
||||
function getDuration(value, unit = true) {
|
||||
const valueNum = parseInt(value)
|
||||
@@ -650,6 +665,16 @@ function pages() {
|
||||
return pages
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取页面历史栈指定层实例
|
||||
* @param back {number} [0] - 0或者负数,表示获取历史栈的哪一层,0表示获取当前页面实例,-1 表示获取上一个页面实例。默认0。
|
||||
*/
|
||||
function getHistoryPage(back = 0) {
|
||||
const pages = getCurrentPages()
|
||||
const len = pages.length
|
||||
return pages[len - 1 + back]
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 修改uView内置属性值
|
||||
* @param {object} props 修改内置props属性
|
||||
@@ -701,5 +726,6 @@ export default {
|
||||
setProperty,
|
||||
page,
|
||||
pages,
|
||||
getHistoryPage,
|
||||
setConfig
|
||||
}
|
||||
|
||||
@@ -4,121 +4,121 @@
|
||||
*/
|
||||
|
||||
class Router {
|
||||
constructor() {
|
||||
// 原始属性定义
|
||||
this.config = {
|
||||
type: 'navigateTo',
|
||||
url: '',
|
||||
delta: 1, // navigateBack页面后退时,回退的层数
|
||||
params: {}, // 传递的参数
|
||||
animationType: 'pop-in', // 窗口动画,只在APP有效
|
||||
animationDuration: 300, // 窗口动画持续时间,单位毫秒,只在APP有效
|
||||
intercept: false // 是否需要拦截
|
||||
}
|
||||
// 因为route方法是需要对外赋值给另外的对象使用,同时route内部有使用this,会导致route失去上下文
|
||||
// 这里在构造函数中进行this绑定
|
||||
this.route = this.route.bind(this)
|
||||
}
|
||||
constructor() {
|
||||
// 原始属性定义
|
||||
this.config = {
|
||||
type: 'navigateTo',
|
||||
url: '',
|
||||
delta: 1, // navigateBack页面后退时,回退的层数
|
||||
params: {}, // 传递的参数
|
||||
animationType: 'pop-in', // 窗口动画,只在APP有效
|
||||
animationDuration: 300, // 窗口动画持续时间,单位毫秒,只在APP有效
|
||||
intercept: false // 是否需要拦截
|
||||
}
|
||||
// 因为route方法是需要对外赋值给另外的对象使用,同时route内部有使用this,会导致route失去上下文
|
||||
// 这里在构造函数中进行this绑定
|
||||
this.route = this.route.bind(this)
|
||||
}
|
||||
|
||||
// 判断url前面是否有"/",如果没有则加上,否则无法跳转
|
||||
addRootPath(url) {
|
||||
return url[0] === '/' ? url : `/${url}`
|
||||
}
|
||||
// 判断url前面是否有"/",如果没有则加上,否则无法跳转
|
||||
addRootPath(url) {
|
||||
return url[0] === '/' ? url : `/${url}`
|
||||
}
|
||||
|
||||
// 整合路由参数
|
||||
mixinParam(url, params) {
|
||||
url = url && this.addRootPath(url)
|
||||
// 整合路由参数
|
||||
mixinParam(url, params) {
|
||||
url = url && this.addRootPath(url)
|
||||
|
||||
// 使用正则匹配,主要依据是判断是否有"/","?","="等,如“/page/index/index?name=mary"
|
||||
// 如果有url中有get参数,转换后无需带上"?"
|
||||
let query = ''
|
||||
if (/.*\/.*\?.*=.*/.test(url)) {
|
||||
// object对象转为get类型的参数
|
||||
query = uni.$u.queryParams(params, false)
|
||||
// 因为已有get参数,所以后面拼接的参数需要带上"&"隔开
|
||||
return url += `&${query}`
|
||||
}
|
||||
// 直接拼接参数,因为此处url中没有后面的query参数,也就没有"?/&"之类的符号
|
||||
query = uni.$u.queryParams(params)
|
||||
return url += query
|
||||
}
|
||||
// 使用正则匹配,主要依据是判断是否有"/","?","="等,如“/page/index/index?name=mary"
|
||||
// 如果有url中有get参数,转换后无需带上"?"
|
||||
let query = ''
|
||||
if (/.*\/.*\?.*=.*/.test(url)) {
|
||||
// object对象转为get类型的参数
|
||||
query = uni.$u.queryParams(params, false)
|
||||
// 因为已有get参数,所以后面拼接的参数需要带上"&"隔开
|
||||
return url += `&${query}`
|
||||
}
|
||||
// 直接拼接参数,因为此处url中没有后面的query参数,也就没有"?/&"之类的符号
|
||||
query = uni.$u.queryParams(params)
|
||||
return url += query
|
||||
}
|
||||
|
||||
// 对外的方法名称
|
||||
async route(options = {}, params = {}) {
|
||||
// 合并用户的配置和内部的默认配置
|
||||
let mergeConfig = {}
|
||||
// 对外的方法名称
|
||||
async route(options = {}, params = {}) {
|
||||
// 合并用户的配置和内部的默认配置
|
||||
let mergeConfig = {}
|
||||
|
||||
if (typeof options === 'string') {
|
||||
// 如果options为字符串,则为route(url, params)的形式
|
||||
mergeConfig.url = this.mixinParam(options, params)
|
||||
mergeConfig.type = 'navigateTo'
|
||||
} else {
|
||||
mergeConfig = uni.$u.deepMerge(options, this.config)
|
||||
// 否则正常使用mergeConfig中的url和params进行拼接
|
||||
mergeConfig.url = this.mixinParam(options.url, options.params)
|
||||
}
|
||||
if (typeof options === 'string') {
|
||||
// 如果options为字符串,则为route(url, params)的形式
|
||||
mergeConfig.url = this.mixinParam(options, params)
|
||||
mergeConfig.type = 'navigateTo'
|
||||
} else {
|
||||
mergeConfig = uni.$u.deepMerge(this.config, options)
|
||||
// 否则正常使用mergeConfig中的url和params进行拼接
|
||||
mergeConfig.url = this.mixinParam(options.url, options.params)
|
||||
}
|
||||
|
||||
// 如果本次跳转的路径和本页面路径一致,不执行跳转,防止用户快速点击跳转按钮,造成多次跳转同一个页面的问题
|
||||
if (mergeConfig.url === uni.$u.page()) return
|
||||
// 如果本次跳转的路径和本页面路径一致,不执行跳转,防止用户快速点击跳转按钮,造成多次跳转同一个页面的问题
|
||||
if (mergeConfig.url === uni.$u.page()) return
|
||||
|
||||
if (params.intercept) {
|
||||
this.config.intercept = params.intercept
|
||||
}
|
||||
// params参数也带给拦截器
|
||||
mergeConfig.params = params
|
||||
// 合并内外部参数
|
||||
mergeConfig = uni.$u.deepMerge(this.config, mergeConfig)
|
||||
// 判断用户是否定义了拦截器
|
||||
if (typeof uni.$u.routeIntercept === 'function') {
|
||||
// 定一个promise,根据用户执行resolve(true)或者resolve(false)来决定是否进行路由跳转
|
||||
const isNext = await new Promise((resolve, reject) => {
|
||||
uni.$u.routeIntercept(mergeConfig, resolve)
|
||||
})
|
||||
// 如果isNext为true,则执行路由跳转
|
||||
isNext && this.openPage(mergeConfig)
|
||||
} else {
|
||||
this.openPage(mergeConfig)
|
||||
}
|
||||
}
|
||||
if (params.intercept) {
|
||||
this.config.intercept = params.intercept
|
||||
}
|
||||
// params参数也带给拦截器
|
||||
mergeConfig.params = params
|
||||
// 合并内外部参数
|
||||
mergeConfig = uni.$u.deepMerge(this.config, mergeConfig)
|
||||
// 判断用户是否定义了拦截器
|
||||
if (typeof uni.$u.routeIntercept === 'function') {
|
||||
// 定一个promise,根据用户执行resolve(true)或者resolve(false)来决定是否进行路由跳转
|
||||
const isNext = await new Promise((resolve, reject) => {
|
||||
uni.$u.routeIntercept(mergeConfig, resolve)
|
||||
})
|
||||
// 如果isNext为true,则执行路由跳转
|
||||
isNext && this.openPage(mergeConfig)
|
||||
} else {
|
||||
this.openPage(mergeConfig)
|
||||
}
|
||||
}
|
||||
|
||||
// 执行路由跳转
|
||||
openPage(config) {
|
||||
// 解构参数
|
||||
const {
|
||||
url,
|
||||
type,
|
||||
delta,
|
||||
animationType,
|
||||
animationDuration
|
||||
} = config
|
||||
if (config.type == 'navigateTo' || config.type == 'to') {
|
||||
uni.navigateTo({
|
||||
url,
|
||||
animationType,
|
||||
animationDuration
|
||||
})
|
||||
}
|
||||
if (config.type == 'redirectTo' || config.type == 'redirect') {
|
||||
uni.redirectTo({
|
||||
url
|
||||
})
|
||||
}
|
||||
if (config.type == 'switchTab' || config.type == 'tab') {
|
||||
uni.switchTab({
|
||||
url
|
||||
})
|
||||
}
|
||||
if (config.type == 'reLaunch' || config.type == 'launch') {
|
||||
uni.reLaunch({
|
||||
url
|
||||
})
|
||||
}
|
||||
if (config.type == 'navigateBack' || config.type == 'back') {
|
||||
uni.navigateBack({
|
||||
delta
|
||||
})
|
||||
}
|
||||
}
|
||||
// 执行路由跳转
|
||||
openPage(config) {
|
||||
// 解构参数
|
||||
const {
|
||||
url,
|
||||
type,
|
||||
delta,
|
||||
animationType,
|
||||
animationDuration
|
||||
} = config
|
||||
if (config.type == 'navigateTo' || config.type == 'to') {
|
||||
uni.navigateTo({
|
||||
url,
|
||||
animationType,
|
||||
animationDuration
|
||||
})
|
||||
}
|
||||
if (config.type == 'redirectTo' || config.type == 'redirect') {
|
||||
uni.redirectTo({
|
||||
url
|
||||
})
|
||||
}
|
||||
if (config.type == 'switchTab' || config.type == 'tab') {
|
||||
uni.switchTab({
|
||||
url
|
||||
})
|
||||
}
|
||||
if (config.type == 'reLaunch' || config.type == 'launch') {
|
||||
uni.reLaunch({
|
||||
url
|
||||
})
|
||||
}
|
||||
if (config.type == 'navigateBack' || config.type == 'back') {
|
||||
uni.navigateBack({
|
||||
delta
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default (new Router()).route
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "uview-ui",
|
||||
"name": "uview-ui",
|
||||
"displayName": "uView2.0重磅发布,利剑出鞘,一统江湖",
|
||||
"version": "2.0.34",
|
||||
"version": "2.0.36",
|
||||
"description": "uView UI已完美兼容nvue,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
|
||||
"keywords": [
|
||||
"uview",
|
||||
|
||||
@@ -10,7 +10,7 @@ $u-border-color: #dadbde;
|
||||
$u-bg-color: #f3f4f6;
|
||||
$u-disabled-color: #c8c9cc;
|
||||
|
||||
$u-primary: #2196F3;
|
||||
$u-primary: #3c9cff;
|
||||
$u-primary-dark: #398ade;
|
||||
$u-primary-disabled: #9acafc;
|
||||
$u-primary-light: #ecf5ff;
|
||||
@@ -20,7 +20,7 @@ $u-warning-dark: #f1a532;
|
||||
$u-warning-disabled: #f9d39b;
|
||||
$u-warning-light: #fdf6ec;
|
||||
|
||||
$u-success: #1FCC27;
|
||||
$u-success: #5ac725;
|
||||
$u-success-dark: #53c21d;
|
||||
$u-success-disabled: #a9e08f;
|
||||
$u-success-light: #f5fff0;
|
||||
|
||||
+73
-73
@@ -7,63 +7,63 @@ const fly = new Fly()
|
||||
fly.config.baseURL = VUE_APP_API_URL
|
||||
|
||||
fly.interceptors.response.use(
|
||||
response => {
|
||||
// 定时刷新access-token
|
||||
return response;
|
||||
},
|
||||
error => {
|
||||
if (error.toString() == 'Error: Network Error') {
|
||||
console.log('————————')
|
||||
console.log('发送请求失败', error)
|
||||
console.log('————————')
|
||||
handleLoginFailure();
|
||||
return Promise.reject({ msg: "未登录", toLogin: true });
|
||||
response => {
|
||||
// 定时刷新access-token
|
||||
return response;
|
||||
},
|
||||
error => {
|
||||
if (error.toString() == 'Error: Network Error') {
|
||||
console.log('————————')
|
||||
console.log('发送请求失败', error)
|
||||
console.log('————————')
|
||||
handleLoginFailure();
|
||||
return Promise.reject({ msg: "未登录", toLogin: true });
|
||||
}
|
||||
if (error.status == 401) {
|
||||
console.log('————————')
|
||||
console.log('登录失效 401', error)
|
||||
console.log('————————')
|
||||
handleLoginFailure();
|
||||
return Promise.reject({ msg: "未登录", toLogin: true });
|
||||
}
|
||||
return Promise.reject(error);
|
||||
}
|
||||
if (error.status == 401) {
|
||||
console.log('————————')
|
||||
console.log('登录失效 401', error)
|
||||
console.log('————————')
|
||||
handleLoginFailure();
|
||||
return Promise.reject({ msg: "未登录", toLogin: true });
|
||||
}
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
const defaultOpt = { login: true };
|
||||
|
||||
function baseRequest(options) {
|
||||
|
||||
// 从缓存中获取 token 防止 token 失效后还会继续请求的情况
|
||||
const token = cookie.get('login_status');
|
||||
// 从缓存中获取 token 防止 token 失效后还会继续请求的情况
|
||||
const token = cookie.get('login_status');
|
||||
|
||||
// 合并传参过来的 headers
|
||||
// 如果接口需要登录,携带 token 去请求
|
||||
options.headers = {
|
||||
...options.headers,
|
||||
Authorization: "Bearer " + token
|
||||
}
|
||||
|
||||
// 结构请求需要的参数
|
||||
const { url, params, data, login, ...option } = options
|
||||
|
||||
// 发起请求
|
||||
return fly.request(url, params || data, {
|
||||
...option
|
||||
}).then(res => {
|
||||
const data = res.data || {};
|
||||
if (res.status !== 200) {
|
||||
return Promise.reject({ msg: "请求失败", res, data });
|
||||
// 合并传参过来的 headers
|
||||
// 如果接口需要登录,携带 token 去请求
|
||||
options.headers = {
|
||||
...options.headers,
|
||||
Authorization: "Bearer " + token
|
||||
}
|
||||
if ([401, 403].indexOf(data.status) !== -1) {
|
||||
handleLoginFailure();
|
||||
return Promise.reject({ msg: res.data.msg, res, data, toLogin: true });
|
||||
} else if (data.status === 200) {
|
||||
return Promise.resolve(data, res);
|
||||
} else {
|
||||
return Promise.reject({ msg: res.data.msg, res, data });
|
||||
}
|
||||
});
|
||||
|
||||
// 结构请求需要的参数
|
||||
const { url, params, data, login, ...option } = options
|
||||
|
||||
// 发起请求
|
||||
return fly.request(url, params || data, {
|
||||
...option
|
||||
}).then(res => {
|
||||
const data = res.data || {};
|
||||
if (res.status !== 200) {
|
||||
return Promise.reject({ msg: "请求失败", res, data });
|
||||
}
|
||||
if ([401, 403].indexOf(data.status) !== -1) {
|
||||
handleLoginFailure();
|
||||
return Promise.reject({ msg: res.data.msg, res, data, toLogin: true });
|
||||
} else if (data.status === 200) {
|
||||
return Promise.resolve(data, res);
|
||||
} else {
|
||||
return Promise.reject({ msg: res.data.msg, res, data });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,34 +72,34 @@ function baseRequest(options) {
|
||||
*
|
||||
*/
|
||||
const request = ["post", "put", "patch"].reduce((request, method) => {
|
||||
/**
|
||||
*
|
||||
* @param url string 接口地址
|
||||
* @param data object get参数
|
||||
* @param options object axios 配置项
|
||||
* @returns {AxiosPromise}
|
||||
*/
|
||||
request[method] = (url, data = {}, options = {}) => {
|
||||
return baseRequest(
|
||||
Object.assign({ url, data, method }, defaultOpt, options)
|
||||
);
|
||||
};
|
||||
return request;
|
||||
/**
|
||||
*
|
||||
* @param url string 接口地址
|
||||
* @param data object get参数
|
||||
* @param options object axios 配置项
|
||||
* @returns {AxiosPromise}
|
||||
*/
|
||||
request[method] = (url, data = {}, options = {}) => {
|
||||
return baseRequest(
|
||||
Object.assign({ url, data, method }, defaultOpt, options)
|
||||
);
|
||||
};
|
||||
return request;
|
||||
}, {});
|
||||
|
||||
["get", "delete", "head"].forEach(method => {
|
||||
/**
|
||||
*
|
||||
* @param url string 接口地址
|
||||
* @param params object get参数
|
||||
* @param options object axios 配置项
|
||||
* @returns {AxiosPromise}
|
||||
*/
|
||||
request[method] = (url, params = {}, options = {}) => {
|
||||
return baseRequest(
|
||||
Object.assign({ url, params, method }, defaultOpt, options)
|
||||
);
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @param url string 接口地址
|
||||
* @param params object get参数
|
||||
* @param options object axios 配置项
|
||||
* @returns {AxiosPromise}
|
||||
*/
|
||||
request[method] = (url, params = {}, options = {}) => {
|
||||
return baseRequest(
|
||||
Object.assign({ url, params, method }, defaultOpt, options)
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
export default request;
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
|
||||
<view class="nav-box flex jc-between ai-center">
|
||||
<view class="location-box flex ai-center">
|
||||
<image :src="webUrl+'/20220903142929759087.png'" mode="scaleToFill" @click="goCity"></image>
|
||||
<text class="city-name" @click="goCity">{{ cityName }}</text>
|
||||
<!-- @click="goCity"-->
|
||||
<image :src="webUrl+'/20220903142929759087.png'" mode="scaleToFill"></image>
|
||||
<text class="city-name">{{ cityName }}</text>
|
||||
<text>当前定位</text>
|
||||
</view>
|
||||
<view class="more-box flex ai-center">
|
||||
|
||||
Reference in New Issue
Block a user