优化注释
parent
4545097a4a
commit
49eb30f265
1
App.vue
1
App.vue
|
@ -66,7 +66,6 @@ export default {
|
|||
const args = plus.runtime.arguments;
|
||||
if (args) {
|
||||
const argsStr = decodeURIComponent(args);
|
||||
console.log(argsStr);
|
||||
const path = argsStr.split("//")[1];
|
||||
if (path.indexOf("tabbar")) {
|
||||
uni.switchTab({
|
||||
|
|
|
@ -68,7 +68,7 @@ export function smsLogin(params, clientType) {
|
|||
* 刷新token
|
||||
*/
|
||||
export function refreshTokenFn(refresh_token) {
|
||||
console.log(refresh_token)
|
||||
|
||||
return http.request({
|
||||
url: `/members/refresh/${refresh_token}`,
|
||||
method: "GET",
|
||||
|
|
|
@ -55,7 +55,6 @@ export default {
|
|||
// #endif
|
||||
|
||||
downLoad() {
|
||||
console.log(this.imgUrl);
|
||||
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: this.imgUrl,
|
||||
|
|
|
@ -167,8 +167,6 @@ export default {
|
|||
}
|
||||
|
||||
if (this.tabbars.length < this.pickersize) {
|
||||
console.log(item.id);
|
||||
|
||||
let data = await getRegionsById(item.id);
|
||||
|
||||
if (data.data.result.length == 0) {
|
||||
|
|
|
@ -112,7 +112,6 @@ export default {
|
|||
};
|
||||
},
|
||||
mounted() {
|
||||
console.log("this.isFocusVal", this.isFocusVal);
|
||||
this.isFocus = this.isFocusVal;
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -127,7 +127,6 @@ export default {
|
|||
summary: this.goodsName,
|
||||
title: shareTitle,
|
||||
success: function (res) {
|
||||
// console.log("success:" + JSON.stringify(res));
|
||||
uni.showToast({
|
||||
title: "分享成功!",
|
||||
duration: 2000,
|
||||
|
|
|
@ -18,7 +18,6 @@ class LiLiWXPay {
|
|||
// 调用支付
|
||||
initiatePay(paymentMethod, paymentClient, submitData).then((res) => {
|
||||
let response = res.data.result;
|
||||
console.log(res.data.result);
|
||||
uni.hideLoading();
|
||||
uni.requestPayment({
|
||||
provider: "wxpay",
|
||||
|
|
|
@ -595,12 +595,7 @@
|
|||
"navigationBarTitleText": "我的评价"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "afterSales/applyCancel",
|
||||
"style": {
|
||||
"navigationBarTitleText": "取消订单"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "afterSales/applyProgress",
|
||||
"style": {
|
||||
|
|
|
@ -66,7 +66,6 @@ export default {
|
|||
},
|
||||
onPullDownRefresh() {
|
||||
//下拉刷新
|
||||
console.log("refresh");
|
||||
this.params.pageNumber = 1;
|
||||
this.couponList = [];
|
||||
this.getCoupon();
|
||||
|
|
|
@ -13,16 +13,16 @@
|
|||
<view class="goods-price " v-if="goodsDetail.promotionPrice">
|
||||
<span>
|
||||
¥
|
||||
<span class="goods-price-promotionShow goods-price-bigshow" v-if="goodsDetail.promotionPrice">{{ Fixed(goodsDetail.promotionPrice)[0] }}</span>
|
||||
.{{ Fixed(goodsDetail.promotionPrice)[1] }}
|
||||
<span class="goods-price-promotionShow goods-price-bigshow" v-if="goodsDetail.promotionPrice">{{ formatPrice(goodsDetail.promotionPrice)[0] }}</span>
|
||||
.{{ formatPrice(goodsDetail.promotionPrice)[1] }}
|
||||
<span></span>
|
||||
</span>
|
||||
<div class="promotion-box">
|
||||
¥
|
||||
<span class="goods-price-bigshow">{{
|
||||
Fixed(goodsDetail.price)[0]
|
||||
formatPrice(goodsDetail.price)[0]
|
||||
}}</span>
|
||||
.{{ Fixed(goodsDetail.price)[1] }}
|
||||
.{{ formatPrice(goodsDetail.price)[1] }}
|
||||
<span></span>
|
||||
</div>
|
||||
</view>
|
||||
|
@ -30,9 +30,9 @@
|
|||
<view class="goods-price" v-else>
|
||||
¥
|
||||
<span class="goods-price-bigshow">{{
|
||||
Fixed(goodsDetail.price)[0]
|
||||
formatPrice(goodsDetail.price)[0]
|
||||
}}</span>
|
||||
.{{ Fixed(goodsDetail.price)[1] }}
|
||||
.{{ formatPrice(goodsDetail.price)[1] }}
|
||||
<span></span>
|
||||
</view>
|
||||
<view class="goods-check-skus">
|
||||
|
@ -123,7 +123,7 @@ export default {
|
|||
|
||||
methods: {
|
||||
// 格式化金钱 1999 --> [1999,00]
|
||||
Fixed(val) {
|
||||
formatPrice(val) {
|
||||
if (typeof val == "undefined") {
|
||||
return val;
|
||||
}
|
||||
|
|
|
@ -124,9 +124,6 @@ export default {
|
|||
...this.master,
|
||||
orderSn: this.routers.sn,
|
||||
};
|
||||
|
||||
console.log(this.$refs.popupGoods.parentOrder);
|
||||
|
||||
this.$refs.popupGoods.isMask = true;
|
||||
this.$refs.popupGoods.isClose = true;
|
||||
this.$refs.popupGoods.buyType = "PINTUAN";
|
||||
|
@ -178,7 +175,7 @@ export default {
|
|||
|
||||
// 获取当前商品是否已经购买
|
||||
if (storage.getUserInfo().id) {
|
||||
console.log(storage.getUserInfo().id);
|
||||
|
||||
let isBuy = res.data.result.pintuanMemberVOS.filter((item) => {
|
||||
return item.memberId == storage.getUserInfo().id;
|
||||
});
|
||||
|
|
|
@ -14,11 +14,7 @@
|
|||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
let pages = getCurrentPages();
|
||||
if (pages.length) {
|
||||
let route = pages[0].route;
|
||||
}
|
||||
this.type = options.type;
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -99,7 +99,7 @@ export default {
|
|||
this.params.pageNumber,
|
||||
this.params.pageSize
|
||||
).then((res) => {
|
||||
console.log("加载");
|
||||
|
||||
if (res.data.result.records.length == 0) {
|
||||
this.empty = true;
|
||||
} else {
|
||||
|
@ -109,7 +109,7 @@ export default {
|
|||
|
||||
this.$set(this, "addressList", res.data.result.records);
|
||||
|
||||
console.log(this.addressList);
|
||||
|
||||
}
|
||||
|
||||
uni.hideLoading();
|
||||
|
@ -139,7 +139,7 @@ export default {
|
|||
},
|
||||
//新建。编辑地址
|
||||
addAddress(id) {
|
||||
console.log("点击");
|
||||
|
||||
if (id) {
|
||||
uni.navigateTo({
|
||||
url:
|
||||
|
|
|
@ -73,7 +73,7 @@ export default {
|
|||
async mounted() {
|
||||
this.getWallet();
|
||||
let result = await getUserWallet(); //预存款
|
||||
console.log(result)
|
||||
|
||||
this.walletNum = result.data.result.memberWallet;
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -58,7 +58,7 @@ export default {
|
|||
title: title, //这是修改后的导航栏文字
|
||||
});
|
||||
this.routers = option;
|
||||
console.log(this.routers);
|
||||
|
||||
option.type == 0 ? this.achievement() : this.history();
|
||||
},
|
||||
mounted() {},
|
||||
|
|
|
@ -157,7 +157,7 @@ export default {
|
|||
},
|
||||
watch: {
|
||||
showFlag(val) {
|
||||
console.log(val);
|
||||
|
||||
},
|
||||
},
|
||||
onShow() {
|
||||
|
|
|
@ -36,7 +36,7 @@ export default {
|
|||
methods: {
|
||||
cashd() {
|
||||
this.price = this.price + "";
|
||||
console.log(typeof this.price);
|
||||
|
||||
|
||||
if (this.$u.test.amount(parseInt(this.price))) {
|
||||
cash({ price: this.price }).then((res) => {
|
||||
|
|
|
@ -133,7 +133,7 @@ export default {
|
|||
*/
|
||||
clickGoodsSwiperAction(val) {
|
||||
deleteGoodsCollection(val.skuId).then((res) => {
|
||||
console.log(res);
|
||||
|
||||
if (res.statusCode == 200) {
|
||||
this.storeList = [];
|
||||
this.goodList = [];
|
||||
|
@ -159,7 +159,7 @@ export default {
|
|||
*/
|
||||
tabClick(index) {
|
||||
this.tabCurrentIndex = index;
|
||||
console.log(this.tabCurrentIndex);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -87,7 +87,7 @@ export default {
|
|||
},
|
||||
|
||||
/**
|
||||
* 获得累计使用
|
||||
* 获得累计积分使用
|
||||
*/
|
||||
initPointData() {
|
||||
getMemberPointSum().then((res) => {
|
||||
|
@ -99,6 +99,9 @@ export default {
|
|||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.point-list{
|
||||
margin-top: 50rpx;
|
||||
}
|
||||
.title {
|
||||
height: 80rpx;
|
||||
text-align: center;
|
||||
|
|
|
@ -5,14 +5,10 @@
|
|||
<view>点击修改头像</view>
|
||||
</view>
|
||||
<u-form :model="form" ref="uForm" class="form">
|
||||
<!-- <u-form-item label="用户名" label-width="150"
|
||||
><u-input v-model="form.username" disabled
|
||||
/></u-form-item> -->
|
||||
<u-form-item label="昵称" label-width="150">
|
||||
<u-input v-model="form.nickName" placeholder="请输入昵称" />
|
||||
</u-form-item>
|
||||
<u-form-item label="性别" label-width="150">
|
||||
<!-- {{typeof list[0].value}} {{form.sex + typeof form.sex}} -->
|
||||
<u-radio-group v-model="form.sex" :active-color="lightColor">
|
||||
<u-radio name="1">男</u-radio>
|
||||
<u-radio name="0">女</u-radio>
|
||||
|
@ -20,8 +16,8 @@
|
|||
</u-form-item>
|
||||
|
||||
<u-form-item label="生日" label-width="150" right-icon="arrow-right">
|
||||
<u-input v-model="birthday" disabled placeholder="请选择出生日期" @click="showBirth = true" />
|
||||
<u-picker v-model="showBirth" mode="time" :confirm-color="lightColor" @confirm="selectTime"></u-picker>
|
||||
<u-input v-model="birthday" disabled placeholder="请选择出生日期" @click="showBirthday = true" />
|
||||
<u-picker v-model="showBirthday" mode="time" :confirm-color="lightColor" @confirm="selectTime"></u-picker>
|
||||
</u-form-item>
|
||||
<u-form-item label="城市" label-width="150" placeholder="请选择城市" right-icon="arrow-right">
|
||||
<u-input v-model="form.___path" disabled @click="clickRegion" />
|
||||
|
@ -35,7 +31,6 @@
|
|||
<script>
|
||||
import { saveUserInfo } from "@/api/members.js";
|
||||
import { upload } from "@/api/common.js";
|
||||
|
||||
import storage from "@/utils/storage.js";
|
||||
import uFormItem from "@/uview-ui/components/u-form-item/u-form-item.vue";
|
||||
import gkcity from "@/components/m-city/m-city.vue";
|
||||
|
@ -43,46 +38,36 @@ export default {
|
|||
components: { uFormItem, "m-city": gkcity },
|
||||
data() {
|
||||
return {
|
||||
lightColor: this.$lightColor,
|
||||
lightColor: this.$lightColor, //高亮颜色
|
||||
form: {
|
||||
face: "/static/missing-face.png",
|
||||
regionId: [],
|
||||
region: [],
|
||||
sex: "1",
|
||||
___path: "",
|
||||
nickName: storage.getUserInfo().nickName || "",
|
||||
birthday: storage.getUserInfo().birthday || "",
|
||||
face: storage.getUserInfo().face || "/static/missing-face.png", //默认头像
|
||||
regionId: [], //地址Id
|
||||
region: storage.getUserInfo().region || [], //地址
|
||||
sex: storage.getUserInfo().sex || 1, //性别
|
||||
___path: storage.getUserInfo().region,
|
||||
},
|
||||
birthday: "",
|
||||
birthday: storage.getUserInfo().birthday || "", //生日
|
||||
photo: [
|
||||
{ text: "立即拍照", color: this.$mainColor },
|
||||
{ text: "从相册选择", color: this.$mainColor },
|
||||
],
|
||||
value: "",
|
||||
region: [
|
||||
//请求城市默认地址
|
||||
{
|
||||
id: "",
|
||||
localName: "请选择",
|
||||
children: [],
|
||||
},
|
||||
],
|
||||
list: [
|
||||
{
|
||||
sex: "男",
|
||||
value: "1",
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
sex: "女",
|
||||
value: "0",
|
||||
disabled: false,
|
||||
},
|
||||
],
|
||||
showBirth: false,
|
||||
showRegion: false,
|
||||
showAction: false,
|
||||
showBirthday: false, //显示生日日期
|
||||
};
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
/**
|
||||
* 选择地址回调
|
||||
*/
|
||||
getpickerParentValue(e) {
|
||||
this.form.region = [];
|
||||
this.form.regionId = [];
|
||||
|
@ -100,19 +85,24 @@ export default {
|
|||
this.form.___path = name;
|
||||
}
|
||||
});
|
||||
|
||||
console.log(this.form);
|
||||
},
|
||||
|
||||
/**
|
||||
* 点击选择地址
|
||||
*/
|
||||
clickRegion() {
|
||||
this.$refs.cityPicker.show();
|
||||
},
|
||||
|
||||
/**
|
||||
* 提交保存
|
||||
*/
|
||||
submit() {
|
||||
if (this.form.regionId.length != 0 && this.birthday) {
|
||||
delete this.form.___path;
|
||||
let params = JSON.parse(JSON.stringify(this.form));
|
||||
saveUserInfo(params).then((res) => {
|
||||
console.log(res);
|
||||
|
||||
if (res.statusCode == 200) {
|
||||
storage.setUserInfo(res.data.result);
|
||||
uni.navigateBack();
|
||||
|
@ -126,6 +116,10 @@ export default {
|
|||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改头像
|
||||
*/
|
||||
changeFace(index) {
|
||||
uni.chooseImage({
|
||||
success: (chooseImageRes) => {
|
||||
|
@ -146,34 +140,31 @@ export default {
|
|||
},
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择地址
|
||||
*/
|
||||
selectRegion(region) {
|
||||
//选择地址
|
||||
this.$set(
|
||||
this.form,
|
||||
"address",
|
||||
`${region.province.label} ${region.city.label} ${region.area.label}`
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择时间
|
||||
*/
|
||||
selectTime(time) {
|
||||
// 生日
|
||||
console.log(time);
|
||||
this.form.birthday = `${time.year}-${time.month}-${time.day}`;
|
||||
this.birthday = `${time.year} - ${time.month} - ${time.day}`;
|
||||
// this.form.timestamp = `${time.year} - ${time.month} - ${time.day}`;
|
||||
},
|
||||
},
|
||||
onLoad() {
|
||||
// this.form.userName = storage.getUserInfo().username
|
||||
this.form.nickName = storage.getUserInfo().nickName;
|
||||
this.form.sex = storage.getUserInfo().sex || 1;
|
||||
this.form.birthday = storage.getUserInfo().birthday;
|
||||
this.birthday = storage.getUserInfo().birthday || "";
|
||||
this.form.___path = storage.getUserInfo().region;
|
||||
this.form.face = storage.getUserInfo().face || "";
|
||||
this.form.regionId = storage.getUserInfo().regionId || [];
|
||||
this.form.region = storage.getUserInfo().region || [];
|
||||
console.log(this.form);
|
||||
},
|
||||
|
||||
/**
|
||||
* 加载数据
|
||||
*/
|
||||
onLoad() {},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ export default {
|
|||
that.getCacheSize(); // 重新计算缓存
|
||||
},
|
||||
function (e) {
|
||||
console.log(e.message);
|
||||
|
||||
}
|
||||
);
|
||||
} else {
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<u-icon size="120" style="margin: 50rpx 0" color="#ff9f28" name="checkmark"></u-icon>
|
||||
<view class="mark">
|
||||
<view>获得积分</view>
|
||||
<text>{{ continuity_point }}</text>
|
||||
<text>{{ continuityPoint }}</text>
|
||||
</view>
|
||||
<text class="text">连续签到可获得额外奖励哦!</text>
|
||||
</view>
|
||||
|
@ -71,19 +71,16 @@ import { sign, signTime } from "@/api/point.js";
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
continuity: 1,
|
||||
continuity_point: 2,
|
||||
header: {
|
||||
top: 0,
|
||||
height: 50,
|
||||
},
|
||||
continuity: 1, //本月连续签到天数
|
||||
continuityPoint: 2, //获得的积分
|
||||
signFlag: false,
|
||||
animationData: {},
|
||||
maskFlag: false,
|
||||
transFlag: false,
|
||||
weekArr: ["日", "一", "二", "三", "四", "五", "六"],
|
||||
maskFlag: false, //
|
||||
transFlag: false, //动画
|
||||
weekArr: ["日", "一", "二", "三", "四", "五", "六"], //周数组
|
||||
dateArr: [], //每个月的天数
|
||||
monthArr: [
|
||||
//实例化每个月
|
||||
"1月",
|
||||
"2月",
|
||||
"3月",
|
||||
|
@ -118,6 +115,10 @@ export default {
|
|||
this.getDate();
|
||||
},
|
||||
methods: {
|
||||
|
||||
/**
|
||||
* 补0
|
||||
*/
|
||||
makeUp(val) {
|
||||
if (val >= 10) {
|
||||
return val;
|
||||
|
@ -125,18 +126,18 @@ export default {
|
|||
return "0" + val;
|
||||
}
|
||||
},
|
||||
// 返回
|
||||
back() {
|
||||
uni.navigateBack();
|
||||
},
|
||||
// 签到
|
||||
|
||||
/**
|
||||
* 点击签到
|
||||
*/
|
||||
async signIn() {
|
||||
await sign().then((response) => {
|
||||
if (this.ifSign) return;
|
||||
if (this.signFlag) return;
|
||||
if (response.data.code != 200) {
|
||||
uni.$showToast({
|
||||
title: response.message,
|
||||
uni.showToast({
|
||||
title: response.data.message,
|
||||
duration: 2000,
|
||||
icon: "none",
|
||||
});
|
||||
|
||||
|
@ -164,41 +165,24 @@ export default {
|
|||
);
|
||||
});
|
||||
},
|
||||
// 关闭弹窗
|
||||
|
||||
/**
|
||||
* 签到成功后关闭弹窗
|
||||
*/
|
||||
close() {
|
||||
var that = this;
|
||||
this.maskFlag = false;
|
||||
this.transFlag = true;
|
||||
setTimeout(function () {
|
||||
setTimeout(() => {
|
||||
that.transFlag = false;
|
||||
}, 500);
|
||||
},
|
||||
change(id) {
|
||||
var i = this.monthArr.indexOf(this.currentMonth),
|
||||
curDay = null;
|
||||
if (id === "1") {
|
||||
i++;
|
||||
if (i > 11) {
|
||||
this.currentYear++;
|
||||
i = 0;
|
||||
}
|
||||
this.currentMonth = this.monthArr[i];
|
||||
this.currentMonthIndex = i + 1;
|
||||
} else {
|
||||
i--;
|
||||
if (i < 0) {
|
||||
this.currentYear--;
|
||||
i = 11;
|
||||
}
|
||||
this.currentMonth = this.monthArr[i];
|
||||
this.currentMonthIndex = i + 1;
|
||||
}
|
||||
curDay = this.getWeekByDay(this.currentYear + "-" + (i + 1) + "-1");
|
||||
this.getMonthDays(i, curDay);
|
||||
this.curentSignData();
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取今天时间
|
||||
*
|
||||
*/
|
||||
getDate() {
|
||||
//获取日子
|
||||
var date = new Date(),
|
||||
index = date.getMonth(),
|
||||
curDay = null;
|
||||
|
@ -206,16 +190,17 @@ export default {
|
|||
this.currentMonth = this.monthArr[index];
|
||||
this.currentMonthIndex = index + 1;
|
||||
this.currentDay = date.getDate();
|
||||
console.log(this.currentDay);
|
||||
console.log(this.signArr[this.signArr.length - 1]);
|
||||
if (this.currentDay == this.signArr[this.signArr.length - 1]) {
|
||||
console.log("12");
|
||||
this.ifSign = true;
|
||||
}
|
||||
curDay = this.getWeekByDay(this.currentYear + "-" + (index + 1) + "-1");
|
||||
this.getMonthDays(index, curDay);
|
||||
this.curentSignData();
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取当前已经签到的时间
|
||||
*/
|
||||
curentSignData() {
|
||||
var date = new Date(),
|
||||
index = date.getMonth(),
|
||||
|
@ -224,15 +209,13 @@ export default {
|
|||
for (var i = 0; i < this.signAll.length; i++) {
|
||||
var item = this.signAll[i];
|
||||
item.createTime = item.createTime.split(" ")[0];
|
||||
|
||||
var itemVal = item.createTime.split("-");
|
||||
console.log(itemVal);
|
||||
if (
|
||||
Number(itemVal[0]) === Number(this.currentYear) &&
|
||||
Number(itemVal[1]) === Number(this.currentMonthIndex)
|
||||
) {
|
||||
this.signArr.push(Number(itemVal[2]));
|
||||
console.log(JSON.stringify(this.signArr));
|
||||
|
||||
}
|
||||
if (
|
||||
Number(itemVal[0]) === Number(date.getFullYear()) &&
|
||||
|
@ -243,6 +226,14 @@ export default {
|
|||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 循环出当前月份的时间
|
||||
* 例子:
|
||||
* "","","","","","",1,
|
||||
* 2 ,3 ,4 ,5 ,6 ,7 ,8,
|
||||
* ...依次向下排
|
||||
*/
|
||||
getMonthDays(index, day) {
|
||||
//day 当月1号是周几
|
||||
this.dateArr = [];
|
||||
|
@ -293,8 +284,11 @@ export default {
|
|||
}
|
||||
this.dataObj.push(this.dateArr);
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取当前月份有几周
|
||||
*/
|
||||
getWeekByDay(dayValue) {
|
||||
//dayValue=“2014-01-01”
|
||||
var day = new Date(Date.parse(dayValue.replace(/-/g, "/"))).getDay(); //将日期值格式化
|
||||
return day;
|
||||
},
|
||||
|
|
|
@ -21,7 +21,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
init() {
|
||||
console.log(this.$options.filters.isLogin());
|
||||
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -91,8 +91,8 @@
|
|||
<div class="title clamp3" style="">{{ item.goodsName }}</div>
|
||||
<view class="price-box">
|
||||
<div class="price" v-if="item.price!=undefined">
|
||||
¥<span>{{ Fixed(item.price )[0] }} </span>.{{
|
||||
Fixed(item.price )[1]
|
||||
¥<span>{{ formatPrice(item.price )[0] }} </span>.{{
|
||||
formatPrice(item.price )[1]
|
||||
}}
|
||||
</div>
|
||||
</view>
|
||||
|
@ -158,8 +158,8 @@
|
|||
<view class="price-box">
|
||||
<div class="price" v-if="item.price!=undefined">
|
||||
|
||||
¥<span>{{ Fixed(item.price )[0] }} </span>.{{
|
||||
Fixed(item.price )[1]
|
||||
¥<span>{{ formatPrice(item.price )[0] }} </span>.{{
|
||||
formatPrice(item.price )[1]
|
||||
}}
|
||||
</div>
|
||||
</view>
|
||||
|
@ -421,7 +421,7 @@ export default {
|
|||
},
|
||||
|
||||
// 格式化金钱 1999 --> [1999,00]
|
||||
Fixed(val) {
|
||||
formatPrice(val) {
|
||||
if (typeof val == "undefined") {
|
||||
return val;
|
||||
}
|
||||
|
@ -611,7 +611,7 @@ export default {
|
|||
}
|
||||
//没有更多直接返回
|
||||
let goodsList = await getGoodsList(this.params);
|
||||
console.log(goodsList);
|
||||
|
||||
if (goodsList.data.result.content.length < 10) {
|
||||
this.loadingType = "noMore";
|
||||
}
|
||||
|
@ -662,7 +662,7 @@ export default {
|
|||
content: "确定清除历史搜索记录?",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
console.log("用户点击确定");
|
||||
|
||||
this.oldKeywordList = [];
|
||||
uni.removeStorage({
|
||||
key: "OldKeys",
|
||||
|
@ -693,7 +693,7 @@ export default {
|
|||
},
|
||||
//保存关键字到历史记录
|
||||
saveKeyword(keyword) {
|
||||
console.log(keyword);
|
||||
|
||||
if (!keyword) return false;
|
||||
uni.getStorage({
|
||||
key: "OldKeys",
|
||||
|
@ -714,7 +714,7 @@ export default {
|
|||
data: JSON.stringify(OldKeys),
|
||||
});
|
||||
this.oldKeywordList = OldKeys; //更新历史搜索
|
||||
console.log(this.oldKeywordList);
|
||||
|
||||
},
|
||||
fail: (e) => {
|
||||
var OldKeys = [keyword];
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<view class="seller-name">
|
||||
<view class="name">{{ order.storeName }}</view>
|
||||
</view>
|
||||
<view class="order-sn">订单编号:{{ order.sn }}</view>
|
||||
<view class="order-sn">订单编号:{{order.sn}}</view>
|
||||
</view>
|
||||
<!-- 申请记录 选项卡 -->
|
||||
<view class="seller-info u-flex u-row-between" v-if="current != 0">
|
||||
|
@ -50,11 +50,11 @@
|
|||
|
||||
<div v-if="current === 1 || current === 2">
|
||||
<!-- 申请中 -->
|
||||
<view class="cannot_apply" v-if="order.serviceType == 'RETURN_GOODS'">退货处理-{{ serviceStatusList[order.serviceStatus] }}</view>
|
||||
<view class="cannot_apply" v-if="order.serviceType == 'SUPPLY_AGAIN_GOODS'">补发商品-{{ serviceStatusList[order.serviceStatus] }}</view>
|
||||
<view class="cannot_apply" v-if="order.serviceType == 'RETURN_MONEY'">退款-{{ serviceStatusList[order.serviceStatus] }}</view>
|
||||
<view class="cannot_apply" v-if="order.serviceType == 'EXCHANGE_GOODS'">换货-{{ serviceStatusList[order.serviceStatus] }}</view>
|
||||
<view class="cannot_apply" v-if="order.serviceType == 'CANCEL'">取消订单-{{ serviceStatusList[order.serviceStatus] }}</view>
|
||||
<view class="cannot_apply" v-if="order.serviceType == 'RETURN_GOODS'">退货处理-{{ order.serviceStatus | serviceStatusList }}</view>
|
||||
<view class="cannot_apply" v-if="order.serviceType == 'SUPPLY_AGAIN_GOODS'">补发商品-{{ order.serviceStatus | serviceStatusList }}</view>
|
||||
<view class="cannot_apply" v-if="order.serviceType == 'RETURN_MONEY'">退款-{{ order.serviceStatus | serviceStatusList }}</view>
|
||||
<view class="cannot_apply" v-if="order.serviceType == 'EXCHANGE_GOODS'">换货-{{ order.serviceStatus | serviceStatusList }}</view>
|
||||
<view class="cannot_apply" v-if="order.serviceType == 'CANCEL'">取消订单-{{ order.serviceStatus | serviceStatusList }}</view>
|
||||
</div>
|
||||
<!-- 申请记录 -->
|
||||
</view>
|
||||
|
@ -74,13 +74,9 @@
|
|||
" @click="onExpress(order, sku)">
|
||||
提交物流
|
||||
</view>
|
||||
|
||||
<view @click="afterDetails(order, sku)" v-if="current === 1 || current === 2" class="rebuy-btn">
|
||||
售后详情
|
||||
</view>
|
||||
|
||||
<!-- 申请记录 -->
|
||||
<!-- <u-button type="info" size="mini" shape="circle" v-if="current === 2">删除记录</u-button> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -103,8 +99,7 @@
|
|||
|
||||
<script>
|
||||
import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
|
||||
import empty from "@/components/empty";
|
||||
import { getAfterSale, getAfterSaleList } from "@/api/after-sale.js";
|
||||
import { getAfterSaleList } from "@/api/after-sale.js";
|
||||
import { getOrderList } from "@/api/order.js";
|
||||
|
||||
export default {
|
||||
|
@ -113,20 +108,8 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
serviceStatusList: {
|
||||
APPLY: "申请售后",
|
||||
PASS: "通过售后",
|
||||
REFUSE: "拒绝售后",
|
||||
BUYER_RETURN: "买家退货,待卖家收货",
|
||||
SELLER_RE_DELIVERY: "商家换货/补发",
|
||||
SELLER_CONFIRM: "卖家确认收货",
|
||||
SELLER_TERMINATION: "卖家终止售后",
|
||||
BUYER_CONFIRM: "买家确认收货",
|
||||
BUYER_CANCEL: "买家取消售后",
|
||||
WAIT_REFUND: "等待平台退款",
|
||||
COMPLETE: "完成售后",
|
||||
},
|
||||
list: [
|
||||
//tab表头
|
||||
{
|
||||
name: "售后申请",
|
||||
},
|
||||
|
@ -137,13 +120,14 @@ export default {
|
|||
name: "申请记录",
|
||||
},
|
||||
],
|
||||
current: 0,
|
||||
tipsShow: false,
|
||||
orderList: [],
|
||||
current: 0, //当前表头索引
|
||||
tipsShow: false, //提示开关
|
||||
orderList: [], //订单集合
|
||||
params: {
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
|
||||
logParams: {
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
|
@ -159,11 +143,10 @@ export default {
|
|||
onPullDownRefresh() {
|
||||
this.change(this.current);
|
||||
},
|
||||
watch: {
|
||||
current(val) {},
|
||||
},
|
||||
methods: {
|
||||
//切换tab页时,初始化数据
|
||||
/**
|
||||
* 切换tab页时,初始化数据
|
||||
*/
|
||||
change(index) {
|
||||
this.current = index;
|
||||
this.params = {
|
||||
|
@ -187,6 +170,10 @@ export default {
|
|||
}
|
||||
uni.stopPullDownRefresh();
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取订单列表
|
||||
*/
|
||||
getOrderList(index) {
|
||||
uni.showLoading({
|
||||
title: "加载中",
|
||||
|
@ -207,14 +194,18 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
// 详情
|
||||
/**
|
||||
* 售后详情
|
||||
*/
|
||||
afterDetails(order) {
|
||||
uni.navigateTo({
|
||||
url: "./applyDetail?sn=" + order.sn,
|
||||
});
|
||||
},
|
||||
|
||||
//申请记录列表
|
||||
/**
|
||||
* 申请记录列表
|
||||
*/
|
||||
getAfterSaleLogList() {
|
||||
getAfterSaleList(this.logParams).then((res) => {
|
||||
let afterSaleLogList = res.data.result.records;
|
||||
|
@ -229,7 +220,7 @@ export default {
|
|||
price: item.flowPrice,
|
||||
},
|
||||
];
|
||||
console.log(item.orderItems);
|
||||
|
||||
});
|
||||
|
||||
this.orderList = this.orderList.concat(afterSaleLogList);
|
||||
|
@ -241,7 +232,10 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
//申请售后
|
||||
|
||||
/**
|
||||
* 申请售后
|
||||
*/
|
||||
applyService(sn, order, sku) {
|
||||
let data = {
|
||||
...order,
|
||||
|
@ -254,7 +248,10 @@ export default {
|
|||
)}`,
|
||||
});
|
||||
},
|
||||
//提交物流信息
|
||||
|
||||
/**
|
||||
* 提交物流信息
|
||||
*/
|
||||
onExpress(order, sku) {
|
||||
sku.storeName = order.storeName;
|
||||
|
||||
|
@ -265,14 +262,20 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 查看详情
|
||||
*/
|
||||
onDetail(sku) {
|
||||
console.log(sku);
|
||||
if (!this.$u.test.isEmpty(sku.skuId)) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/goods?id=${sku.skuId}&goodsId=${sku.goodsId}`,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 底部加载数据
|
||||
*/
|
||||
renderDate() {
|
||||
if (this.current === 0) {
|
||||
this.params.pageNumber += 1;
|
||||
|
|
|
@ -110,7 +110,7 @@ export default {
|
|||
return {
|
||||
storage,
|
||||
list: [{ id: "", localName: "请选择", children: [] }],
|
||||
action: upload,
|
||||
action: upload, //图片上传数据
|
||||
fileList: [],
|
||||
sn: "",
|
||||
sku: {},
|
||||
|
@ -165,6 +165,10 @@ export default {
|
|||
},
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* 判断当前内容并生成数据
|
||||
*/
|
||||
onLoad(options) {
|
||||
let navTitle = "申请售后";
|
||||
this.form.serviceType = "RETURN_GOODS";
|
||||
|
@ -222,6 +226,8 @@ export default {
|
|||
showCitySelect() {
|
||||
this.$refs.cityPicker.show();
|
||||
},
|
||||
|
||||
// 初始化数据
|
||||
init(sn) {
|
||||
getAfterSaleInfo(sn).then((response) => {
|
||||
if (response.data.code == 400) {
|
||||
|
@ -249,7 +255,7 @@ export default {
|
|||
},
|
||||
//返回方式
|
||||
returnSelectConfirm(e) {
|
||||
console.log(e);
|
||||
|
||||
},
|
||||
|
||||
//修改申请数量
|
||||
|
@ -258,7 +264,7 @@ export default {
|
|||
},
|
||||
//图片上传
|
||||
onUploaded(lists) {
|
||||
console.log(lists);
|
||||
|
||||
let images = [];
|
||||
|
||||
lists.forEach((item) => {
|
||||
|
@ -291,7 +297,10 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
// 验证银行卡号
|
||||
|
||||
/**
|
||||
* 验证银行卡号
|
||||
*/
|
||||
checkBankno(bankno) {
|
||||
var lastNum = bankno.substr(bankno.length - 1, 1); //取出最后一位(与luhm进行比较)
|
||||
var first15Num = bankno.substr(0, bankno.length - 1); //前15或18位
|
||||
|
@ -355,7 +364,7 @@ export default {
|
|||
|
||||
//检测提交参数
|
||||
handleCheckParams() {
|
||||
console.log(this.form.accountType);
|
||||
|
||||
if (this.$u.test.isEmpty(this.form.reason)) {
|
||||
this.$refs.uToast.show({ title: "请选择 退款原因", type: "error" });
|
||||
return false;
|
||||
|
@ -412,27 +421,11 @@ export default {
|
|||
|
||||
return true;
|
||||
},
|
||||
|
||||
showOrHide() {
|
||||
let flag = true;
|
||||
switch (this.form.serviceType) {
|
||||
case "CHANGE_GOODS":
|
||||
flag = false;
|
||||
break;
|
||||
case "SUPPLY_AGAIN_GOODS":
|
||||
flag = false;
|
||||
break;
|
||||
default:
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
return flag;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
<style lang="scss" scoped>
|
||||
page,
|
||||
.content {
|
||||
background: $page-color-base;
|
||||
|
|
|
@ -16,11 +16,8 @@
|
|||
</view>
|
||||
<view class="goods-info">
|
||||
<view class="goods-title u-line-2">{{ sku.name }}</view>
|
||||
|
||||
<view class="goods-price">
|
||||
<!-- <span v-if="sku.point">¥{{ sku.subtotal }}+{{ sku.point }}积分</span> -->
|
||||
<span>¥{{ sku.price | unitPrice }}</span>
|
||||
|
||||
<span class="num">购买数量: {{ sku.num }} </span>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -36,7 +33,7 @@
|
|||
<u-input type="text" input-align="right" value="快递至第三方卖家" />
|
||||
</u-form-item>
|
||||
<u-form-item label="快递公司" :label-width="150">
|
||||
<u-input v-model="form.courier_company" type="select" input-align="right" :select-open="companySelectShow" @click="companySelectShow = true" placeholder="请选择快递公司" />
|
||||
<u-input v-model="form.courierCompany" type="select" input-align="right" :select-open="companySelectShow" @click="companySelectShow = true" placeholder="请选择快递公司" />
|
||||
</u-form-item>
|
||||
<u-form-item label="快递单号" :label-width="150">
|
||||
<u-input input-align="right" v-model="form.logisticsNo" placeholder="请输入快递单号" />
|
||||
|
@ -48,7 +45,6 @@
|
|||
</scroll-view>
|
||||
|
||||
<view class="submit-view">
|
||||
|
||||
<u-button ripple :customStyle="{'background':$lightColor,'color':'#fff' }" shape="circle" @click="onSubmit">提交申请</u-button>
|
||||
</view>
|
||||
</u-form>
|
||||
|
@ -65,27 +61,21 @@ import { fillShipInfo } from "@/api/after-sale.js";
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
typeValue: 0,
|
||||
value: "",
|
||||
type: "textarea",
|
||||
border: true,
|
||||
//快递公司 弹出框
|
||||
companySelectShow: false,
|
||||
companyList: [],
|
||||
timeshow: false,
|
||||
companyList: [], //快递公司集合
|
||||
timeshow: false, //发货时间
|
||||
form: {
|
||||
courier_company: "",
|
||||
courierCompany: "", //快递公司
|
||||
logisticsId: "", //快递公司ID
|
||||
logisticsNo: "", //快递单号
|
||||
mDeliverTime: "", //发货时间
|
||||
},
|
||||
serviceDetail: {},
|
||||
sku: {},
|
||||
serviceDetail: {}, //服务详情
|
||||
sku: {}, //sku信息
|
||||
};
|
||||
},
|
||||
onShow(options) {},
|
||||
onLoad(options) {
|
||||
|
||||
this.sku = JSON.parse(decodeURIComponent(options.sku));
|
||||
let navTitle = "服务单详情";
|
||||
uni.setNavigationBarTitle({
|
||||
|
@ -95,12 +85,17 @@ export default {
|
|||
this.Logistics();
|
||||
},
|
||||
methods: {
|
||||
//快递公司
|
||||
/**
|
||||
* 确认快递公司
|
||||
*/
|
||||
companySelectConfirm(e) {
|
||||
this.form.logisticsId = e[0].value;
|
||||
this.form.courier_company = e[0].label;
|
||||
this.form.courierCompany = e[0].label;
|
||||
},
|
||||
// 获取快递公司
|
||||
|
||||
/**
|
||||
* 获取快递公司
|
||||
*/
|
||||
Logistics() {
|
||||
getLogistics().then((res) => {
|
||||
if (res.data.success) {
|
||||
|
@ -110,19 +105,26 @@ export default {
|
|||
label: item.name,
|
||||
};
|
||||
});
|
||||
// this.companyList= res
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 更改时间
|
||||
*/
|
||||
onTimeChange(e) {
|
||||
this.form.mDeliverTime = e.result;
|
||||
},
|
||||
|
||||
/**
|
||||
* 点击提交
|
||||
*/
|
||||
onSubmit() {
|
||||
uni.showLoading({
|
||||
title: "加载中",
|
||||
mask: true,
|
||||
});
|
||||
delete this.form.courier_company;
|
||||
delete this.form.courierCompany;
|
||||
fillShipInfo(this.serviceDetail.sn, this.form).then((res) => {
|
||||
uni.hideLoading();
|
||||
if (res.statusCode === 200) {
|
||||
|
@ -139,7 +141,7 @@ export default {
|
|||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
<style lang="scss" scoped>
|
||||
page,
|
||||
.content {
|
||||
background: $page-color-base;
|
||||
|
@ -147,7 +149,6 @@ page,
|
|||
}
|
||||
.mp-iphonex-bottom {
|
||||
overflow: hidden;
|
||||
|
||||
}
|
||||
.after-sales-goods-detail-view {
|
||||
background-color: #fff;
|
||||
|
|
|
@ -9,18 +9,15 @@
|
|||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="goods-item-view" v-for="(item,index) in sku.orderItems" v-if="item.sn == sn" @click="gotoGoodsDetail(sku.skuId)">
|
||||
<view class="goods-item-view" :key="index" v-for="(item,index) in sku.orderItems" v-if="item.sn == sn" @click="navigateToGoodsDetail(sku.skuId)">
|
||||
<view class="goods-img">
|
||||
<u-image border-radius="6" width="131rpx" height="131rpx" :src="item.image"></u-image>
|
||||
</view>
|
||||
<view class="goods-info">
|
||||
<view class="goods-title u-line-2">{{ item.name }}</view>
|
||||
<view class="goods-price">
|
||||
<!-- <span v-if="sku.point">¥{{ sku.subtotal }}+{{ sku.point }}积分</span> -->
|
||||
|
||||
<span v-if="sku.orderItems.length <= 1">¥{{ sku.flowPrice }}</span>
|
||||
<span class="num" v-else>购买数量{{item.num}}</span>
|
||||
|
||||
<span v-if="sku.orderItems.length <= 1" class="num">购买数量: {{ item.num }}</span>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -66,8 +63,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
sn: "",
|
||||
applyInfo: {},
|
||||
sku: {},
|
||||
sku: {}, //sku
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
|
@ -77,6 +73,9 @@ export default {
|
|||
this.sku = newData;
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 选择退货流程
|
||||
*/
|
||||
onSelect(value) {
|
||||
uni.redirectTo({
|
||||
url: `./afterSalesDetail?sn=${this.sn}&sku=${encodeURIComponent(
|
||||
|
@ -84,7 +83,11 @@ export default {
|
|||
)}&value=${value}`,
|
||||
});
|
||||
},
|
||||
gotoGoodsDetail(id) {
|
||||
|
||||
/**
|
||||
* 跳转到商品信息
|
||||
*/
|
||||
navigateToGoodsDetail(id) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/goods?id=${id}&goodsId=${goodsId}`,
|
||||
});
|
||||
|
|
|
@ -1,298 +0,0 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="cancel-head">
|
||||
<u-cell-group>
|
||||
<u-cell-item title="未收货" :arrow="false">
|
||||
<u-radio-group wrap v-model="rog"><u-radio active-color="#1ABC9C" name="NO" @click="radioChange('NO')"></u-radio></u-radio-group>
|
||||
</u-cell-item>
|
||||
<u-cell-item title="已收货" v-if="applyService" :arrow="false">
|
||||
<u-radio-group wrap v-model="rog"><u-radio active-color="#1ABC9C" name="YES" @click="radioChange('YES')"></u-radio></u-radio-group>
|
||||
</u-cell-item>
|
||||
</u-cell-group>
|
||||
</view>
|
||||
<view class="cancle-body" v-if="rog === 'NO'">
|
||||
<view class="cancel-tips">
|
||||
<view class="tips-header">温馨提示:</view>
|
||||
<view>1. 订单取消后无法恢复;</view>
|
||||
<view>2. 订单取消后,使用的优惠券将不再返还,积分可以退回;</view>
|
||||
<view>3. 订单取消后,订单中的赠品要随商品一起返还给商家;</view>
|
||||
</view>
|
||||
<u-cell-group>
|
||||
<u-cell-item title="退款方式" value="原路退回" :arrow="false" v-if="isRetrace"></u-cell-item>
|
||||
<u-cell-item title="退款方式" value="账号退款" :arrow="false" v-else></u-cell-item>
|
||||
<u-cell-item title="退款金额" :value="refund_info.refund_price" :arrow="false"></u-cell-item>
|
||||
<u-cell-item title="取消原因" :value="refund_info.reason" @click="handleShowReason" :arrow="true" arrow-direction="down" required></u-cell-item>
|
||||
<u-action-sheet :list="reasonSelectActions" v-model="reasonSelectShow" @click="onSelectReason"></u-action-sheet>
|
||||
<view v-if="!isRetrace">
|
||||
<u-cell-item title="账户类型" :value="accountTypeText" @click="handleShowAccountType" :arrow="true" arrow-direction="down" required></u-cell-item>
|
||||
<u-action-sheet :list="accountTypeSelectActions" v-model="accountTypeSelectShow" @click="onSelectAccountType"></u-action-sheet>
|
||||
<view v-if="refund_info.account_type === 'BANK_TRANSFER'">
|
||||
<u-field v-model="refund_info.bank_name" required clearable label="银行名称" input-align="right" placeholder="请输入银行名称"></u-field>
|
||||
<u-field v-model="refund_info.bank_deposit_name" label-width="150" required clearable label="银行开户行" input-align="right" placeholder="请输入银行开户行"></u-field>
|
||||
<u-field v-model="refund_info.bank_account_name" label-width="150" required clearable label="银行开户名" input-align="right" placeholder="请输入银行开户名"></u-field>
|
||||
<u-field v-model="refund_info.bank_account_number" required clearable label="银行账号" input-align="right" placeholder="请输入银行账号"></u-field>
|
||||
</view>
|
||||
<u-field v-model="refund_info.return_account" required clearable label="退款账号" input-align="right" placeholder="请输入退款账号"></u-field>
|
||||
</view>
|
||||
<u-field v-model="refund_info.mobile" required clearable label="联系方式" input-align="right" placeholder="请输入手机号码"></u-field>
|
||||
</u-cell-group>
|
||||
<view class="submit-btn">
|
||||
<u-button shape="circle" class="cancel-btn" @click="handleCancelSubmit">取消</u-button>
|
||||
<u-button shape="circle" class="main-btn" @click="handleSubmitApply">提交</u-button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="service-body" v-else>
|
||||
<view class="cancel-tips">
|
||||
<view class="tips-header">温馨提示:</view>
|
||||
<view>1. 当前订单还未确认收货,如果申请售后,则订单自动确认收货;</view>
|
||||
<view>2. 如申请售后,使用的优惠券和积分等将不再返还;</view>
|
||||
<view>3. 订单中的赠品要随申请售后的商品一起返还给商家;</view>
|
||||
</view>
|
||||
<view class="submit-btn"><u-button shape="circle" class="main-btn" @click="handleApplyService">申请售后</u-button></view>
|
||||
</view>
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Foundation from '@/utils/Foundation.js';
|
||||
import RegExp from '@/utils/RegExp.js';
|
||||
import { applyCancelOrder } from '@/api/after-sale.js';
|
||||
import { confirmReceipt, getOrderDetail } from '@/api/order.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
/** 订单编号 */
|
||||
order_sn: 0,
|
||||
/** 订单详细 */
|
||||
order: '',
|
||||
/** 是否允许申请售后 */
|
||||
applyService: false,
|
||||
/** 是否已收货 */
|
||||
rog: 'NO',
|
||||
/** 是否支持原路退款 */
|
||||
isRetrace: false,
|
||||
/** 申请取消订单参数 */
|
||||
refund_info: {
|
||||
reason: '请选择取消原因',
|
||||
mobile: '',
|
||||
account_type: '',
|
||||
return_account: '',
|
||||
refund_price: 0.0
|
||||
},
|
||||
/** 是否展示取消原因下拉框 */
|
||||
reasonSelectShow: false,
|
||||
/** 取消原因下拉框数据 */
|
||||
reasonSelectActions: [
|
||||
{ text: '商品无货' },
|
||||
{ text: '配送时间问题' },
|
||||
{ text: '不想要了' },
|
||||
{ text: '商品信息填写错误' },
|
||||
{ text: '地址信息填写错误' },
|
||||
{ text: '商品降价' },
|
||||
{ text: '货物破损已拒签' },
|
||||
{ text: '订单无物流跟踪记录' },
|
||||
{ text: '非本人签收' },
|
||||
{ text: '其他' }
|
||||
],
|
||||
/** 账户类型下拉框选中的值 */
|
||||
accountTypeText: '请选择账户类型',
|
||||
/** 是否展示账户类型下拉框 */
|
||||
accountTypeSelectShow: false,
|
||||
/** 账户类型下拉框数据 */
|
||||
accountTypeSelectActions: [{ text: '支付宝', value: 'ALIPAY' }, { text: '微信', value: 'WEIXINPAY' }, { text: '银行卡', value: 'BANK_TRANSFER' }]
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
this.order_sn = options.sn;
|
||||
this.GET_OrderCancelDetail();
|
||||
},
|
||||
methods: {
|
||||
// 选中任一radio时,由radio-group触发
|
||||
radioChange(e) {
|
||||
this.rog = e;
|
||||
},
|
||||
/** 展示申请原因上拉框事件绑定 */
|
||||
handleShowReason() {
|
||||
this.reasonSelectShow = true;
|
||||
},
|
||||
|
||||
/** 申请原因选中事件绑定 */
|
||||
onSelectReason(index) {
|
||||
this.reasonSelectShow = false;
|
||||
this.refund_info.reason = this.reasonSelectActions[index].text;
|
||||
},
|
||||
|
||||
/** 展示账户类型上拉框事件绑定 */
|
||||
handleShowAccountType() {
|
||||
this.accountTypeSelectShow = true;
|
||||
},
|
||||
|
||||
/** 账户类型选中事件绑定 */
|
||||
onSelectAccountType(index) {
|
||||
this.accountTypeSelectShow = false;
|
||||
this.accountTypeText = this.accountTypeSelectActions[index].text;
|
||||
this.refund_info.account_type = this.accountTypeSelectActions[index].value;
|
||||
},
|
||||
|
||||
/** 跳转至订单列表页面 */
|
||||
handleCancelSubmit() {
|
||||
uni.redirectTo({
|
||||
url: '/pages/order/myOrder?status=0'
|
||||
});
|
||||
},
|
||||
|
||||
/** 申请售后 */
|
||||
handleApplyService() {
|
||||
confirmReceipt(this.order_sn).then(() => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/order/afterSales/afterSales'
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/** 校验参数 */
|
||||
handleCheckParams() {
|
||||
// 取消原因校验
|
||||
if (!this.refund_info.reason || this.refund_info.reason === '请选择取消原因') {
|
||||
this.$refs.uToast.show({ title: '请选择取消原因!', type: 'error' });
|
||||
return false;
|
||||
}
|
||||
// 联系方式校验
|
||||
if (!this.refund_info.mobile || !this.$u.test.mobile(this.refund_info.mobile)) {
|
||||
this.$refs.uToast.show({ title: '请输入正确格式的手机号码!', type: 'error' });
|
||||
return false;
|
||||
}
|
||||
|
||||
// 如果不支持原路退款
|
||||
if (!this.isRetrace) {
|
||||
// 账户类型校验
|
||||
if (!this.refund_info.account_type) {
|
||||
this.$refs.uToast.show({ title: '请选择账户类型!', type: 'error' });
|
||||
return false;
|
||||
}
|
||||
|
||||
// 如果账户类型不为银行卡
|
||||
if (this.refund_info.account_type != 'BANK_TRANSFER') {
|
||||
// 退款账号校验
|
||||
if (!this.refund_info.return_account) {
|
||||
this.$refs.uToast.show({ title: '请输入退款账号!', type: 'error' });
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// 银行名称校验
|
||||
if (!this.refund_info.bank_name) {
|
||||
this.$refs.uToast.show({ title: '请输入银行名称!', type: 'error' });
|
||||
return false;
|
||||
}
|
||||
// 银行开户行校验
|
||||
if (!this.refund_info.bank_deposit_name) {
|
||||
this.$refs.uToast.show({ title: '请输入银行开户行!', type: 'error' });
|
||||
return false;
|
||||
}
|
||||
// 银行开户名校验
|
||||
if (!this.refund_info.bank_account_name) {
|
||||
this.$refs.uToast.show({ title: '请输入银行开户名!', type: 'error' });
|
||||
return false;
|
||||
}
|
||||
// 银行账号校验
|
||||
if (!this.refund_info.bank_account_number) {
|
||||
this.$refs.uToast.show({ title: '请输入银行账号!', type: 'error' });
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
/** 提交取消订单申请 */
|
||||
handleSubmitApply() {
|
||||
// 校验参数
|
||||
if (!this.handleCheckParams()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.refund_info.order_sn = this.order_sn;
|
||||
|
||||
applyCancelOrder(this.refund_info).then(() => {
|
||||
this.$refs.uToast.show({ title: '提交成功!', type: 'success' });
|
||||
this.handleCancelSubmit();
|
||||
});
|
||||
},
|
||||
|
||||
/** 获取订单详情信息 */
|
||||
GET_OrderCancelDetail() {
|
||||
getOrderDetail(this.order_sn).then(response => {
|
||||
this.order = response.data;
|
||||
this.isRetrace = this.order.is_retrace;
|
||||
this.refund_info.refund_price = Foundation.formatPrice(this.order.order_price);
|
||||
this.applyService = this.order.order_status === 'SHIPPED' && this.order.ship_status === 'SHIP_YES';
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
/deep/ .u-cell {
|
||||
// #ifdef MP-WEIXIN
|
||||
width: 100vw !important;
|
||||
overflow: hidden !important;
|
||||
display: block !important;
|
||||
|
||||
// #endif
|
||||
}
|
||||
/deep/ .u-cell_title{
|
||||
// #ifdef MP-WEIXIN
|
||||
float: left;
|
||||
// #endif
|
||||
}
|
||||
/deep/ .u-cell__value{
|
||||
// #ifdef MP-WEIXIN
|
||||
float: right;
|
||||
// #endif
|
||||
}
|
||||
|
||||
.cancel-head {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: flex-end;
|
||||
}
|
||||
.submit-btn {
|
||||
display: flex;
|
||||
margin-top: 40rpx;
|
||||
margin-bottom: 40rpx;
|
||||
text-align: center;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.cancel-tips {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 20rpx;
|
||||
font-size: 22rpx;
|
||||
font-family: PingFang SC, PingFang SC-Regular;
|
||||
color: #999999;
|
||||
view {
|
||||
margin-top: 6rpx;
|
||||
}
|
||||
.tips-header {
|
||||
color: #ff6262;
|
||||
font-size: 26rpx;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
}
|
||||
.main-btn {
|
||||
width: 40%;
|
||||
background-color: $light-color;
|
||||
color: #ffffff;
|
||||
}
|
||||
.cancel-btn {
|
||||
margin-right: 30px;
|
||||
width: 40%;
|
||||
border-color: $light-color;
|
||||
color: $light-color;
|
||||
}
|
||||
</style>
|
|
@ -12,11 +12,9 @@
|
|||
<view class="status-info">
|
||||
<view class="status-info-box">
|
||||
<view class="status-val">{{
|
||||
serviceStatusList[serviceDetail.serviceStatus]
|
||||
serviceDetail.serviceStatus | serviceStatusList
|
||||
}}</view>
|
||||
<!-- <view class="status-tip" v-if="allowable.allow_ship"
|
||||
>请您尽快将申请售后的商品退还给卖家</view
|
||||
> -->
|
||||
|
||||
<view class="status-tip">{{
|
||||
serviceDetail.serviceStatus | statusFilter
|
||||
}}</view>
|
||||
|
@ -35,7 +33,7 @@
|
|||
</view>
|
||||
<view class="goods-info">
|
||||
<view class="info-box">
|
||||
<view class="goods-item-view" @click="gotoGoodsDetail(serviceDetail)">
|
||||
<view class="goods-item-view" @click="navgiateToGoodsDetail(serviceDetail)">
|
||||
<view class="goods-img">
|
||||
<u-image border-radius="6" width="131rpx" height="131rpx" :src="serviceDetail.goodsImage"></u-image>
|
||||
</view>
|
||||
|
@ -99,21 +97,21 @@
|
|||
<view class="detail-item" v-if="serviceDetail.serviceType != 'RETURN_MONEY' && serviceDetail.serviceStatus != 'APPLY'">
|
||||
<view class="title">收货地址:</view>
|
||||
<view class="value">
|
||||
<span v-if="change_info.salesConsigneeAddressPath">{{
|
||||
change_info.salesConsigneeAddressPath
|
||||
<span v-if="storeAfterSaleAddress.salesConsigneeAddressPath">{{
|
||||
storeAfterSaleAddress.salesConsigneeAddressPath
|
||||
}}</span>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 如果服务类型为退款则不显示 -->
|
||||
<view class="detail-item" v-if="serviceDetail.serviceType != 'RETURN_MONEY' && serviceDetail.serviceStatus != 'APPLY'">
|
||||
<view class="title">联系人:</view>
|
||||
<view class="value">{{ change_info.salesConsigneeName }}</view>
|
||||
<view class="value">{{ storeAfterSaleAddress.salesConsigneeName }}</view>
|
||||
</view>
|
||||
<!-- 如果服务类型为退款则不显示 -->
|
||||
<view class="detail-item" v-if="serviceDetail.serviceType != 'RETURN_MONEY' && serviceDetail.serviceStatus != 'APPLY'">
|
||||
<view class="title">联系方式:</view>
|
||||
<view class="value">{{
|
||||
change_info.salesConsigneeMobile || "" | secrecyMobile
|
||||
storeAfterSaleAddress.salesConsigneeMobile || "" | secrecyMobile
|
||||
}}</view>
|
||||
</view>
|
||||
<view v-if="refundShow">
|
||||
|
@ -189,12 +187,6 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- <view class="submit-view">
|
||||
<view>在线客服</view>
|
||||
<view><u-button type="info" shape="circle" size="mini">撤销申请</u-button></view>
|
||||
</view> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -212,51 +204,21 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
// 售后单状态
|
||||
serviceStatusList: {
|
||||
APPLY: "申请售后",
|
||||
PASS: "通过售后",
|
||||
REFUSE: "拒绝售后",
|
||||
BUYER_RETURN: "买家退货,待卖家收货",
|
||||
SELLER_RE_DELIVERY: "商家换货/补发",
|
||||
SELLER_CONFIRM: "卖家确认收货",
|
||||
SELLER_TERMINATION: "卖家终止售后",
|
||||
BUYER_CONFIRM: "买家确认收货",
|
||||
BUYER_CANCEL: "买家取消售后",
|
||||
WAIT_REFUND: "等待平台退款",
|
||||
COMPLETE: "完成售后",
|
||||
},
|
||||
// 售后类型
|
||||
serviceTypeList: {
|
||||
// 售后类型
|
||||
CANCEL: "取消",
|
||||
RETURN_GOODS: "退货",
|
||||
EXCHANGE_GOODS: "换货",
|
||||
RETURN_MONEY: "退款",
|
||||
},
|
||||
|
||||
orderStatusList: {
|
||||
UNDELIVERED: "待发货",
|
||||
UNPAID: "未付款",
|
||||
PAID: "已付款",
|
||||
DELIVERED: "已发货",
|
||||
CANCELLED: "已取消",
|
||||
COMPLETE: "已完成",
|
||||
TAKE: "已完成",
|
||||
},
|
||||
serviceDetail: {},
|
||||
logs: [],
|
||||
allowable: {},
|
||||
goodsList: [],
|
||||
change_info: {},
|
||||
serviceDetail: {},
|
||||
express_info: {},
|
||||
imagesList: [],
|
||||
refundShow: false,
|
||||
accountShow: false,
|
||||
bankShow: false,
|
||||
returnAdressShow: true,
|
||||
shipInfoShow: false,
|
||||
sn: "",
|
||||
serviceDetail: {}, // 售后详情
|
||||
logs: [], //日志
|
||||
goodsList: [], //商品列表
|
||||
storeAfterSaleAddress: {}, //售后地址
|
||||
refundShow: false, //退款开关
|
||||
accountShow: false, //账户显示
|
||||
bankShow: false, //银行显示
|
||||
sn: "", //订单sn
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
|
@ -269,6 +231,9 @@ export default {
|
|||
this.getLog(options.sn);
|
||||
},
|
||||
filters: {
|
||||
/**
|
||||
* 售后状态信息
|
||||
*/
|
||||
statusFilter(val) {
|
||||
switch (val) {
|
||||
case "APPLY":
|
||||
|
@ -297,6 +262,10 @@ export default {
|
|||
return "";
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 退款信息
|
||||
*/
|
||||
refundWayFilter(val) {
|
||||
switch (val) {
|
||||
case "OFFLINE":
|
||||
|
@ -309,6 +278,9 @@ export default {
|
|||
return "";
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 账户信息
|
||||
*/
|
||||
accountTypeFilter(val) {
|
||||
switch (val) {
|
||||
case "WEIXINPAY":
|
||||
|
@ -338,18 +310,29 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取地址信息
|
||||
*/
|
||||
getAddress() {
|
||||
getstoreAfterSaleAddress(this.sn).then((res) => {
|
||||
if (res.data.success) {
|
||||
this.change_info = res.data.result;
|
||||
this.storeAfterSaleAddress = res.data.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取日志
|
||||
*/
|
||||
getLog(sn) {
|
||||
getAfterSaleLog(sn).then((res) => {
|
||||
this.logs = res.data.result;
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 初始化详情
|
||||
*/
|
||||
loadDetail() {
|
||||
uni.showLoading({
|
||||
title: "加载中",
|
||||
|
@ -357,9 +340,6 @@ export default {
|
|||
getServiceDetail(this.sn).then((res) => {
|
||||
uni.hideLoading();
|
||||
this.serviceDetail = res.data.result;
|
||||
this.allowable = this.serviceDetail.allowable;
|
||||
|
||||
this.express_info = this.serviceDetail.express_info;
|
||||
if (this.serviceDetail.serviceType == "RETURN_GOODS") {
|
||||
this.refundShow = true;
|
||||
}
|
||||
|
@ -375,11 +355,19 @@ export default {
|
|||
this.serviceDetail.accountType === "BANK_TRANSFER";
|
||||
});
|
||||
},
|
||||
gotoGoodsDetail(item) {
|
||||
|
||||
/**
|
||||
* 访问商品详情
|
||||
*/
|
||||
navgiateToGoodsDetail(item) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 进度
|
||||
*/
|
||||
onProgress() {
|
||||
uni.navigateTo({
|
||||
url: `./applyProgress?sn=${
|
||||
|
@ -394,7 +382,7 @@ export default {
|
|||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
<style lang="scss" scoped>
|
||||
page,
|
||||
.content {
|
||||
background: $page-color-base;
|
||||
|
@ -457,14 +445,6 @@ page,
|
|||
color: $main-color;
|
||||
}
|
||||
}
|
||||
.after-num {
|
||||
margin: 0rpx 30rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 80rpx;
|
||||
}
|
||||
}
|
||||
.apply-detail-view {
|
||||
background-color: #f7f7f7;
|
||||
|
@ -487,35 +467,7 @@ page,
|
|||
}
|
||||
}
|
||||
}
|
||||
.submit-view {
|
||||
position: fixed;
|
||||
z-index: 999;
|
||||
bottom: 0px;
|
||||
left: 0px;
|
||||
margin-top: 100rpx;
|
||||
border: solid 2rpx #f2f2f2;
|
||||
background-color: #ffffff;
|
||||
height: 100rpx;
|
||||
width: 750rpx;
|
||||
padding: 0rpx 20rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.addr-title {
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
border-bottom: 2rpx solid #d6d6d6;
|
||||
}
|
||||
.addr-info {
|
||||
padding: 50rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.log-box-bottom {
|
||||
height: 120rpx;
|
||||
flex-direction: column;
|
||||
|
|
|
@ -17,12 +17,11 @@
|
|||
</view>
|
||||
<view class="info-view">
|
||||
<view>
|
||||
<u-time-line v-if="list.length != 0">
|
||||
<u-time-line v-if="logList.length != 0">
|
||||
<u-time-line-item>
|
||||
|
||||
<!-- 此处没有自定义左边的内容,会默认显示一个点 -->
|
||||
<template v-slot:content>
|
||||
<view v-for="(time,index) in list" :key="index">
|
||||
<view v-for="(time,index) in logList" :key="index">
|
||||
<view class="u-order-desc">{{time.message}}</view>
|
||||
<view class="u-order-time">{{time.createTime}}</view>
|
||||
</view>
|
||||
|
@ -38,29 +37,21 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import UEmpty from "@/uview-ui/components/u-empty/u-empty.vue";
|
||||
export default {
|
||||
components: {
|
||||
UEmpty
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
sn: "",
|
||||
createTime: "",
|
||||
list: [],
|
||||
serviceStatus: "",
|
||||
sn: "", //sn
|
||||
createTime: "", //创建时间
|
||||
logList: [], //日志集合
|
||||
serviceStatus: "", //订单状态
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
this.sn = options.sn;
|
||||
this.createTime = decodeURIComponent(options.createTime);
|
||||
this.serviceStatus = this.statusFilter(options.serviceStatus);
|
||||
this.list = JSON.parse(decodeURIComponent(options.logs));
|
||||
console.log(options.logs);
|
||||
// list.forEach(res => {
|
||||
// res.log_time_str = this.$u.timeFormat(res.log_time, 'yyyy-mm-dd hh:MM:ss');
|
||||
// })
|
||||
// this.list = list;
|
||||
this.logList = JSON.parse(decodeURIComponent(options.logs));
|
||||
|
||||
},
|
||||
methods: {
|
||||
statusFilter(val) {
|
||||
|
@ -95,7 +86,7 @@
|
|||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
<style lang="scss" scoped>
|
||||
page,
|
||||
.content {
|
||||
background: $page-color-base;
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
<view class="success-text">售后申请提交成功</view>
|
||||
<view class="btn-view">
|
||||
<view class="btn-item">
|
||||
<u-button ripple class="btn1" shape="circle" @click="toMenu()">查看记录</u-button>
|
||||
<u-button ripple class="btn1" shape="circle" @click="navigateToAfterSales()">查看记录</u-button>
|
||||
</view>
|
||||
<view class="btn-item">
|
||||
<u-button ripple class="btn2" shape="circle" @click="toHome()">回到主页</u-button>
|
||||
<u-button ripple class="btn2" shape="circle" @click="navigateToHome()">回到主页</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -27,12 +27,19 @@ export default {
|
|||
return {};
|
||||
},
|
||||
methods: {
|
||||
toMenu() {
|
||||
/**
|
||||
* 跳转到售后服务
|
||||
*/
|
||||
navigateToAfterSales() {
|
||||
uni.redirectTo({
|
||||
url: "/pages/order/afterSales/afterSales",
|
||||
});
|
||||
},
|
||||
toHome() {
|
||||
|
||||
/**
|
||||
* 跳转到首页
|
||||
*/
|
||||
navigateToHome() {
|
||||
uni.switchTab({
|
||||
url: "/pages/tabbar/home/index",
|
||||
});
|
||||
|
@ -41,7 +48,7 @@ export default {
|
|||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
<style lang="scss" scoped>
|
||||
page {
|
||||
background: $page-color-base;
|
||||
padding-bottom: 100rpx;
|
||||
|
|
|
@ -16,10 +16,8 @@
|
|||
</view>
|
||||
<view class="goods-info">
|
||||
<view class="goods-title u-line-2">{{ sku.goodsName }}</view>
|
||||
|
||||
<view class="goods-price">
|
||||
¥{{ sku.flowPrice | unitPrice }}
|
||||
<!-- <span>+{{ '1' }}积分</span> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-num">
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
|
||||
<!-- 店铺商品信息 -->
|
||||
<div class="box box2" v-for="(item, index) in orderMessage.cartList" :key="index">
|
||||
<u-row class="tab1" @click="tostore(item)">
|
||||
<u-row class="tab1" @click="navigateToStore(item)">
|
||||
<u-col :offset="0">
|
||||
<span class="ybname">{{ item.storeName }}</span>
|
||||
</u-col>
|
||||
|
@ -224,14 +224,6 @@ export default {
|
|||
shippingText: "LOGISTICS",
|
||||
shippingFlag: false,
|
||||
shippingMethod: [
|
||||
// {
|
||||
// value: "SELF_PICK_UP",
|
||||
// label: "自提",
|
||||
// },
|
||||
// {
|
||||
// value: "LOCAL_TOWN_DELIVERY",
|
||||
// label: "同城配送",
|
||||
// },
|
||||
{
|
||||
value: "LOGISTICS",
|
||||
label: "物流",
|
||||
|
@ -260,6 +252,10 @@ export default {
|
|||
};
|
||||
},
|
||||
filters: {
|
||||
|
||||
/**
|
||||
* 发票收据类型
|
||||
*/
|
||||
receiptType(type) {
|
||||
switch (type) {
|
||||
case "VATORDINARY":
|
||||
|
@ -281,8 +277,6 @@ export default {
|
|||
if (e.from == "backbutton") {
|
||||
let routes = getCurrentPages();
|
||||
let curRoute = routes[routes.length - 1].options;
|
||||
console.log(routes);
|
||||
|
||||
routes.forEach((item) => {
|
||||
if (
|
||||
item.route == "pages/tabbar/cart/cartList" ||
|
||||
|
@ -309,8 +303,6 @@ export default {
|
|||
uni.showLoading({
|
||||
mask: true,
|
||||
});
|
||||
// this.checkedshipMethod([this.shippingMethod[2]]);
|
||||
|
||||
this.getOrderList();
|
||||
uni.hideLoading();
|
||||
if (this.routerVal.way == "PINTUAN") {
|
||||
|
@ -327,9 +319,7 @@ export default {
|
|||
//发票回调 选择发票之后刷新购物车
|
||||
async callbackInvoice(val) {
|
||||
this.invoiceFlag = false;
|
||||
|
||||
this.receiptList = val;
|
||||
|
||||
if (val) {
|
||||
let submit = {
|
||||
way: this.routerVal.way,
|
||||
|
@ -344,29 +334,11 @@ export default {
|
|||
},
|
||||
|
||||
// 跳转到店铺
|
||||
tostore(val) {
|
||||
navigateToStore(val) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/product/shopPage?id=" + val.storeId,
|
||||
});
|
||||
},
|
||||
// 点击配送方式选择
|
||||
// checkedshipMethod(val) {
|
||||
// API_Order.selectedShipMethod({
|
||||
// shippingMethod: val[0].value,
|
||||
// way: this.routerVal.way,
|
||||
// }).then((res) => {
|
||||
// if (res.data.code == 200) {
|
||||
// this.shippingText = val[0].value;
|
||||
// } else {
|
||||
// uni.showToast({
|
||||
// title: res.data.message,
|
||||
// duration: 2000,
|
||||
// icon: "none",
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// },
|
||||
|
||||
// 点击跳转地址
|
||||
clickToAddress() {
|
||||
this.navigateTo(
|
||||
|
@ -419,12 +391,18 @@ export default {
|
|||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* 跳转
|
||||
*/
|
||||
navigateTo(url) {
|
||||
uni.navigateTo({
|
||||
url,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 提交订单准备支付
|
||||
*/
|
||||
submit() {
|
||||
if (!this.address.id) {
|
||||
uni.showToast({
|
||||
|
@ -457,6 +435,9 @@ export default {
|
|||
? (submit.parentOrderSn = this.routerVal.parentOrder.orderSn)
|
||||
: delete submit.parentOrderSn;
|
||||
|
||||
/**
|
||||
* 创建订单
|
||||
*/
|
||||
API_Trade.createTrade(submit).then((res) => {
|
||||
if (res.data.success) {
|
||||
uni.showToast({
|
||||
|
@ -491,6 +472,9 @@ export default {
|
|||
this.$u.debounce(this.submit(), 3000);
|
||||
},
|
||||
|
||||
/**
|
||||
* 微信小程序中直接支付
|
||||
*/
|
||||
async pay(sn) {
|
||||
new LiLiWXPay({
|
||||
sn: sn,
|
||||
|
@ -499,7 +483,7 @@ export default {
|
|||
},
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* 获取用户地址
|
||||
*/
|
||||
getUserAddress() {
|
||||
// 如果没有商品选择地址的话 则选择 默认地址
|
||||
|
@ -509,8 +493,6 @@ export default {
|
|||
","
|
||||
);
|
||||
this.address = res.data.result;
|
||||
|
||||
console.log(this.address);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
@ -142,7 +142,7 @@ export default {
|
|||
this.invoiceHeader[0].active = true;
|
||||
this.goodsType[0].active = true;
|
||||
}
|
||||
console.log(this.res);
|
||||
|
||||
},
|
||||
methods: {
|
||||
handleClickHeader(val, index, arr) {
|
||||
|
|
|
@ -3,27 +3,25 @@
|
|||
<view class="navbar">
|
||||
<view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
|
||||
</view>
|
||||
|
||||
<swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
|
||||
<swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
|
||||
<scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData(tabIndex)">
|
||||
<!-- 空白页 -->
|
||||
<empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
|
||||
|
||||
<!-- 订单列表 -->
|
||||
<view class="seller-view" :key="oderIndex" v-for="(order, oderIndex) in tabItem.orderList">
|
||||
<!-- 店铺名称 -->
|
||||
<view class="seller-info u-flex u-row-between">
|
||||
<view class="seller-name" @click="tostore(order)">
|
||||
<view class="seller-name" @click="navigateToStore(order)">
|
||||
<view class="name">{{ order.storeName }}</view>
|
||||
</view>
|
||||
<view class="order-sn">{{
|
||||
orderStatusList[order.orderStatus]
|
||||
order.orderStatus | orderStatusList
|
||||
}}</view>
|
||||
</view>
|
||||
<view>
|
||||
<view>
|
||||
<view class="goods-item-view" @click="onDetail(order.sn)">
|
||||
<view class="goods-item-view" @click="navigateToOrderDetail(order.sn)">
|
||||
<view class="goods-img" v-for="(goods, goodsIndex) in order.orderItems" :key="goodsIndex">
|
||||
<u-image border-radius="6" width="100%" height="100%" :src="goods.image"></u-image>
|
||||
</view>
|
||||
|
@ -31,7 +29,6 @@
|
|||
<view v-if="order.orderItems.length <= 1" class="goods-title u-line-2">{{ order.groupName }}</view>
|
||||
<view v-if="order.orderItems.length <= 1" class="goods-price">
|
||||
¥{{ order.flowPrice | unitPrice }}
|
||||
<!-- <span v-if="order.point">+{{ order.point }}积分</span> -->
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="order.orderItems.length <= 1" class="goods-num">
|
||||
|
@ -41,15 +38,10 @@
|
|||
</view>
|
||||
<view class="btn-view u-flex u-row-between">
|
||||
<view class="description">
|
||||
<!-- 全部 -->
|
||||
<!-- 等待付款 -->
|
||||
<text v-if="order.payStatus === 'PAID'">已付金额:</text>
|
||||
<text v-else>应付金额:</text>
|
||||
<text class="price">¥{{ order.flowPrice | unitPrice }}</text>
|
||||
|
||||
<!-- 等待发货 || 等待收货 || 交易完成 || 交易关闭 -->
|
||||
<!-- <text>已付金额:</text>
|
||||
<text class="price">¥12.00</text> -->
|
||||
</view>
|
||||
<view>
|
||||
<!-- 全部 -->
|
||||
|
@ -59,35 +51,18 @@
|
|||
取消订单
|
||||
</u-button>
|
||||
<!-- 等待收货 -->
|
||||
<u-button ripple shape="circle" class="rebuy-btn" size="mini" v-if="order.allowOperationVO.showLogistics" @click="onLogistics(order)">
|
||||
<u-button ripple shape="circle" class="rebuy-btn" size="mini" v-if="order.allowOperationVO.showLogistics" @click="navigateToLogistics(order)">
|
||||
查看物流
|
||||
</u-button>
|
||||
<u-button ripple :customStyle="{'background':$lightColor,'color':'#fff' }" shape="circle" class="pay-btn" size="mini" v-if="order.allowOperationVO.rog" @click="onRog(order.sn)">
|
||||
确认收货
|
||||
</u-button>
|
||||
<!-- 交易完成 未评价 -->
|
||||
<!-- <u-button
|
||||
shape="circle"
|
||||
class="rebuy-btn"
|
||||
size="mini"
|
||||
v-if="order.orderStatus == 'COMPLETE'"
|
||||
@click="onComment(order.sn)"
|
||||
>
|
||||
评价商品
|
||||
</u-button> -->
|
||||
<u-button ripple shape="circle" class="rebuy-btn" size="mini" v-if="
|
||||
order.orderStatus === 'CANCELLED' ||
|
||||
order.orderStatus === 'COMPLETE'
|
||||
" @click="reBuy(order)">
|
||||
再次购买
|
||||
</u-button>
|
||||
|
||||
<!-- 交易完成 未追评 -->
|
||||
<!-- <u-button class="u-margin-left-15" size="mini"> 追加评价</u-button>
|
||||
<u-button class="u-margin-left-15" size="mini"> 再次购买</u-button> -->
|
||||
<!-- 交易关闭 -->
|
||||
<!-- <u-button class="u-margin-left-15" size="mini"> 取消订单</u-button>
|
||||
<u-button class="u-margin-left-15" size="mini"> 重新购买</u-button> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -136,17 +111,9 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
tabCurrentIndex: 0,
|
||||
orderStatusList: {
|
||||
UNDELIVERED: "待发货",
|
||||
UNPAID: "未付款",
|
||||
PAID: "已付款",
|
||||
DELIVERED: "已发货",
|
||||
CANCELLED: "已取消",
|
||||
COMPLETED: "已完成",
|
||||
TAKE: "已完成",
|
||||
},
|
||||
tabCurrentIndex: 0, //导航栏索引
|
||||
navList: [
|
||||
//导航栏list
|
||||
{
|
||||
state: 0,
|
||||
text: "全部",
|
||||
|
@ -190,13 +157,14 @@ export default {
|
|||
pageNumber: 1,
|
||||
},
|
||||
],
|
||||
status: "",
|
||||
status: "", //接收导航栏状态
|
||||
params: {
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
tag: "ALL",
|
||||
},
|
||||
orderStatus: [
|
||||
//订单状态
|
||||
{
|
||||
orderStatus: "ALL", //全部
|
||||
},
|
||||
|
@ -216,14 +184,17 @@ export default {
|
|||
orderStatus: "CANCELLED", //已取消
|
||||
},
|
||||
],
|
||||
cancelShow: false,
|
||||
orderSn: "",
|
||||
cancelShow: false, //是否显示取消
|
||||
orderSn: "", //ordersn
|
||||
reason: "", //取消原因
|
||||
cancelList: "",
|
||||
|
||||
rogShow: false,
|
||||
cancelList: "", //取消列表
|
||||
rogShow: false, //显示是否收货
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* 跳转到个人中心
|
||||
*/
|
||||
onBackPress(e) {
|
||||
if (e.from == "backbutton") {
|
||||
uni.reLaunch({
|
||||
|
@ -233,8 +204,7 @@ export default {
|
|||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.loadData(this.status)
|
||||
// uni.stopPullDownRefresh();
|
||||
this.loadData(this.status);
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
|
@ -251,6 +221,7 @@ export default {
|
|||
},
|
||||
|
||||
watch: {
|
||||
/**监听更改请求数据 */
|
||||
tabCurrentIndex(val) {
|
||||
this.params.tag = this.orderStatus[val].orderStatus;
|
||||
//切换标签页将所有的页数都重置为1
|
||||
|
@ -264,13 +235,15 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
// 店铺详情
|
||||
tostore(val) {
|
||||
navigateToStore(val) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/product/shopPage?id=" + val.storeId,
|
||||
});
|
||||
},
|
||||
|
||||
//取消订单
|
||||
/**
|
||||
* 取消订单
|
||||
*/
|
||||
onCancel(sn) {
|
||||
this.orderSn = sn;
|
||||
this.cancelShow = true;
|
||||
|
@ -284,34 +257,51 @@ export default {
|
|||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 初始化数据
|
||||
*/
|
||||
initData(index) {
|
||||
this.navList[index].pageNumber = 1;
|
||||
this.navList[index].loadStatus = "more";
|
||||
this.navList[index].orderList = [];
|
||||
this.loadData(index);
|
||||
},
|
||||
|
||||
/**
|
||||
* 等待支付
|
||||
*/
|
||||
waitPay(val) {
|
||||
this.$u.debounce(this.pay(val), 3000)
|
||||
this.$u.debounce(this.pay(val), 3000);
|
||||
},
|
||||
|
||||
/**
|
||||
* 支付
|
||||
*/
|
||||
pay(val) {
|
||||
if (val.sn) {
|
||||
// #ifdef MP-WEIXIN
|
||||
new LiLiWXPay({sn:val.sn,price:val.flowPrice,orderType:'ORDER'}).pay()
|
||||
new LiLiWXPay({
|
||||
sn: val.sn,
|
||||
price: val.flowPrice,
|
||||
orderType: "ORDER",
|
||||
}).pay();
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
uni.navigateTo({
|
||||
url: "/pages/cart/payment/payOrder?order_sn=" + val.sn,
|
||||
})
|
||||
});
|
||||
// #endif
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
//获取订单列表
|
||||
/**
|
||||
* 获取订单列表
|
||||
*/
|
||||
loadData(index) {
|
||||
this.params.pageNumber = this.navList[index].pageNumber;
|
||||
getOrderList(this.params).then((res) => {
|
||||
uni.stopPullDownRefresh()
|
||||
uni.stopPullDownRefresh();
|
||||
if (!res.data.success) {
|
||||
this.navList[index].loadStatus = "noMore";
|
||||
return false;
|
||||
|
@ -392,17 +382,26 @@ export default {
|
|||
stateTipColor,
|
||||
};
|
||||
},
|
||||
onDetail(sn) {
|
||||
|
||||
/**
|
||||
* 跳转到订单详情
|
||||
*/
|
||||
navigateToOrderDetail(sn) {
|
||||
uni.navigateTo({
|
||||
url: "./orderDetail?sn=" + sn,
|
||||
});
|
||||
},
|
||||
|
||||
//选择取消原因
|
||||
/**
|
||||
* 选择取消原因
|
||||
*/
|
||||
reasonChange(reason) {
|
||||
this.reason = reason;
|
||||
},
|
||||
//提交取消订单(未付款)
|
||||
|
||||
/**
|
||||
* 提交取消订单(未付款)
|
||||
*/
|
||||
submitCancel() {
|
||||
cancelOrder(this.orderSn, { reason: this.reason }).then((res) => {
|
||||
if (res.statusCode == 200) {
|
||||
|
@ -414,24 +413,28 @@ export default {
|
|||
this.initData(0);
|
||||
|
||||
this.cancelShow = false;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.data.message,
|
||||
duration: 2000,
|
||||
icon: "none",
|
||||
});
|
||||
this.cancelShow = false
|
||||
this.cancelShow = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
//确认收货
|
||||
|
||||
/**
|
||||
* 确认收货显示
|
||||
*/
|
||||
onRog(sn) {
|
||||
this.orderSn = sn;
|
||||
this.rogShow = true;
|
||||
|
||||
//
|
||||
},
|
||||
|
||||
/**
|
||||
* 点击确认收货
|
||||
*/
|
||||
confirmRog() {
|
||||
confirmReceipt(this.orderSn).then((res) => {
|
||||
if (res.data.code == 200) {
|
||||
|
@ -445,28 +448,43 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
//评价商品
|
||||
|
||||
/**
|
||||
* 评价商品
|
||||
*/
|
||||
onComment(sn) {
|
||||
uni.navigateTo({
|
||||
url: "./evaluate/myEvaluate",
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 重新购买
|
||||
*/
|
||||
reBuy(order) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/product/goods?id=" + order.groupSkuId + "&goodsId="+ order.goodsId,
|
||||
url:
|
||||
"/pages/product/goods?id=" +
|
||||
order.groupSkuId +
|
||||
"&goodsId=" +
|
||||
order.goodsId,
|
||||
});
|
||||
},
|
||||
//查看物流
|
||||
onLogistics(order) {
|
||||
|
||||
/**
|
||||
* 查看物流
|
||||
*/
|
||||
navigateToLogistics(order) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/mine/msgTips/packageMsg/logisticsDetail?order_sn=" + order.sn,
|
||||
url:
|
||||
"/pages/mine/msgTips/packageMsg/logisticsDetail?order_sn=" + order.sn,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
<style lang="scss" scoped>
|
||||
page,
|
||||
.content {
|
||||
background: $page-color-base;
|
||||
|
@ -521,138 +539,6 @@ page,
|
|||
height: auto;
|
||||
}
|
||||
|
||||
/* load-more */
|
||||
.uni-load-more {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
height: 80rpx;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.uni-load-more__text {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.uni-load-more__img {
|
||||
height: 24px;
|
||||
width: 24px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.uni-load-more__img > view {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.uni-load-more__img > view view {
|
||||
width: 6px;
|
||||
height: 2px;
|
||||
border-top-left-radius: 1px;
|
||||
border-bottom-left-radius: 1px;
|
||||
background: #999;
|
||||
position: absolute;
|
||||
opacity: 0.2;
|
||||
transform-origin: 50%;
|
||||
animation: load 1.56s ease infinite;
|
||||
}
|
||||
|
||||
.uni-load-more__img > view view:nth-child(1) {
|
||||
transform: rotate(90deg);
|
||||
top: 2px;
|
||||
left: 9px;
|
||||
}
|
||||
|
||||
.uni-load-more__img > view view:nth-child(2) {
|
||||
transform: rotate(180deg);
|
||||
top: 11px;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.uni-load-more__img > view view:nth-child(3) {
|
||||
transform: rotate(270deg);
|
||||
bottom: 2px;
|
||||
left: 9px;
|
||||
}
|
||||
|
||||
.uni-load-more__img > view view:nth-child(4) {
|
||||
top: 11px;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.load1,
|
||||
.load2,
|
||||
.load3 {
|
||||
height: 24px;
|
||||
width: 24px;
|
||||
}
|
||||
|
||||
.load2 {
|
||||
transform: rotate(30deg);
|
||||
}
|
||||
|
||||
.load3 {
|
||||
transform: rotate(60deg);
|
||||
}
|
||||
|
||||
.load1 view:nth-child(1) {
|
||||
animation-delay: 0s;
|
||||
}
|
||||
|
||||
.load2 view:nth-child(1) {
|
||||
animation-delay: 0.13s;
|
||||
}
|
||||
|
||||
.load3 view:nth-child(1) {
|
||||
animation-delay: 0.26s;
|
||||
}
|
||||
|
||||
.load1 view:nth-child(2) {
|
||||
animation-delay: 0.39s;
|
||||
}
|
||||
|
||||
.load2 view:nth-child(2) {
|
||||
animation-delay: 0.52s;
|
||||
}
|
||||
|
||||
.load3 view:nth-child(2) {
|
||||
animation-delay: 0.65s;
|
||||
}
|
||||
|
||||
.load1 view:nth-child(3) {
|
||||
animation-delay: 0.78s;
|
||||
}
|
||||
|
||||
.load2 view:nth-child(3) {
|
||||
animation-delay: 0.91s;
|
||||
}
|
||||
|
||||
.load3 view:nth-child(3) {
|
||||
animation-delay: 1.04s;
|
||||
}
|
||||
|
||||
.load1 view:nth-child(4) {
|
||||
animation-delay: 1.17s;
|
||||
}
|
||||
|
||||
.load2 view:nth-child(4) {
|
||||
animation-delay: 1.3s;
|
||||
}
|
||||
|
||||
.load3 view:nth-child(4) {
|
||||
animation-delay: 1.43s;
|
||||
}
|
||||
|
||||
@-webkit-keyframes load {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
.seller-view {
|
||||
border-radius: 20rpx;
|
||||
background-color: #fff;
|
||||
|
|
|
@ -359,7 +359,7 @@ export default {
|
|||
* 投诉
|
||||
*/
|
||||
complaint(sku) {
|
||||
console.log(sku);
|
||||
|
||||
uni.navigateTo({
|
||||
url:
|
||||
"/pages/order/complain/complain?sn=" +
|
||||
|
@ -378,7 +378,7 @@ export default {
|
|||
},
|
||||
// 去支付
|
||||
toPay(val) {
|
||||
console.log(val);
|
||||
|
||||
val.sn
|
||||
? uni.navigateTo({
|
||||
url: "/pages/cart/payment/payOrder?order_sn=" + val.sn,
|
||||
|
@ -411,12 +411,7 @@ export default {
|
|||
this.cancelShow = true;
|
||||
},
|
||||
|
||||
//取消订单
|
||||
toCancel(sn) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/order/afterSales/applyCancel?sn=" + sn,
|
||||
});
|
||||
}, //提交取消订单(未付款)
|
||||
//提交取消订单(未付款)
|
||||
submitCancel() {
|
||||
cancelOrder(this.orderSn, { reason: this.reason }).then((res) => {
|
||||
if (res.data.success) {
|
||||
|
|
|
@ -23,7 +23,7 @@ export default {
|
|||
},
|
||||
onLoad(val) {
|
||||
this.routers = val;
|
||||
console.log(val);
|
||||
|
||||
getArticleDetail(val.id).then((res) => {
|
||||
if (res.data.result) {
|
||||
this.articleData = res.data.result.content;
|
||||
|
|
|
@ -100,7 +100,7 @@ export default {
|
|||
//联合信息返回登录
|
||||
stateLogin(state) {
|
||||
loginCallback(state).then((res) => {
|
||||
console.log(data);
|
||||
|
||||
let data = res.data;
|
||||
if (data.success) {
|
||||
storage.setAccessToken(data.result.accessToken);
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
this.form.mobile = res.data.mobile
|
||||
this.form.uname = res.data.uname
|
||||
this.form.uuid = res.data.uuid
|
||||
console.log(this.form)
|
||||
|
||||
this.getValidImgUrl()
|
||||
}
|
||||
|
||||
|
|
|
@ -89,12 +89,12 @@ export default {
|
|||
uni.hideLoading();
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
radioGroupChange(e) {
|
||||
console.log(e);
|
||||
|
||||
},
|
||||
radioChange(e) {
|
||||
if (this.anonymous == "YES") {
|
||||
|
@ -102,8 +102,6 @@ export default {
|
|||
} else {
|
||||
this.anonymous = "YES";
|
||||
}
|
||||
|
||||
console.log(e);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -79,8 +79,8 @@
|
|||
<span>积分</span>
|
||||
</span>
|
||||
|
||||
<span v-else> <span>¥</span><span class="price">{{ Fixed(goodsDetail.price)[0] }}</span>.{{
|
||||
Fixed(goodsDetail.price)[1]
|
||||
<span v-else> <span>¥</span><span class="price">{{ formatPrice(goodsDetail.price)[0] }}</span>.{{
|
||||
formatPrice(goodsDetail.price)[1]
|
||||
}} </span>
|
||||
</view>
|
||||
<view class="-goods-price" v-else> ¥<span class="price">0 </span>.00 </view>
|
||||
|
@ -158,7 +158,7 @@
|
|||
|
||||
<view class="page-bottom mp-iphonex-bottom" id="pageBottom">
|
||||
<view class="icon-btn">
|
||||
<view class="icon-btn-item" @click="linkstorePage(goodsDetail.storeId)">
|
||||
<view class="icon-btn-item" @click="navigateToStore(goodsDetail.storeId)">
|
||||
<u-icon size="34" class="red" name="home-fill"></u-icon>
|
||||
<view class="red icon-btn-name">店铺</view>
|
||||
</view>
|
||||
|
@ -214,7 +214,7 @@
|
|||
<popupAddress @closeAddress="closePopupAddress" @deliveryData="deliveryFun" v-if="goodsDetail.id" :goodsId="goodsDetail.id" :addressFlag="addressFlag" />
|
||||
|
||||
<!-- 商品规格 商品详情,以及默认参与活动的id-->
|
||||
<popupGoods :addr="delivery" ref="popupGoods" @changed="changedGoods" @closeBuy="closePopupBuy" @queryCart="cartNum()" :goodsDetail="goodsDetail" :goodsSpec="goodsSpec" :id="productId"
|
||||
<popupGoods :addr="delivery" ref="popupGoods" @changed="changedGoods" @closeBuy="closePopupBuy" @queryCart="cartCount()" :goodsDetail="goodsDetail" :goodsSpec="goodsSpec" :id="productId"
|
||||
v-if="goodsDetail.id " :pointDetail="pointDetail" @handleClickSku="init" :buyMask="buyMask" />
|
||||
</view>
|
||||
</view>
|
||||
|
@ -245,7 +245,6 @@ import GoodsSwiper from "./product/goods/-goods-swiper"; //轮播图组件
|
|||
import popupGoods from "./product/popup/goods"; //购物车商品的模块
|
||||
import popupAddress from "./product/popup/address"; //地址选择模块
|
||||
import shares from "@/components/m-share/index"; //分享
|
||||
|
||||
export default {
|
||||
components: {
|
||||
shares,
|
||||
|
@ -351,7 +350,7 @@ export default {
|
|||
if (val) {
|
||||
let timer = setInterval(() => {
|
||||
this.$refs.popupGoods.buyType = "PINTUAN";
|
||||
console.log(this.$refs.popupGoods.buyType);
|
||||
|
||||
clearInterval(timer);
|
||||
}, 100);
|
||||
|
||||
|
@ -394,8 +393,7 @@ export default {
|
|||
},
|
||||
async onLoad(options) {
|
||||
this.routerVal = options;
|
||||
},
|
||||
onShow() {
|
||||
|
||||
this.goodsDetail = {};
|
||||
//如果有参数ids说明事分销短连接,需要获取参数
|
||||
if (this.routerVal.scene) {
|
||||
|
@ -409,15 +407,11 @@ export default {
|
|||
this.init(
|
||||
this.routerVal.id,
|
||||
this.routerVal.goodsId,
|
||||
this.routerVal.distributionId,
|
||||
this.routerVal.whetherPoint
|
||||
this.routerVal.distributionId
|
||||
);
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
this.storeParams.pageNumber++;
|
||||
this.getOtherLikeGoods();
|
||||
},
|
||||
onShow() {},
|
||||
methods: {
|
||||
// 循环出当前促销是否为空
|
||||
emptyPromotion() {
|
||||
|
@ -430,7 +424,7 @@ export default {
|
|||
}
|
||||
},
|
||||
/**初始化信息 */
|
||||
async init(id, goodsId, distributionId, whetherPoint) {
|
||||
async init(id, goodsId, distributionId) {
|
||||
this.isGroup = false; //初始化拼团
|
||||
this.productId = id; // skuId
|
||||
// 这里请求获取到页面数据 解析数据
|
||||
|
@ -456,7 +450,6 @@ export default {
|
|||
// 积分
|
||||
if (item.indexOf("POINTS_GOODS") == 0) {
|
||||
this.pointDetail = this.PromotionList[item];
|
||||
console.log(this.pointDetail);
|
||||
}
|
||||
});
|
||||
// 轮播图
|
||||
|
@ -466,7 +459,7 @@ export default {
|
|||
this.getstoreBaseInfoFun(this.goodsDetail.storeId);
|
||||
|
||||
// 获取购物车
|
||||
this.cartNum();
|
||||
this.cartCount();
|
||||
|
||||
// 获取店铺推荐商品
|
||||
this.getstoreRecommend();
|
||||
|
@ -481,13 +474,14 @@ export default {
|
|||
},
|
||||
|
||||
// 格式化金钱 1999 --> [1999,00]
|
||||
Fixed(val) {
|
||||
formatPrice(val) {
|
||||
if (typeof val == "undefined") {
|
||||
return val;
|
||||
}
|
||||
return val.toFixed(2).split(".");
|
||||
},
|
||||
|
||||
/**选择商品 */
|
||||
changedGoods(val) {
|
||||
this.selectedGoods = val;
|
||||
},
|
||||
|
@ -516,7 +510,9 @@ export default {
|
|||
this.shutMask(4, "PINTUAN", order);
|
||||
},
|
||||
|
||||
// 查看购物车
|
||||
/**
|
||||
* 查看购物车
|
||||
*/
|
||||
reluchToCart() {
|
||||
let obj = {
|
||||
from: "product",
|
||||
|
@ -528,8 +524,10 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
// 查询购物车总数量
|
||||
cartNum() {
|
||||
/**
|
||||
* 查询购物车总数量
|
||||
*/
|
||||
cartCount() {
|
||||
if (storage.getHasLogin()) {
|
||||
API_trade.getCartNum().then((res) => {
|
||||
this.nums = res.data.result;
|
||||
|
@ -537,11 +535,25 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回
|
||||
*/
|
||||
back() {
|
||||
|
||||
if(getCurrentPages().length ==1){
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/index'
|
||||
});
|
||||
}
|
||||
else{
|
||||
uni.navigateBack();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// 获取店铺信息
|
||||
/**
|
||||
* 获取店铺信息
|
||||
*/
|
||||
getstoreBaseInfoFun(id) {
|
||||
API_store.getstoreBaseInfo(id).then((res) => {
|
||||
if (res.data.success) {
|
||||
|
@ -550,9 +562,10 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
// 删除收藏店铺
|
||||
/**
|
||||
* 删除收藏店铺
|
||||
*/
|
||||
deleteGoodsCollectionFun(id) {
|
||||
// deleteStoreCollection
|
||||
API_Members.deleteGoodsCollection(id).then((res) => {
|
||||
if (res.statusCode == 200) {
|
||||
uni.showToast({
|
||||
|
@ -564,7 +577,9 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
// 获取商品是否已被收藏
|
||||
/**
|
||||
* 获取商品是否已被收藏
|
||||
*/
|
||||
getGoodsCollectionFun(goodsId) {
|
||||
if (storage.getHasLogin()) {
|
||||
API_Members.getGoodsIsCollect(goodsId, "GOODS").then((res) => {
|
||||
|
@ -573,7 +588,9 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
// 获取店铺推荐商品列表
|
||||
/**
|
||||
* 获取店铺推荐商品列表
|
||||
*/
|
||||
getstoreRecommend() {
|
||||
getGoodsList({
|
||||
pageNumber: 1,
|
||||
|
@ -585,7 +602,9 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
// 获取相似商品列表
|
||||
/**
|
||||
* 获取相似商品列表
|
||||
*/
|
||||
getOtherLikeGoods() {
|
||||
getGoodsList({
|
||||
pageNumber: 1,
|
||||
|
@ -597,7 +616,9 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
// 领取优惠券
|
||||
/**
|
||||
* 领取优惠券
|
||||
*/
|
||||
receiveCouponsFun(id) {
|
||||
API_Members.receiveCoupons(id).then((res) => {
|
||||
uni.showToast({
|
||||
|
@ -607,18 +628,25 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
linkstorePage(store_id) {
|
||||
/**
|
||||
* 跳转到店铺页面
|
||||
*/
|
||||
navigateToStore(store_id) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/shopPage?id=` + store_id,
|
||||
});
|
||||
},
|
||||
|
||||
//获取优惠券按钮
|
||||
/**
|
||||
* 获取优惠券按钮
|
||||
*/
|
||||
getCoupon(item) {
|
||||
this.receiveCouponsFun(item.id);
|
||||
},
|
||||
|
||||
//规格弹窗开关
|
||||
/**
|
||||
* 规格弹窗开关
|
||||
*/
|
||||
shutMask(flag, buyFlag, type) {
|
||||
// type是指是否点击底部按钮
|
||||
if (flag) {
|
||||
|
@ -656,14 +684,15 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
//收藏
|
||||
/**
|
||||
* 收藏
|
||||
*/
|
||||
clickFavorite(id) {
|
||||
if (this.favorite) {
|
||||
// 取消收藏
|
||||
this.deleteGoodsCollectionFun(id);
|
||||
return false;
|
||||
}
|
||||
|
||||
API_Members.collectionGoods(id, "GOODS").then((res) => {
|
||||
if (res.data.success) {
|
||||
uni.showToast({
|
||||
|
@ -672,16 +701,16 @@ export default {
|
|||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.favorite = !this.favorite;
|
||||
},
|
||||
|
||||
// 顶部header显示或隐藏
|
||||
/**
|
||||
* 顶部header显示或隐藏
|
||||
*/
|
||||
pageScroll(e) {
|
||||
if (this.scrollFlag) {
|
||||
this.calcSize();
|
||||
}
|
||||
|
||||
if (e.detail.scrollTop > 200) {
|
||||
//当距离大于200时显示回到顶部按钮
|
||||
this.headerFlag = true;
|
||||
|
@ -702,7 +731,10 @@ export default {
|
|||
this.scrollId = "4";
|
||||
}
|
||||
},
|
||||
//计算每个要跳转到的模块高度信息
|
||||
|
||||
/**
|
||||
* 计算每个要跳转到的模块高度信息
|
||||
*/
|
||||
calcSize() {
|
||||
let h = 0;
|
||||
let that = this;
|
||||
|
@ -744,7 +776,10 @@ export default {
|
|||
});
|
||||
this.scrollFlag = false;
|
||||
},
|
||||
// 点击顶部跳转到对应位置
|
||||
|
||||
/**
|
||||
* 点击顶部跳转到对应位置
|
||||
*/
|
||||
headerTab(id) {
|
||||
if (this.scrollFlag) {
|
||||
this.calcSize();
|
||||
|
@ -756,7 +791,9 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
// 点击分享
|
||||
/**
|
||||
* 点击分享
|
||||
*/
|
||||
async shareChange() {
|
||||
this.shareFlage = true;
|
||||
},
|
||||
|
|
|
@ -51,7 +51,7 @@ export default {
|
|||
let res = await getGoodsMessage(this.goodsId);
|
||||
if (res.data.success) {
|
||||
this.goodsDetail = res.data.result;
|
||||
console.log(this.goodsDetail);
|
||||
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
<view class="price-sales">
|
||||
<div class="item-price" v-if="item.price != undefined">
|
||||
¥
|
||||
<span>{{ Fixed(item.price)[0] }}</span>
|
||||
.{{Fixed(item.price)[1]}}
|
||||
<span>{{ formatPrice(item.price)[0] }}</span>
|
||||
.{{formatPrice(item.price)[1]}}
|
||||
<!-- <text v-if="item.point != undefined">+{{ item.point }}积分</text> -->
|
||||
</div>
|
||||
</view>
|
||||
|
@ -48,7 +48,7 @@ export default {
|
|||
});
|
||||
},
|
||||
// 格式化金钱 1999 --> [1999,00]
|
||||
Fixed(val) {
|
||||
formatPrice(val) {
|
||||
if (typeof val == "undefined") {
|
||||
return val;
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
<view class="goods-price " v-if="goodsDetail.promotionPrice">
|
||||
<span v-if="goodsDetail.promotionPrice && !pointDetail">
|
||||
¥
|
||||
<span class="goods-price-promotionShow goods-price-bigshow" >{{ Fixed(goodsDetail.promotionPrice)[0] }}</span>
|
||||
.{{ Fixed(goodsDetail.promotionPrice)[1] }}
|
||||
<span class="goods-price-promotionShow goods-price-bigshow" >{{ formatPrice(goodsDetail.promotionPrice)[0] }}</span>
|
||||
.{{ formatPrice(goodsDetail.promotionPrice)[1] }}
|
||||
</span>
|
||||
<span v-if="pointDetail.points">
|
||||
|
||||
|
@ -24,9 +24,9 @@
|
|||
<div class="promotion-box">
|
||||
¥
|
||||
<span class="goods-price-bigshow">{{
|
||||
Fixed(goodsDetail.price)[0]
|
||||
formatPrice(goodsDetail.price)[0]
|
||||
}}</span>
|
||||
.{{ Fixed(goodsDetail.price)[1] }}
|
||||
.{{ formatPrice(goodsDetail.price)[1] }}
|
||||
|
||||
</div>
|
||||
</view>
|
||||
|
@ -35,9 +35,9 @@
|
|||
<span>
|
||||
¥
|
||||
<span class="goods-price-bigshow">{{
|
||||
Fixed(goodsDetail.price)[0]
|
||||
formatPrice(goodsDetail.price)[0]
|
||||
}}</span>
|
||||
.{{ Fixed(goodsDetail.price)[1] }}
|
||||
.{{ formatPrice(goodsDetail.price)[1] }}
|
||||
|
||||
</span>
|
||||
</view>
|
||||
|
@ -129,7 +129,7 @@ export default {
|
|||
|
||||
methods: {
|
||||
// 格式化金钱 1999 --> [1999,00]
|
||||
Fixed(val) {
|
||||
formatPrice(val) {
|
||||
if (typeof val == "undefined") {
|
||||
return val;
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ export default {
|
|||
},
|
||||
|
||||
mounted() {
|
||||
console.log(this.pointDetail)
|
||||
|
||||
this.formatSku(this.goodsSpec);
|
||||
},
|
||||
};
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
<view class="u-group-flex-left" v-if="promotion.__key == 'SECKILL' ">
|
||||
|
||||
<span class="u-group-flex-left-span" v-if="detail.promotionPrice!=undefined">
|
||||
¥ <span class="flex-price"> {{ Fixed(detail.promotionPrice)[0]}}.{{ Fixed(detail.promotionPrice)[1]}}</span>
|
||||
¥ <span class="flex-price"> {{ formatPrice(detail.promotionPrice)[0]}}.{{ formatPrice(detail.promotionPrice)[1]}}</span>
|
||||
|
||||
</span>
|
||||
<view class="u-group-flex" v-if="detail.price!=undefined">
|
||||
<span class="old-price">¥{{ Fixed(detail.price)[0]}}.{{ Fixed(detail.price)[1]}}</span>
|
||||
<span class="old-price">¥{{ formatPrice(detail.price)[0]}}.{{ formatPrice(detail.price)[1]}}</span>
|
||||
<view class="promotion">限时抢购</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -25,12 +25,12 @@
|
|||
<view class="u-group-flex-left" v-if="promotion.__key == 'GROUPBUY' ">
|
||||
<span class="u-group-flex-left-span">
|
||||
<span class="flex-price"
|
||||
v-if="promotion.groupbuy_goods_vo.price !=undefined">¥{{ Fixed(promotion.groupbuy_goods_vo.price )[0]}}.{{ Fixed(promotion.groupbuy_goods_vo.price )[1]}}</span>
|
||||
v-if="promotion.groupbuy_goods_vo.price !=undefined">¥{{ formatPrice(promotion.groupbuy_goods_vo.price )[0]}}.{{ formatPrice(promotion.groupbuy_goods_vo.price )[1]}}</span>
|
||||
<!-- <span v-if="promotion.point">+{{promotion.point}}积分</span> -->
|
||||
</span>
|
||||
<view class="u-group-flex">
|
||||
<span class="old-price"
|
||||
v-if="promotion.groupbuy_goods_vo.original_price!=undefined">¥{{ Fixed(promotion.groupbuy_goods_vo.original_price)[0]}}.{{ Fixed(promotion.groupbuy_goods_vo.original_price)[1]}}</span>
|
||||
v-if="promotion.groupbuy_goods_vo.original_price!=undefined">¥{{ formatPrice(promotion.groupbuy_goods_vo.original_price)[0]}}.{{ formatPrice(promotion.groupbuy_goods_vo.original_price)[1]}}</span>
|
||||
<view class="promotion">团购活动</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -38,10 +38,10 @@
|
|||
<view class="u-group-flex-left" v-if="promotion.__key == 'PINTUAN' ">
|
||||
|
||||
<span class="u-group-flex-left-span" v-if="detail.promotionPrice != undefined">
|
||||
¥<span class="flex-price"> {{ Fixed(detail.promotionPrice)[0]}}.</span>{{ Fixed(detail.promotionPrice)[1]}}
|
||||
¥<span class="flex-price"> {{ formatPrice(detail.promotionPrice)[0]}}.</span>{{ formatPrice(detail.promotionPrice)[1]}}
|
||||
</span>
|
||||
<view class="u-group-flex" v-if="detail.price != undefined">
|
||||
<span class="old-price">¥{{ Fixed(detail.price)[0]}}.{{ Fixed(detail.price)[1]}}</span>
|
||||
<span class="old-price">¥{{ formatPrice(detail.price)[0]}}.{{ formatPrice(detail.price)[1]}}</span>
|
||||
<view class="promotion">拼团活动</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -98,7 +98,7 @@ export default {
|
|||
mounted() {},
|
||||
methods: {
|
||||
// 格式化金钱 1999 --> [1999,00]
|
||||
Fixed(val) {
|
||||
formatPrice(val) {
|
||||
if (typeof val == "undefined") {
|
||||
return val;
|
||||
}
|
||||
|
@ -106,14 +106,12 @@ export default {
|
|||
},
|
||||
getCountDownTime(val) {
|
||||
let date = new Date(val.replace(/-/g, "/"))
|
||||
|
||||
let timeSimple = new Date(date).getTime() / 1000;
|
||||
console.log(timeSimple , timeSimple - new Date().getTime() / 1000)
|
||||
return timeSimple - new Date().getTime() / 1000;
|
||||
},
|
||||
getIsTimer(val) {
|
||||
var timestamp = new Date().getTime();
|
||||
// console.log(timestamp);
|
||||
|
||||
|
||||
if (timestamp < val.start_time) {
|
||||
this.startTimer = true;
|
||||
|
|
|
@ -41,16 +41,15 @@ export default {
|
|||
},
|
||||
watch: {
|
||||
res: {
|
||||
handler(val) {
|
||||
console.log(val);
|
||||
// if (this.res && this.res.length != 0) {
|
||||
// Object.keys(this.res).forEach((item) => {
|
||||
// if (item != "COUPON") {
|
||||
// let key = item.split("-")[0];
|
||||
// this.res[item]._key = key;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
handler() {
|
||||
if (this.res && this.res.length != 0) {
|
||||
Object.keys(this.res).forEach((item) => {
|
||||
if (item != "COUPON") {
|
||||
let key = item.split("-")[0];
|
||||
this.res[item]._key = key;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
immediate: true,
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
{{ item.goodsName }}
|
||||
</view>
|
||||
<view class="item-price" v-if="item.price != undefined">
|
||||
¥<span class="item-price-blod">{{ Fixed(item.price)[0] }}</span>.{{ Fixed(item.price)[1] }}
|
||||
¥<span class="item-price-blod">{{ formatPrice(item.price)[0] }}</span>.{{ formatPrice(item.price)[1] }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -49,7 +49,7 @@ export default {
|
|||
mounted() {},
|
||||
methods: {
|
||||
// 格式化金钱 1999 --> [1999,00]
|
||||
Fixed(val) {
|
||||
formatPrice(val) {
|
||||
if (typeof val == "undefined") {
|
||||
return val;
|
||||
}
|
||||
|
|
|
@ -3,31 +3,22 @@
|
|||
<view class="status_bar">
|
||||
<!-- 这里是状态栏 -->
|
||||
</view>
|
||||
|
||||
<view class="header">
|
||||
<div class="search">
|
||||
|
||||
<u-icon @click="back" style="margin:0 10rpx 0;" name="arrow-left" size="40" color="#fff"></u-icon>
|
||||
|
||||
<u-search :show-action="false" border-color="#fff" bg-color="#fff" v-model="keyword" @search="search" placeholder="请输入搜索" />
|
||||
<!-- <input /> -->
|
||||
|
||||
<u-icon @click="shareChange()" style="margin:0 10rpx 0;" name="share-fill" size="40" color="#fff"></u-icon>
|
||||
|
||||
</div>
|
||||
<view class="tab-header">
|
||||
<text :class="{ cur: tabIndex == 0 }" @click="setCat(0)">首页</text>
|
||||
<text :class="{ cur: tabIndex == 1 }" @click="setCat(1)">商品</text>
|
||||
<!-- <text :class="{ cur: tabIndex == 2 }" @click="setCat(2)">上新</text> -->
|
||||
<text :class="{ cur: tabIndex == 0 }" @click="checkNavigation(0)">首页</text>
|
||||
<text :class="{ cur: tabIndex == 1 }" @click="checkNavigation(1)">商品</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<swiper :current="tabIndex" class="swiper-box" @change="ontabchange">
|
||||
<swiper :current="tabIndex" class="swiper-box" @change="tabChange">
|
||||
<swiper-item class="swiper-item" v-for="(item, index) in indexCats" :key="index">
|
||||
<scroll-view class="scroll-v" scroll-anchoring enableBackToTop="true" scroll-y @refresherrefresh="refresh()" @scroll="pageScroll">
|
||||
<storePageMain :load="load" :storeId="storeId" v-if="index == 0"></storePageMain>
|
||||
<storePageGoods :load="load" :pageChange="pageChange" :categoryId="item" :storeId="storeId" v-if="index == 1"></storePageGoods>
|
||||
|
||||
<storePageGoods :load="load" :categoryId="item" :storeId="storeId" v-if="index == 1"></storePageGoods>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
|
@ -40,11 +31,8 @@
|
|||
|
||||
<script>
|
||||
import shares from "@/components/m-share/index"; //分享
|
||||
|
||||
import storePageMain from "./shopPageMain.vue";
|
||||
import storePageGoods from "./shopPageGoods.vue";
|
||||
|
||||
import { getstoreBaseInfo } from "@/api/store.js";
|
||||
export default {
|
||||
components: {
|
||||
shares,
|
||||
|
@ -53,78 +41,77 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
shareFlage: false,
|
||||
tabIndex: 0,
|
||||
keyword: "",
|
||||
shareFlage: false, //分享share
|
||||
tabIndex: 0, //默认为第一个tab
|
||||
keyword: "", //搜索关键字
|
||||
load: false,
|
||||
storeId: undefined,
|
||||
indexCats: [0, 1],
|
||||
scrollHeight: "",
|
||||
storeId: undefined, //店铺id
|
||||
indexCats: [0, 1], //默认为2个tab
|
||||
loadIndex: 1, //加载的距离
|
||||
pageChange: "",
|
||||
storeInfo: {},
|
||||
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* 加载
|
||||
*/
|
||||
async onLoad(options) {
|
||||
this.storeId = options.id;
|
||||
console.log(this.storeId);
|
||||
getstoreBaseInfo(this.storeId).then((res) => {
|
||||
this.storeInfo = res.data;
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
const { windowWidth, windowHeight } = uni.getSystemInfoSync();
|
||||
let tabHeader = 0;
|
||||
|
||||
let topHeight = 0;
|
||||
uni.getSystemInfo({
|
||||
success: function (res) {
|
||||
// res - 各种参数
|
||||
let search = uni.createSelectorQuery().select(".header");
|
||||
search
|
||||
.boundingClientRect(function (data) {
|
||||
//data - 各种参数
|
||||
topHeight = data.height; // 获取元素宽度
|
||||
})
|
||||
.exec();
|
||||
let nav = uni.createSelectorQuery().select(".tab-header");
|
||||
nav
|
||||
.boundingClientRect(function (data) {
|
||||
//data - 各种参数
|
||||
tabHeader = data.height; // 获取元素宽度
|
||||
})
|
||||
.exec();
|
||||
},
|
||||
});
|
||||
},
|
||||
mounted() {},
|
||||
|
||||
methods: {
|
||||
// 点击分享
|
||||
async shareChange() {
|
||||
this.shareFlage = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
search() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/navigation/search/searchPage?storeId=${this.storeId}&keyword=${this.keyword}`,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 下滑加载
|
||||
*/
|
||||
pageScroll(e) {
|
||||
if (e.detail.scrollTop > 300 * this.loadIndex) {
|
||||
this.loadIndex++;
|
||||
this.load = this.loadIndex;
|
||||
}
|
||||
// this.load = false;
|
||||
},
|
||||
|
||||
/**
|
||||
* 返回
|
||||
*/
|
||||
back() {
|
||||
if (getCurrentPages().length == 1) {
|
||||
uni.switchTab({
|
||||
url: "/pages/tabbar/home/index",
|
||||
});
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
}
|
||||
},
|
||||
setCat(type) {
|
||||
this.tabIndex = type;
|
||||
|
||||
/**
|
||||
* 点击导航栏
|
||||
*/
|
||||
checkNavigation(index) {
|
||||
this.tabIndex = index;
|
||||
},
|
||||
ontabchange(e) {
|
||||
|
||||
/**
|
||||
* 滑动回调
|
||||
*/
|
||||
tabChange(e) {
|
||||
this.tabIndex = e.detail.current;
|
||||
this.setCat(this.tabIndex);
|
||||
this.checkNavigation(this.tabIndex);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
@ -107,7 +107,7 @@ export default {
|
|||
},
|
||||
},
|
||||
onReachBottom() {
|
||||
console.log("触发");
|
||||
|
||||
this.loadMore();
|
||||
},
|
||||
mounted() {
|
||||
|
@ -148,10 +148,10 @@ export default {
|
|||
res.data.result.totalElements <=
|
||||
res.data.result.number * res.data.result.size
|
||||
) {
|
||||
console.warn(res.data.result.totalElements);
|
||||
|
||||
this.loadStatus = "noMore";
|
||||
} else {
|
||||
console.log(res.data.result.totalElements);
|
||||
|
||||
this.loadStatus = "loadmore";
|
||||
}
|
||||
this.goodsList.push(...res.data.result.content);
|
||||
|
|
|
@ -10,15 +10,15 @@
|
|||
<view class="name">{{ storeInfo.storeName }}</view>
|
||||
<view>{{ storeInfo.goodsNum || 0 }}关注 {{ storeInfo.collectionNum || 0 }}件商品</view>
|
||||
</view>
|
||||
<view class="follow" @click="handleCollection">
|
||||
<view class="follow" @click="whetherCollection">
|
||||
<view>{{ isCollection == 'success' ? '已关注' : '+ 关注' }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="store-intro">
|
||||
<view class="title">店铺简介</view>
|
||||
<view class="text" :class="introFlag ? 'close' : 'open'">
|
||||
<view class="text" >
|
||||
<view v-html="storeInfo.storeDesc"></view>
|
||||
<!-- <view class="zhankai" :class="introFlag ? 'close' : 'open'" @click="shut"></view> -->
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<!-- 优惠券 -->
|
||||
|
@ -40,45 +40,21 @@
|
|||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- 店铺热卖 -->
|
||||
<!-- <view class="hot">
|
||||
<view class="title">店铺热卖</view>
|
||||
<scroll-view scroll-x="true" class="contant">
|
||||
<view v-if="!hotGoods.length" class="no-goods">暂无商品信息</view>
|
||||
<view v-else class="item-box" v-for="(item,index) in hotGoods" :key="index" @click="toGoodsDetail(item.goods_id)">
|
||||
<view class="item">
|
||||
<u-image width="106px" height="106px" class="item-img" :src="item.thumbnail" mode="">
|
||||
<u-loading slot="loading"></u-loading>
|
||||
</u-image>
|
||||
<text class="name">{{ item.goodsName }}</text>
|
||||
<text class="price">
|
||||
<text>¥{{ item.price }}</text>
|
||||
{{ item.point ? '+' + item.point + '积分' : '' }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view> -->
|
||||
<!-- 精选商品 -->
|
||||
<view class="handpick">
|
||||
<view class="title">精选商品</view>
|
||||
<view class="contant">
|
||||
<view v-if="!recommandGoods.length" class="no-goods">暂无商品信息</view>
|
||||
<view v-else class="item" v-for="(item,index) in recommandGoods" :key="index" @click="toGoodsDetail(item)">
|
||||
<view v-else class="item" v-for="(item,index) in recommandGoods" :key="index" @click="navigateToGoodsDetail(item)">
|
||||
<u-image width="324rpx" height="324rpx" mode="aspectFit" :src="item.thumbnail">
|
||||
<u-loading slot="loading"></u-loading>
|
||||
</u-image>
|
||||
<div class="name">{{ item.goodsName }}</div>
|
||||
<div class="price">
|
||||
<div>¥{{ item.price | unitPrice }}</div>
|
||||
<!-- {{ item.point ? '+' + item.point + '积分' : '' }} -->
|
||||
<!-- <text class="before-price">¥{{ item.price }}</text> -->
|
||||
</div>
|
||||
<view class="buyCount">
|
||||
<div>已售 {{ item.buyCount || "0" }}</div>
|
||||
<text>
|
||||
<!-- 好评{{ 1111 }} -->
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -98,27 +74,22 @@ import {
|
|||
} from "@/api/members.js";
|
||||
import { getGoodsList } from "@/api/goods.js";
|
||||
import { getAllCoupons } from "@/api/promotions.js";
|
||||
import storage from "@/utils/storage.js";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
storeId: {
|
||||
value: Number,
|
||||
},
|
||||
load: {
|
||||
value:Boolean
|
||||
}
|
||||
value: Boolean,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 店铺介绍按钮
|
||||
introFlag: true,
|
||||
storeInfo: [],
|
||||
isCollection: false,
|
||||
hotGoods: [],
|
||||
recommandGoods: [],
|
||||
couponList: [],
|
||||
lingquFlag: true,
|
||||
storeInfo: "", //店铺详情
|
||||
isCollection: false, //是否关注
|
||||
recommandGoods: [], //推荐货物
|
||||
couponList: [], //优惠券列表
|
||||
params: {
|
||||
pageNumber: 1,
|
||||
pageSize: 50,
|
||||
|
@ -126,19 +97,21 @@ export default {
|
|||
},
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
||||
},
|
||||
watch: {},
|
||||
mounted(options) {
|
||||
if (this.$options.filters.isLogin("auth")) {
|
||||
getGoodsIsCollect("STORE", this.storeId).then((res) => {
|
||||
this.isCollection = res.data.message;
|
||||
});
|
||||
}
|
||||
this.initstoreInfo();
|
||||
this.initStoreInfo();
|
||||
},
|
||||
methods: {
|
||||
initstoreInfo() {
|
||||
|
||||
/**
|
||||
* 店铺信息
|
||||
*/
|
||||
initStoreInfo() {
|
||||
uni.showLoading({
|
||||
title: "加载中",
|
||||
});
|
||||
|
@ -153,7 +126,6 @@ export default {
|
|||
,
|
||||
]).then((res) => {
|
||||
this.couponList = res[0].data.result.records;
|
||||
this.hotGoods = res[1].data.result.content;
|
||||
this.recommandGoods = res[1].data.result.content;
|
||||
});
|
||||
} else {
|
||||
|
@ -163,16 +135,21 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
shut() {
|
||||
this.introFlag = !this.introFlag;
|
||||
},
|
||||
|
||||
toGoodsDetail(val) {
|
||||
|
||||
/**
|
||||
* 跳转到商品详情
|
||||
*/
|
||||
navigateToGoodsDetail(val) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/goods?id=${val.id}&goodsId=${val.goodsId}`,
|
||||
});
|
||||
},
|
||||
handleCollection() {
|
||||
|
||||
/**
|
||||
* 是否收藏
|
||||
*/
|
||||
whetherCollection() {
|
||||
if (this.isCollection) {
|
||||
deleteGoodsCollection("STORE", this.storeId).then((res) => {
|
||||
if (res.statusCode === 200) {
|
||||
|
@ -197,6 +174,10 @@ export default {
|
|||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取优惠券
|
||||
*/
|
||||
getCoupon(item) {
|
||||
if (!this.$options.filters.isLogin("auth")) {
|
||||
uni.showToast({
|
||||
|
|
|
@ -1,165 +0,0 @@
|
|||
<template>
|
||||
<view class="storeNew">
|
||||
<view class="storeNew-item" v-for="(value, key, index) in upGoodsMap" :key="key">
|
||||
<view class="storeNew-item-title">{{ key }}</view>
|
||||
|
||||
<view class="index-items">
|
||||
<view class="index-item" v-for="(item, _index) in value" :key="_index" @click="gotoGoodsDetail(item.goods_id)">
|
||||
<view class="index-item-img">
|
||||
<u-image height="160px" width="173px" class="index-item-store-img" :src="item.thumbnail">
|
||||
<u-loading slot="loading"></u-loading>
|
||||
</u-image>
|
||||
<view class="index-item-title">
|
||||
{{ item.name }}
|
||||
<view class="index-item-title-desc">{{ item.storeName }}</view>
|
||||
</view>
|
||||
<!-- <view class="index-item-price">{{ '¥' + item.price }}{{ item.point ? '+'+item.point + '积分' : '' }}</view> -->
|
||||
<view class="index-item-price">{{ '¥' + item.price }}</view>
|
||||
<!-- <view class="index-item-tags">
|
||||
<view class="index-item-tag"><uni-tag text="限购" type="error" :inverted="true" size="small"></uni-tag></view>
|
||||
<view class="index-item-tag"><uni-tag text="秒杀" type="error" :inverted="true" size="small"></uni-tag></view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uniTag from '@/components/uni-tag/uni-tag.vue';
|
||||
import { getGoodsListUplog } from '@/api/goods.js';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
storeId: {
|
||||
value: Number
|
||||
}
|
||||
},
|
||||
components: {
|
||||
uniTag
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
params: {
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
storeId: this.storeId
|
||||
},
|
||||
upGoodsMap: {}
|
||||
};
|
||||
},
|
||||
mounted(options) {
|
||||
this.initUpGoodsInfo();
|
||||
},
|
||||
methods: {
|
||||
gotoGoodsDetail(id) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/goods?id=${id}`
|
||||
});
|
||||
},
|
||||
initUpGoodsInfo() {
|
||||
getGoodsListUplog(this.params).then(res => {
|
||||
this.upGoodsMap = res.data;
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
|
||||
.storeNew {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.storeNew-item {
|
||||
background-color: #fff;
|
||||
}
|
||||
.storeNew-item-title {
|
||||
height: 132rpx;
|
||||
line-height: 132rpx;
|
||||
font-size: 32rpx;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
&:before,
|
||||
&:after {
|
||||
content: '';
|
||||
width: 44rpx;
|
||||
height: 6rpx;
|
||||
position: absolute;
|
||||
background: #f0f1fc;
|
||||
}
|
||||
&:before {
|
||||
top: 63rpx;
|
||||
left: 216rpx;
|
||||
}
|
||||
&:after {
|
||||
border-radius: 22rpx 22rpx 0 0;
|
||||
top: 63rpx;
|
||||
right: 216rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.index-items {
|
||||
padding-left: 20 rpx;
|
||||
background-color: #f7f7f7;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.index-item {
|
||||
width: 346 rpx;
|
||||
min-height: 2610 rpx;
|
||||
background-color: #fff;
|
||||
margin: 0 18 rpx 20 rpx 0;
|
||||
border-radius: 16 rpx;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
.index-item-store-img{
|
||||
width: 346 rpx !important;
|
||||
height: 320 rpx !important;
|
||||
}
|
||||
.index-item-img {
|
||||
image {
|
||||
width: 346 rpx;
|
||||
height: 320 rpx;
|
||||
}
|
||||
}
|
||||
.index-item-title {
|
||||
font-size: 26 rpx;
|
||||
color: #333333;
|
||||
padding: 10 rpx 0 0 20 rpx;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.index-item-title-desc {
|
||||
font-size: 25 rpx;
|
||||
color: #999999;
|
||||
margin-top: 10 rpx;
|
||||
}
|
||||
.index-item-price {
|
||||
font-size: 110 rpx;
|
||||
color: #ff5a10;
|
||||
padding: 10 rpx 0 0 20 rpx;
|
||||
}
|
||||
.index-item-tags {
|
||||
padding-left: 20 rpx;
|
||||
padding-top: 10 rpx;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.index-item-tag {
|
||||
width: 100 rpx;
|
||||
margin-right: 10 rpx;
|
||||
}
|
||||
</style>
|
|
@ -73,7 +73,7 @@
|
|||
// url: '/pages/tabbar/home/index',
|
||||
// success: function(res) {
|
||||
// // 通过eventChannel向被打开页面传送数据
|
||||
// console.log(res)
|
||||
|
||||
// }
|
||||
// });
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
|||
// url: '/pages/tabbar/home/index?' + new Date().getTime(),
|
||||
// success: function(res) {
|
||||
// // 通过eventChannel向被打开页面传送数据
|
||||
// console.log(res);
|
||||
|
||||
// }
|
||||
// });
|
||||
},
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<scroll-view scroll-x>
|
||||
<view class="index-navs">
|
||||
<view class="index-nav-v">
|
||||
<view class="index-nav" :class="{ 'index-nav-active': nav == index }" @click="setNav(index)" v-for="(item, index) in timeLine" :key="index">
|
||||
<view class="index-nav" :class="{ 'index-nav-active': nav == index }" @click="clickNavigateTime(index)" v-for="(item, index) in timeLine" :key="index">
|
||||
{{ item.timeLine }}:00
|
||||
<view class="index-nav-desc">{{ index === 0 && item.distanceStartTime === 0 ? '抢购中' : '即将开始' }}
|
||||
</view>
|
||||
|
@ -37,7 +37,7 @@
|
|||
<view class="sale-item-surplus-text" :style="{ width: (item.quantity / (item.quantity - item.salesNum)) * 100 + '%' }">
|
||||
</view>
|
||||
</view>
|
||||
<view class="sale-item-btn" @click="gotoGoodsDetail(item)">
|
||||
<view class="sale-item-btn" @click="navigateToGoodsDetail(item)">
|
||||
{{ timeLine[nav].distanceStartTime === 0 ? (item.salesNum === item.quantity ? '已售空' : '购买') : '即将开始' }}
|
||||
</view>
|
||||
</view>
|
||||
|
@ -59,21 +59,23 @@ import Foundation from "@/utils/Foundation.js";
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
nav: 0,
|
||||
sale: "",
|
||||
timeLine: "",
|
||||
resTime: 0,
|
||||
time: 0,
|
||||
times: {},
|
||||
onlyOne: "",
|
||||
goodsList: [],
|
||||
nav: 0, //默认选择第一个时间
|
||||
timeLine: "", //获取几个点活动
|
||||
resTime: 0, //当前时间
|
||||
time: 0, //距离下一个活动的时间值
|
||||
times: {}, //时间集合
|
||||
onlyOne: "", //是否最后一个商品
|
||||
goodsList: [], //商品集合
|
||||
params: {
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
},
|
||||
price: "",
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* 显示时间活动
|
||||
*/
|
||||
async onShow() {
|
||||
await this.getTimeLine();
|
||||
if (!this.timeLine) {
|
||||
|
@ -82,12 +84,6 @@ export default {
|
|||
duration: 2000,
|
||||
title: "今天没有活动,明天再来吧",
|
||||
});
|
||||
// setTimeout(() => {
|
||||
// uni.switchTab({
|
||||
// url: "/pages/index/index",
|
||||
// });
|
||||
// }, 2000);
|
||||
// return;
|
||||
}
|
||||
this._setTimeInterval = setInterval(() => {
|
||||
if (this.time <= 0) {
|
||||
|
@ -105,6 +101,9 @@ export default {
|
|||
this._setTimeInterval && clearInterval(this._setTimeInterval);
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 获取时间线商品
|
||||
*/
|
||||
async getTimeLine() {
|
||||
let res = await getSeckillTimeLine();
|
||||
if (res.data.success && res.data.result.length > 0) {
|
||||
|
@ -121,13 +120,15 @@ export default {
|
|||
(this.timeLine[this.nav + 1] &&
|
||||
this.timeLine[this.nav + 1].distanceStartTime) ||
|
||||
Foundation.theNextDayTime() - this.diffTime;
|
||||
// || Foundation.theNextDayTime())
|
||||
|
||||
this.times = Foundation.countTimeDown(this.time);
|
||||
|
||||
this.getGoodsList();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取商品集合
|
||||
*/
|
||||
async getGoodsList() {
|
||||
this.params.timeLine = this.timeLine[this.nav].timeLine;
|
||||
let res = await getSeckillTimeGoods(this.params.timeLine);
|
||||
|
@ -137,7 +138,11 @@ export default {
|
|||
this.goodsList = [];
|
||||
}
|
||||
},
|
||||
gotoGoodsDetail(item) {
|
||||
|
||||
/**
|
||||
* 跳转到商品详情
|
||||
*/
|
||||
navigateToGoodsDetail(item) {
|
||||
if (
|
||||
item.sold_num === item.quantity ||
|
||||
this.timeLine[this.nav].distanceStartTime !== 0
|
||||
|
@ -149,7 +154,11 @@ export default {
|
|||
});
|
||||
}
|
||||
},
|
||||
setNav(type) {
|
||||
|
||||
/**
|
||||
* 单击导航时间
|
||||
*/
|
||||
clickNavigateTime(type) {
|
||||
this.nav = type;
|
||||
this.diffTime = parseInt(new Date().getTime() / 1000) - this.resTime;
|
||||
this.time =
|
||||
|
@ -165,7 +174,7 @@ export default {
|
|||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
<style lang="scss" scoped>
|
||||
.sale {
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
|
@ -194,20 +203,6 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
.sale-title {
|
||||
width: 710rpx;
|
||||
height: 310rpx;
|
||||
margin: 0 auto;
|
||||
font-size: 32rpx;
|
||||
color: 666;
|
||||
background-color: #fff;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.sale-items {
|
||||
padding-top: 20rpx;
|
||||
display: -webkit-box;
|
||||
|
@ -233,7 +228,6 @@ export default {
|
|||
|
||||
.sale-item-img {
|
||||
margin-right: 20rpx;
|
||||
|
||||
image {
|
||||
width: 186rpx;
|
||||
height: 186rpx;
|
||||
|
@ -387,59 +381,4 @@ export default {
|
|||
font-size: 22rpx;
|
||||
color: #bababa;
|
||||
}
|
||||
|
||||
.index-nav-divider {
|
||||
height: 64rpx;
|
||||
border-left: 1px solid #dddddd;
|
||||
}
|
||||
|
||||
.index-items {
|
||||
padding-left: 20rpx;
|
||||
background-color: #f7f7f7;
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.index-item {
|
||||
width: 346rpx;
|
||||
height: 2100rpx;
|
||||
background-color: #fff;
|
||||
margin: 0 18rpx 20rpx 0;
|
||||
border-radius: 16rpx;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.index-item-img {
|
||||
image {
|
||||
width: 346rpx;
|
||||
height: 320rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.index-item-title {
|
||||
font-size: 26rpx;
|
||||
color: #333333;
|
||||
height: 410rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
padding: 10rpx 0 0 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.index-item-title-desc {
|
||||
font-size: 25rpx;
|
||||
color: #999999;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.index-item-price {
|
||||
font-size: 110rpx;
|
||||
color: #ff5a10;
|
||||
padding: 20rpx 0 0 20rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
<template>
|
||||
<div class="wrapper">
|
||||
<view class="status_bar">
|
||||
<!-- 这里是状态栏 -->
|
||||
</view>
|
||||
|
||||
<u-navbar :isBack="false" title="购物车">
|
||||
|
||||
</u-navbar>
|
||||
|
||||
<u-navbar :isBack="false" title="购物车"></u-navbar>
|
||||
<!-- 空白页-->
|
||||
<view v-if="cartDetail.cartList == '' || cartDetail.cartList == [] || !cartDetail" class="empty">
|
||||
<image src="/static/emptyCart.jpg" mode="aspectFit"></image>
|
||||
|
@ -20,31 +13,28 @@
|
|||
<!-- 店铺商品信息 -->
|
||||
<div class="content">
|
||||
<div class="box box2" :class="{ invalid: isInvalid(item) }" v-for="(item, index) in cartDetail.cartList" :key="index">
|
||||
|
||||
<view class="tab">
|
||||
<view class="store-line">
|
||||
<u-checkbox-group class="store-line-check">
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<u-checkbox shape="circle" active-color="rgb(255, 107, 53)" v-model="item.checked" @change="checkboxChangeDP(item)"></u-checkbox>
|
||||
<u-checkbox shape="circle" :active-color="$lightColor" v-model="item.checked" @change="checkboxChangeDP(item)"></u-checkbox>
|
||||
<!-- #endif -->
|
||||
<!-- 微信小程序这里 v-model出现问题,改用:value -->
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<u-checkbox shape="circle" active-color="rgb(255, 107, 53)" :value="item.checked" @change="checkboxChangeDP(item)"></u-checkbox>
|
||||
<u-checkbox shape="circle" :active-color="$lightColor" :value="item.checked" @change="checkboxChangeDP(item)"></u-checkbox>
|
||||
<!-- #endif -->
|
||||
</u-checkbox-group>
|
||||
<span class="ybname store-line-desc" @click.stop="tostore(item)">{{
|
||||
<span class="storeName store-line-desc" @click.stop="navigateToStore(item)">{{
|
||||
item.storeName
|
||||
}}</span>
|
||||
</view>
|
||||
<view class="right_Col" @click="toConpon(item)">
|
||||
<view class="right_Col" @click="navigateToConpon(item)">
|
||||
<div class="right_Line"></div>
|
||||
<span>领劵</span>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<u-swipe-action :show="skuItem.selected" @open="openAction(skuItem)" :options="options" bg-color="#fff" ref="swiperAction" class="cartItem" v-for="(skuItem, i) in item.skuList" :index="i"
|
||||
:key="skuItem.goodsSku.id" @click="longtap(skuItem)" @longpress="longtap(skuItem)">
|
||||
:key="skuItem.goodsSku.id" @click="changeActionTab(skuItem)" @longpress="changeActionTab(skuItem)">
|
||||
<!-- 满减活动 -->
|
||||
<div v-if="skuItem.promotions" v-for="(fullDiscount,fullDiscountIndex) in skuItem.promotions" :key="fullDiscountIndex">
|
||||
<div v-if="fullDiscount.promotionType == 'FULL_DISCOUNT'">
|
||||
|
@ -59,20 +49,20 @@
|
|||
<view>
|
||||
<u-checkbox-group v-if="skuItem.invalid == 0">
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<u-checkbox shape="circle" active-color="rgb(255, 107, 53)" class="c-left" v-model="skuItem.checked" @change="checkboxChange(skuItem)"></u-checkbox>
|
||||
<u-checkbox shape="circle" :active-color="$lightColor" class="c-left" v-model="skuItem.checked" @change="checkboxChange(skuItem)"></u-checkbox>
|
||||
<!-- #endif -->
|
||||
<!-- 微信小程序这里 v-model出现问题,改用:value -->
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<u-checkbox shape="circle" active-color="rgb(255, 107, 53)" class="c-left" :value="skuItem.checked" @change="checkboxChange(skuItem)"></u-checkbox>
|
||||
<u-checkbox shape="circle" :active-color="$lightColor" class="c-left" :value="skuItem.checked" @change="checkboxChange(skuItem)"></u-checkbox>
|
||||
<!-- #endif -->
|
||||
</u-checkbox-group>
|
||||
<span class="invalid" v-else style="font-size: 24rpx">失效</span>
|
||||
</view>
|
||||
<u-image border-radius="20" :fade="true" @click.native="toProduct(skuItem)" width="200rpx" height="200rpx" :src="skuItem.goodsSku.thumbnail" @click="toProduct(skuItem)" />
|
||||
<u-image border-radius="20" :fade="true" @click.native="navigateToGoods(skuItem)" width="200rpx" height="200rpx" :src="skuItem.goodsSku.thumbnail" @click="navigateToGoods(skuItem)" />
|
||||
</view>
|
||||
<view class="goods-content">
|
||||
<!-- 商品名称 -->
|
||||
<p class="sp-name" @click="toProduct(skuItem)">
|
||||
<p class="sp-name" @click="navigateToGoods(skuItem)">
|
||||
{{ skuItem.goodsSku.goodsName }}
|
||||
</p>
|
||||
<!-- 规格 -->
|
||||
|
@ -80,8 +70,8 @@
|
|||
<p class="sp-number">
|
||||
<view class="sp-price">
|
||||
<div class="default-color" :class="{'theme-color':skuItem.promotions.length <=0 }">
|
||||
¥<span>{{ Fixed(skuItem.goodsSku.price)[0] }}</span>
|
||||
<span>.{{ Fixed(skuItem.goodsSku.price)[1] }}</span>
|
||||
¥<span>{{ formatPrice(skuItem.goodsSku.price)[0] }}</span>
|
||||
<span>.{{ formatPrice(skuItem.goodsSku.price)[1] }}</span>
|
||||
</div>
|
||||
</view>
|
||||
<view>
|
||||
|
@ -106,8 +96,8 @@
|
|||
<!-- 如果有活动 并且是选中的状态,显示预估到手价格 -->
|
||||
<div class="priceDetail-flowPrice" :class="{'theme-color':skuItem.priceDetailDTO}"
|
||||
v-if="skuItem.priceDetailDTO && skuItem.invalid == 0 && skuItem.promotions.length!=0 && skuItem.checked && skuItem.checked">
|
||||
预估到手价 ¥<span>{{ Fixed(skuItem.priceDetailDTO.flowPrice)[0]}}</span>
|
||||
<span>.{{ Fixed(skuItem.priceDetailDTO.flowPrice)[1] }} </span>
|
||||
预估到手价 ¥<span>{{ formatPrice(skuItem.priceDetailDTO.flowPrice)[0]}}</span>
|
||||
<span>.{{ formatPrice(skuItem.priceDetailDTO.flowPrice)[1] }} </span>
|
||||
</div>
|
||||
|
||||
</p>
|
||||
|
@ -116,17 +106,16 @@
|
|||
</u-swipe-action>
|
||||
</div>
|
||||
</div>
|
||||
<u-modal v-model="delshow" @confirm="confirm" show-cancel-button :content="delcontent" :async-close="true"></u-modal>
|
||||
<u-modal v-model="deleteShow" @delectConfirm="delectConfirm" show-cancel-button :content="deleteContent" :async-close="true"></u-modal>
|
||||
<!-- 结账 -->
|
||||
<div class="box box6">
|
||||
<view class="navL">
|
||||
|
||||
<u-checkbox shape="circle" active-color="rgb(255, 107, 53)" v-model="checkout" @change="checkOut()" label-size="24">全选</u-checkbox>
|
||||
<u-checkbox shape="circle" :active-color="$lightColor" v-model="checkout" @change="checkOut()" label-size="24">全选</u-checkbox>
|
||||
<span class="price">
|
||||
<div class="prices">
|
||||
<div class="fullPrice">
|
||||
<span class="number" v-if="cartDetail && cartDetail.priceDetailDTO">
|
||||
总计: <span>¥{{ Fixed(cartDetail.priceDetailDTO.flowPrice)[0] }}</span>.<span>{{ Fixed(cartDetail.priceDetailDTO.flowPrice)[1] }}</span>
|
||||
总计: <span>¥{{ formatPrice(cartDetail.priceDetailDTO.flowPrice)[0] }}</span>.<span>{{ formatPrice(cartDetail.priceDetailDTO.flowPrice)[1] }}</span>
|
||||
</span>
|
||||
<span class="number" v-else>总计:0.00</span>
|
||||
</div>
|
||||
|
@ -137,7 +126,6 @@
|
|||
</div>
|
||||
</span>
|
||||
</view>
|
||||
|
||||
<!-- 优惠详情 -->
|
||||
<u-popup z-index="3" close mode="bottom" height="50%" closeable v-model="discountDetailsFlag" border-radius="20">
|
||||
<div class="discount-list">
|
||||
|
@ -151,29 +139,24 @@
|
|||
<div class="discount-item" v-if="cartDetail.priceDetailDTO">
|
||||
<span>优惠券</span>
|
||||
<span>-¥{{cartDetail.priceDetailDTO.couponPrice | unitPrice}}</span>
|
||||
|
||||
</div>
|
||||
<div class="discount-item" v-if="cartDetail.priceDetailDTO">
|
||||
|
||||
<span>其他优惠</span>
|
||||
<span>-¥{{cartDetail.priceDetailDTO.discountPrice | unitPrice}}</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</u-popup>
|
||||
|
||||
<view v-if="isEdit" @click="delGoods()">
|
||||
<div class="navR">删除</div>
|
||||
<view v-if="isEdit" @click="deleteGoods()">
|
||||
<div class="settlement">删除</div>
|
||||
</view>
|
||||
|
||||
<view v-else @click="submitOrder()">
|
||||
<div class="navR">去结算</div>
|
||||
<div class="settlement">去结算</div>
|
||||
</view>
|
||||
</div>
|
||||
<u-toast ref="uToast" />
|
||||
|
||||
<u-select :default-value="singleDefaultValue" v-model="singleFlag" @confirm="singleConfirm" value-name="activity_id" label-name="title" :list="singleList"></u-select>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
@ -181,56 +164,39 @@ import * as API_Trade from "@/api/trade";
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
discountDetailsFlag: false,
|
||||
lightColor:this.$lightColor,
|
||||
discountDetailsFlag: false, //优惠明细开关
|
||||
// 商品栏右侧滑动按钮
|
||||
options: [
|
||||
{
|
||||
text: "删除",
|
||||
style: {
|
||||
backgroundColor: this.$lightColor,
|
||||
backgroundColor: this.$lightColor, //高亮颜色
|
||||
},
|
||||
},
|
||||
],
|
||||
singleList: [],
|
||||
singleVal: "",
|
||||
singleDefaultValue: [], //默认选择第几个
|
||||
singleFlag: false, //选择器开关
|
||||
isInvalid(val) {
|
||||
//是否无效商品
|
||||
if (val.invalid == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
delshow: false,
|
||||
delcontent: "删除该商品?",
|
||||
show: false,
|
||||
empty: false, //空白页现实 true|false,
|
||||
|
||||
cartDetail: "",
|
||||
|
||||
price: 0,
|
||||
point: 0,
|
||||
|
||||
goodsVal: "",
|
||||
|
||||
// 是否是编辑
|
||||
isEdit: false,
|
||||
|
||||
checkout: true,
|
||||
cartBackbtn: {
|
||||
from: "",
|
||||
id: "",
|
||||
},
|
||||
WEIXIN_num: "",
|
||||
deleteShow: false, //右滑删除
|
||||
deleteContent: "删除该商品?", //删除显示的信息
|
||||
cartDetail: "", //购物车详情
|
||||
goodsVal: "", //单个商品详情
|
||||
isEdit: false, // 是否是编辑
|
||||
checkout: true, //全选按钮
|
||||
WEIXIN_num: "", //购物车兼容微信步进器
|
||||
};
|
||||
},
|
||||
watch: {},
|
||||
onReady() {
|
||||
// this.windowChangeSize();
|
||||
},
|
||||
/**
|
||||
* 初始化信息
|
||||
*/
|
||||
onShow() {
|
||||
this.delshow ? (this.delshow = false) : true;
|
||||
this.deleteShow ? (this.deleteShow = false) : true;
|
||||
if (this.$refs.swiperAction) {
|
||||
this.$refs.swiperAction.forEach((item, index) => {
|
||||
item.show = false;
|
||||
|
@ -241,162 +207,93 @@ export default {
|
|||
this.getCardData();
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {},
|
||||
methods: {
|
||||
/**
|
||||
* 倒数计时
|
||||
*/
|
||||
getCountDownTime(val) {
|
||||
let date = new Date(val.replace(/-/g, "/"));
|
||||
let timeSimple = new Date(date).getTime() / 1000;
|
||||
return timeSimple - new Date().getTime() / 1000;
|
||||
},
|
||||
isPintuan(val) {
|
||||
val.forEach((item) => {
|
||||
if (item.promotionType == "PINTUAN") {
|
||||
delete val[item];
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
},
|
||||
// 优惠明细
|
||||
|
||||
/**
|
||||
* 优惠明细开关
|
||||
*/
|
||||
discountDetails() {
|
||||
this.discountDetailsFlag = true;
|
||||
},
|
||||
|
||||
// 格式化金钱 1999 --> [1999,00]
|
||||
Fixed(val) {
|
||||
/**
|
||||
* 格式化金钱 1999 --> [1999,00]
|
||||
*/
|
||||
formatPrice(val) {
|
||||
if (typeof val == "undefined") {
|
||||
return val;
|
||||
}
|
||||
return val.toFixed(2).split(".");
|
||||
},
|
||||
|
||||
/**左滑打开删除 */
|
||||
/**
|
||||
* 左滑打开删除
|
||||
*/
|
||||
openAction(skuItem) {
|
||||
/**循环父级有多少个店铺 */
|
||||
this.cartDetail.cartList.forEach((cart_item, cart_index) => {
|
||||
if (cart_item.skuList) {
|
||||
cart_item.skuList.forEach((sku, sku_index) => {
|
||||
this.cartDetail.cartList.forEach((cartItem) => {
|
||||
if (cartItem.skuList) {
|
||||
cartItem.skuList.forEach((sku) => {
|
||||
this.$set(sku, "selected", false);
|
||||
});
|
||||
}
|
||||
});
|
||||
this.$set(skuItem, "selected", true);
|
||||
// skuItem.selected = true
|
||||
console.log(skuItem.selected);
|
||||
},
|
||||
// 点击选择活动
|
||||
singleConfirm(val) {
|
||||
console.log("val", val);
|
||||
if (val[0].value) {
|
||||
this.singleList.forEach((item) => {
|
||||
if (item.activity_id == val[0].value && item.title == val[0].label) {
|
||||
this.singleVal.activity_id = item.activity_id;
|
||||
this.singleVal.promotion_type = item.promotion_type;
|
||||
}
|
||||
});
|
||||
API_Trade.changeActivity(this.singleVal).then((res) => {
|
||||
if (res.statusCode == 200) {
|
||||
this.getCardData();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 选择活动框显示
|
||||
singleClick(val, data, index) {
|
||||
this.singleDefaultValue[0] = index;
|
||||
this.singleFlag = true;
|
||||
this.singleList = val;
|
||||
this.singleVal = {
|
||||
storeId: data.storeId,
|
||||
skuId: data.skuId,
|
||||
};
|
||||
},
|
||||
longtap(val) {
|
||||
this.delshow = true;
|
||||
|
||||
/**
|
||||
* 滑动删除
|
||||
*/
|
||||
changeActionTab(val) {
|
||||
this.deleteShow = true;
|
||||
this.goodsVal = val;
|
||||
},
|
||||
pointFormat(point, num) {
|
||||
if (num > 0) {
|
||||
var result = (point * 1000) / num / 1000;
|
||||
if (result && (result + "").indexOf(".") > 0) {
|
||||
return 0;
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
},
|
||||
windowChangeSize() {
|
||||
let topWidth;
|
||||
uni.getSystemInfo({
|
||||
success: function (res) {
|
||||
// res - 各种参数
|
||||
let search = uni.createSelectorQuery().select(".u-swipe-content");
|
||||
search
|
||||
.boundingClientRect(function (data) {
|
||||
//data - 各种参数
|
||||
if (data && data.width) {
|
||||
topWidth = data.width; // 获取元素宽度
|
||||
}
|
||||
})
|
||||
.exec();
|
||||
},
|
||||
});
|
||||
if (topWidth <= 100) {
|
||||
console.log(topWidth);
|
||||
this.reLaunch({
|
||||
url: "./cart",
|
||||
});
|
||||
}
|
||||
this.getCardData();
|
||||
},
|
||||
|
||||
// 点击编辑功能
|
||||
editCartMsg() {
|
||||
// 点击编辑出现删除功能
|
||||
this.isEdit = !this.isEdit;
|
||||
},
|
||||
|
||||
// 点击删除
|
||||
confirm() {
|
||||
/**
|
||||
* 点击删除
|
||||
*/
|
||||
delectConfirm() {
|
||||
API_Trade.deleteSkuItem(this.goodsVal.goodsSku.id).then((res) => {
|
||||
if (res.statusCode == 200) {
|
||||
uni.showToast({
|
||||
title: "此商品删除成功",
|
||||
duration: 2000,
|
||||
});
|
||||
this.delshow = false;
|
||||
this.deleteShow = false;
|
||||
this.getCardData();
|
||||
}
|
||||
});
|
||||
},
|
||||
// 判断是 1 为true 0 为 false
|
||||
isOneOrZero(val) {
|
||||
return val == 1 ? true : false;
|
||||
},
|
||||
|
||||
// 删除商品
|
||||
delGoods() {
|
||||
if (this.Config()) {
|
||||
var delData = [];
|
||||
this.cartDetail.cartList.forEach((item, index) => {
|
||||
item.skuList.forEach((goodsItem, index) => {
|
||||
/**
|
||||
* 删除商品
|
||||
*/
|
||||
deleteGoods() {
|
||||
if (this.whetherChecked()) {
|
||||
var delGoodsData = [];
|
||||
this.cartDetail.cartList.forEach((item) => {
|
||||
item.skuList.forEach((goodsItem) => {
|
||||
if (goodsItem.checked) {
|
||||
delData.push(goodsItem.goodsSku.id);
|
||||
delGoodsData.push(goodsItem.goodsSku.id);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (delData && delData.length > 0) {
|
||||
if (delGoodsData && delGoodsData.length > 0) {
|
||||
// 执行删除
|
||||
API_Trade.deleteSkuItem(delData).then((res) => {
|
||||
API_Trade.deleteSkuItem(delGoodsData).then((res) => {
|
||||
if (res.data.success) {
|
||||
uni.showToast({
|
||||
title: "删除成功!",
|
||||
icon: "none",
|
||||
});
|
||||
|
||||
this.getCardData();
|
||||
}
|
||||
});
|
||||
|
@ -409,20 +306,28 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
// 跳转到店铺
|
||||
tostore(val) {
|
||||
/**
|
||||
* 跳转到店铺
|
||||
*/
|
||||
navigateToStore(val) {
|
||||
uni.navigateTo({
|
||||
url: "../product/shopPage?id=" + val.storeId,
|
||||
});
|
||||
},
|
||||
// 跳转到优惠券
|
||||
toConpon(val) {
|
||||
|
||||
/**
|
||||
* 跳转到优惠券
|
||||
*/
|
||||
navigateToConpon(val) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/cart/coupon/couponCenter?storeId=" + val.storeId,
|
||||
});
|
||||
},
|
||||
// 跳转到商品
|
||||
toProduct(val) {
|
||||
|
||||
/**
|
||||
* 跳转到商品
|
||||
*/
|
||||
navigateToGoods(val) {
|
||||
uni.navigateTo({
|
||||
url:
|
||||
"/pages/product/goods?id=" +
|
||||
|
@ -431,14 +336,18 @@ export default {
|
|||
val.goodsSku.goodsId,
|
||||
});
|
||||
},
|
||||
numChange_WEIXIN(callback) {
|
||||
console.log(callback);
|
||||
this.WEIXIN_num = callback.value;
|
||||
console.log(this.WEIXIN_num);
|
||||
|
||||
/**
|
||||
* 点击步进器微信回调
|
||||
*/
|
||||
numChange_WEIXIN(callback) {
|
||||
this.WEIXIN_num = callback.value;
|
||||
this.numChange(callback.data, "3");
|
||||
},
|
||||
// 点击
|
||||
|
||||
/**
|
||||
* 点击步进器回调
|
||||
*/
|
||||
numChange(val, nums) {
|
||||
// #ifdef MP-WEIXIN
|
||||
if (nums && nums == "1") {
|
||||
|
@ -448,32 +357,36 @@ export default {
|
|||
} else if (nums && nums == "3") {
|
||||
val.num = this.WEIXIN_num;
|
||||
}
|
||||
|
||||
// #endif
|
||||
|
||||
this.updateSkuNumFun(val.goodsSku.id, val.num);
|
||||
},
|
||||
|
||||
/**
|
||||
* 去结算
|
||||
*/
|
||||
submitOrder() {
|
||||
if (this.Config()) {
|
||||
if (this.whetherChecked()) {
|
||||
this.navigateTo("/pages/order/fillorder?way=CART");
|
||||
}
|
||||
},
|
||||
|
||||
Config() {
|
||||
let can_buy = false;
|
||||
/**
|
||||
* 验证是否选中商品
|
||||
*/
|
||||
whetherChecked() {
|
||||
let canBuy = false;
|
||||
this.cartDetail.cartList.forEach((item) => {
|
||||
if (item.checked) {
|
||||
can_buy = true;
|
||||
canBuy = true;
|
||||
} else {
|
||||
item.skuList.forEach((skuItem) => {
|
||||
if (skuItem.checked) {
|
||||
can_buy = true;
|
||||
canBuy = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
if (!can_buy) {
|
||||
if (!canBuy) {
|
||||
uni.showToast({
|
||||
title: "您还没有选择商品",
|
||||
duration: 2000,
|
||||
|
@ -485,14 +398,18 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
// 跳转
|
||||
/**
|
||||
* 跳转
|
||||
*/
|
||||
navigateTo(url) {
|
||||
uni.navigateTo({
|
||||
url,
|
||||
});
|
||||
},
|
||||
|
||||
// 全选
|
||||
/**
|
||||
* 全选
|
||||
*/
|
||||
checkOut() {
|
||||
API_Trade.checkAll(this.checkout).then((result) => {
|
||||
if (result.data.success) {
|
||||
|
@ -502,7 +419,9 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
// 获取店铺选中信息
|
||||
/**
|
||||
* 获取店铺选中信息
|
||||
*/
|
||||
checkStoreFun(skuId, num) {
|
||||
API_Trade.checkStore(skuId, num).then((result) => {
|
||||
if (result.data.success) {
|
||||
|
@ -511,7 +430,9 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
// 店铺点击
|
||||
/**
|
||||
* 店铺点击
|
||||
*/
|
||||
checkboxChangeDP(e) {
|
||||
// #ifdef MP-WEIXIN
|
||||
e.checked = !e.checked;
|
||||
|
@ -519,7 +440,9 @@ export default {
|
|||
this.checkStoreFun(e.storeId, e.checked);
|
||||
},
|
||||
|
||||
// 获取购物车选中信息
|
||||
/**
|
||||
* 获取购物车选中信息
|
||||
*/
|
||||
updateSkuCheckedFun(skuId, num) {
|
||||
API_Trade.updateSkuChecked(skuId, num).then((result) => {
|
||||
if (result.data.success) {
|
||||
|
@ -528,7 +451,9 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
// 更新商品购物车数量
|
||||
/**
|
||||
* 更新商品购物车数量
|
||||
*/
|
||||
updateSkuNumFun(skuId, num) {
|
||||
API_Trade.updateSkuNum(skuId, num).then((result) => {
|
||||
if (result.statusCode == 200) {
|
||||
|
@ -542,7 +467,9 @@ export default {
|
|||
});
|
||||
},
|
||||
|
||||
// 获取购物车数据
|
||||
/**
|
||||
* 获取购物车数据
|
||||
*/
|
||||
getCardData() {
|
||||
if (this.$options.filters.isLogin("auth")) {
|
||||
uni.showLoading({
|
||||
|
@ -552,10 +479,10 @@ export default {
|
|||
.then((result) => {
|
||||
if (result.data.success) {
|
||||
this.cartDetail = result.data.result;
|
||||
|
||||
this.checkout = true;
|
||||
for (let i = 0; i < this.cartDetail.cartList.length; i++) {
|
||||
let item = this.cartDetail.cartList[i];
|
||||
// 循环出当前商品是否全选
|
||||
if (item.checked == 0) {
|
||||
this.checkout = false;
|
||||
}
|
||||
|
@ -568,7 +495,6 @@ export default {
|
|||
sku.promotions.splice(proIndex, 1);
|
||||
}
|
||||
});
|
||||
console.log(sku);
|
||||
});
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
|
@ -590,7 +516,9 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
// 选中某个复选框时,由checkbox时触发
|
||||
/**
|
||||
* 选中某个复选框时,由checkbox时触发
|
||||
*/
|
||||
checkboxChange(e) {
|
||||
// #ifdef MP-WEIXIN
|
||||
e.checked = !e.checked;
|
||||
|
@ -628,16 +556,6 @@ export default {
|
|||
.promotionNotice {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.sp_tag {
|
||||
display: inline;
|
||||
background: #f2f2f2;
|
||||
padding: 0 20rpx 0 10rpx;
|
||||
height: 20rpx;
|
||||
line-height: 20rpx;
|
||||
font-size: 24rpx;
|
||||
color: #262626;
|
||||
border-radius: 0.4em;
|
||||
}
|
||||
|
||||
.goods-row {
|
||||
padding: 30rpx 0;
|
||||
|
@ -646,47 +564,13 @@ export default {
|
|||
align-items: center;
|
||||
}
|
||||
|
||||
.sp_promotion {
|
||||
margin: 4rpx 0;
|
||||
}
|
||||
|
||||
.sp_tag_plain {
|
||||
margin-left: 8rpx;
|
||||
padding: 0 6rpx 0 6rpx;
|
||||
background: #fff;
|
||||
border: 1px solid $main-color;
|
||||
font-size: 24rpx;
|
||||
color: $main-color;
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
||||
.sp_tag_plain:nth-of-type(1) {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.sp_ingle {
|
||||
padding: 10rpx 0;
|
||||
}
|
||||
|
||||
.sp_ingle_icon {
|
||||
margin-left: 4rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.ybname {
|
||||
.storeName {
|
||||
font-weight: bold;
|
||||
}
|
||||
.invalid {
|
||||
filter: grayscale(1);
|
||||
}
|
||||
|
||||
.status_bar {
|
||||
position: fixed;
|
||||
height: var(--status-bar-height);
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.cartItem {
|
||||
border-radius: 0.4em;
|
||||
transition: 0.35s;
|
||||
|
@ -696,47 +580,6 @@ export default {
|
|||
padding-top: var(--status-bar-height);
|
||||
}
|
||||
|
||||
.prohibition {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 2;
|
||||
top: var(--status-bar-height);
|
||||
}
|
||||
|
||||
.header {
|
||||
background: #fff;
|
||||
position: relative;
|
||||
color: #333;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 26rpx;
|
||||
font-size: 34rpx;
|
||||
|
||||
.left,
|
||||
.right {
|
||||
position: absolute;
|
||||
width: max-content;
|
||||
height: max-content;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.left {
|
||||
float: left;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 20rpx;
|
||||
}
|
||||
|
||||
.right {
|
||||
float: right;
|
||||
right: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
/* 空白页 */
|
||||
/deep/ .u-number-input {
|
||||
background: #fff !important;
|
||||
|
@ -784,7 +627,7 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
.navR {
|
||||
.settlement {
|
||||
width: 180rpx;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
|
|
|
@ -4,171 +4,87 @@
|
|||
<div class="title"> 商品分类</div>
|
||||
<u-search class="nav-search" disabled @click.native="search" placeholder="搜索商品" :show-action="false"></u-search>
|
||||
</u-navbar>
|
||||
|
||||
<view class="content">
|
||||
<scroll-view scroll-y :scroll-top="num" scroll-with-animation class="left-aside">
|
||||
<view v-for="(item, index) in flist" :key="item.id" class="f-item b-b" :class="{ active: item.id === currentId }" @click="tabtap(item, index)">
|
||||
<scroll-view scroll-y scroll-with-animation class="left-aside">
|
||||
<view v-for="(item, index) in tabList" :key="item.id" class="f-item b-b" :class="{ active: item.id === currentId }" @click="tabtap(item, index)">
|
||||
{{ item.name }}
|
||||
</view>
|
||||
</scroll-view>
|
||||
<scroll-view scroll-with-animation :scroll-top="rightNum" scroll-y class="right-aside" @scroll="asideScroll" @scrolltolower="nextList('bottom')" :upper-threshold="-100" :lower-threshold="-100"
|
||||
@scrolltoupper="nextList('top')">
|
||||
<!-- 右边显示区域顶部热门精选的图片 -->
|
||||
<!-- <view v-show="showTopTip" class="bottomTip">下拉浏览上一页</view> -->
|
||||
<scroll-view scroll-with-animation scroll-y class="right-aside" :upper-threshold="-100" :lower-threshold="-100">
|
||||
<!-- 头部图片 -->
|
||||
<view class="top-img" id="main-top">
|
||||
<u-image width="500rpx" height="230rpx" @click="navigateToList(topImg.id,topImg.id)" :src="topImg.image" mode="">
|
||||
</u-image>
|
||||
</view>
|
||||
<view v-for="item in tlist" :key="item.id" class="s-list" :id="'main-' + item.id">
|
||||
<view v-for="item in categoryList" :key="item.id" class="s-list" :id="'main-' + item.id">
|
||||
<!-- 分类标题 -->
|
||||
<text class="s-item">{{ item.name }}</text>
|
||||
<!-- 分类详情 -->
|
||||
<view class="t-list">
|
||||
<view @click="navigateToList(item.id, titem.id)" v-if="titem.parentId === item.id" class="t-item" v-for="(titem, cIndex) in item.children" :key="titem.id"
|
||||
<view @click="navigateToList(item.id, children.id)" v-if="children.parentId === item.id" class="t-item" v-for="(children, cIndex) in item.children" :key="children.id"
|
||||
:class="{ 'margin-right': (cIndex + 1) % 3 == 0 }">
|
||||
<u-image width="70px" height="70px" :src="titem.image" :lazy-load="true">
|
||||
|
||||
<u-image width="70px" height="70px" :src="children.image" :lazy-load="true">
|
||||
</u-image>
|
||||
<text>{{ titem.name }}</text>
|
||||
<text>{{ children.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- #todo 暂未实现此功能 -->
|
||||
<!-- <view v-show="showBottomTip" class="bottomTip">上拉继续浏览</view> -->
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCategory, getCategoryList } from "@/api/goods.js";
|
||||
import { getCategoryList } from "@/api/goods.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
sizeCalcState: false,
|
||||
tabScrollTop: 0,
|
||||
currentId: 0,
|
||||
flist: [],
|
||||
slist: [],
|
||||
tlist: [],
|
||||
topImg: "",
|
||||
showBottomTip: false,
|
||||
showTopTip: false,
|
||||
num: 0,
|
||||
rightNum: 0,
|
||||
tabList: [], //左侧标题列表
|
||||
categoryList: [], //右侧分类数据列表
|
||||
topImg: "", //顶部图片
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.loadData();
|
||||
},
|
||||
|
||||
watch: {
|
||||
currentId(val) {
|
||||
this.flist.forEach((item, index) => {
|
||||
if (item.id == val) {
|
||||
// console.log(index)
|
||||
this.showBottomTip = false;
|
||||
this.showTopTip = false;
|
||||
this.num = index * 30;
|
||||
if (index < 7) {
|
||||
this.num = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
search() {
|
||||
uni.navigateTo({
|
||||
url: "/pages/navigation/search/searchPage",
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 加载图片
|
||||
*/
|
||||
async loadData() {
|
||||
let list = await getCategoryList(0);
|
||||
|
||||
this.flist = list.data.result;
|
||||
|
||||
this.tabList = list.data.result;
|
||||
this.currentId = list.data.result[0].id;
|
||||
this.loadListContent(0);
|
||||
// 获取右边显示区域顶部热门精选的图片
|
||||
},
|
||||
|
||||
/**
|
||||
* 加载列表内容
|
||||
*/
|
||||
loadListContent(index) {
|
||||
console.log(this.flist[index]);
|
||||
this.topImg = this.flist[index];
|
||||
this.tlist = this.flist[index].children;
|
||||
this.topImg = this.tabList[index];
|
||||
this.categoryList = this.tabList[index].children;
|
||||
},
|
||||
nextList(type) {
|
||||
//通过type 判断是上拉还是下拉,top为加载上一页,bottom为下一页
|
||||
let list = JSON.parse(JSON.stringify(this.flist));
|
||||
if (type == "top") {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].id == this.currentId && i != 0) {
|
||||
this.currentId = list[i - 1].id;
|
||||
this.loadListContent();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].id == this.currentId && i != list.length - 1) {
|
||||
this.currentId = list[i + 1].id;
|
||||
this.loadListContent();
|
||||
// this.rightNum = 250;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
//一级分类点击
|
||||
/**
|
||||
* 一级分类点击
|
||||
*/
|
||||
tabtap(item, i) {
|
||||
if (item.id != this.currentId) {
|
||||
this.currentId = item.id;
|
||||
this.loadListContent(i);
|
||||
}
|
||||
},
|
||||
//右侧栏滚动
|
||||
asideScroll(e) {
|
||||
let top = e.detail.scrollTop;
|
||||
if (top < 0 && this.currentId != this.flist[0].id) {
|
||||
this.showTopTip = true;
|
||||
}
|
||||
if (
|
||||
top > e.detail.scrollHeight - 500 &&
|
||||
this.currentId != this.flist[this.flist.length - 1].id
|
||||
) {
|
||||
this.showBottomTip = true;
|
||||
}
|
||||
},
|
||||
//计算右侧栏每个tab的高度等信息
|
||||
calcSize() {
|
||||
let h = 0;
|
||||
uni
|
||||
.createSelectorQuery()
|
||||
.select("#main-top")
|
||||
.fields(
|
||||
{
|
||||
size: true,
|
||||
},
|
||||
(data) => {
|
||||
h = data.height;
|
||||
}
|
||||
)
|
||||
.exec();
|
||||
this.slist.forEach((item) => {
|
||||
let view = uni.createSelectorQuery().select("#main-" + item.id);
|
||||
view
|
||||
.fields(
|
||||
{
|
||||
size: true,
|
||||
},
|
||||
(data) => {
|
||||
item.top = h;
|
||||
h += data.height;
|
||||
item.bottom = h;
|
||||
}
|
||||
)
|
||||
.exec();
|
||||
});
|
||||
this.sizeCalcState = true;
|
||||
},
|
||||
|
||||
navigateToList(sid, tid) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/navigation/search/searchPage?category=${tid}`,
|
||||
|
@ -177,7 +93,8 @@ export default {
|
|||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
page {
|
||||
height: 100%;
|
||||
background-color: #fdfaff;
|
||||
|
@ -195,12 +112,8 @@ uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
|
|||
display: none;
|
||||
}
|
||||
/* #endif */
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.status_bar {
|
||||
height: var(--status-bar-height);
|
||||
background-color: #f1f1f1;
|
||||
width: 100%;
|
||||
.s-list{
|
||||
box-shadow: 0 4rpx 12rpx 0 rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
.nav-search {
|
||||
padding-left: 30rpx !important;
|
||||
|
@ -225,14 +138,12 @@ uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
|
|||
font-size: 28rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.left-aside {
|
||||
flex-shrink: 0;
|
||||
width: 200rpx;
|
||||
height: 100%;
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
|
||||
.f-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
@ -240,14 +151,12 @@ uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
|
|||
width: 100%;
|
||||
height: 97rpx;
|
||||
position: relative;
|
||||
|
||||
&.active {
|
||||
font-weight: bold;
|
||||
color: $light-color;
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.right-aside {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
|
@ -259,19 +168,11 @@ uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
|
|||
height: 230rpx;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.bottomTip {
|
||||
color: #999999;
|
||||
text-align: center;
|
||||
margin: 10rpx;
|
||||
font-size: $font-sm;
|
||||
}
|
||||
|
||||
.s-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
@ -279,7 +180,6 @@ uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
|
|||
padding-top: 16rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.t-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
@ -294,12 +194,10 @@ uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
|
|||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
/* width: 33%; */
|
||||
width: 150rpx;
|
||||
margin-right: 25rpx;
|
||||
font-size: 24rpx;
|
||||
padding-bottom: 20rpx;
|
||||
|
||||
image {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
|
|
|
@ -1,667 +0,0 @@
|
|||
<template>
|
||||
<view class="new-goods">
|
||||
<view class="status_bar">
|
||||
<!-- 这里是状态栏 -->
|
||||
</view>
|
||||
<!-- 标题栏 -->
|
||||
<view class="header">
|
||||
<u-icon @click="leftBackBtn" size="40" name="arrow-left"></u-icon>
|
||||
<view class="head-bar">
|
||||
<view @click="currentIndex=0" :class="{'bar-active':currentIndex==0}">新品</view>
|
||||
<view @click="currentIndex=1" :class="{'bar-active':currentIndex==1}">预告</view>
|
||||
</view>
|
||||
<view @click="goCart" class="alifont icon-gouwuche1" style="font-weight: bold;"></view>
|
||||
</view>
|
||||
<swiper :current="currentIndex" class="swiper-box" @change="ontabchange" :interval="3000" :duration="500">
|
||||
<swiper-item>
|
||||
<scroll-view class="scroll-v" lower-threshold="200" enableBackToTop="true" scroll-with-animation scroll-y @scrolltolower="loadMore">
|
||||
<!-- 推荐商品图 -->
|
||||
<image class="recommend-img" src="/pages/floor/imgs/recommend/head-sample.png"></image>
|
||||
<!-- 排序 start-->
|
||||
<view class="index-navs">
|
||||
<ms-dropdown-item class="index-nav" :class="{ 'index-nav-active': nav == 1 }" v-model="sortType" @click.native="handledropdown(1)"
|
||||
:hasSlot="true" :title="sortType || '综合排序'" :contentTopReduse="44" ref="dropdownItem1">
|
||||
<view class="dropdown-item-content">
|
||||
<view class="dropdown-list" :class="{ 'dropdown-list-active': sortType == '综合排序' }" @click="setSortType('综合排序')">综合排序</view>
|
||||
<view class="dropdown-list" :class="{ 'dropdown-list-active': sortType == '新品排序' }" @click="setSortType('新品排序')">新品排序</view>
|
||||
</view>
|
||||
</ms-dropdown-item>
|
||||
<view class="index-nav-divider"></view>
|
||||
<view class="index-nav" :class="{ 'index-nav-active': nav == 3 }" @click="setNav(3)">
|
||||
销量
|
||||
<view class="index-nav-arrows">
|
||||
<view class="index-nav-arrow">
|
||||
<image class="img" src="/static/index/arrow-up-1.png" v-if="sale === 'asc'" mode="aspectFit"></image>
|
||||
<image class="img" src="/static/index/arrow-up.png" v-else mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="index-nav-arrow">
|
||||
<image class="img" src="/static/index/arrow-down.png" v-if="sale === 'dec'" mode="aspectFit"></image>
|
||||
<image class="img" src="/static/index/arrow-down-1.png" v-else mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="index-nav-divider"></view>
|
||||
<view class="index-nav" :class="{ 'index-nav-active': nav == 4 }" @click="setNav(4)">
|
||||
价格
|
||||
<view class="index-nav-arrows">
|
||||
<view class="index-nav-arrow">
|
||||
<image class="img" src="/static/index/arrow-up-1.png" v-if="price === 'asc'" mode="aspectFit"></image>
|
||||
<image class="img" src="/static/index/arrow-up.png" v-else mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="index-nav-arrow">
|
||||
<image class="img" src="/static/index/arrow-down.png" v-if="price === 'dec'" mode="aspectFit"></image>
|
||||
<image class="img" src="/static/index/arrow-down-1.png" v-else mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="index-nav-divider"></view>
|
||||
<ms-dropdown-item class="index-nav" :class="{ 'index-nav-active': nav == 2 }" @click.native="handledropdown(2)"
|
||||
v-model="current_tag" :hasSlot="true" :title="current_tag || '分类'" :contentTopReduse="44" ref="dropdownItem2">
|
||||
<view class="dropdown-tags">
|
||||
<view class="dropdown-tag" :class="{ 'dropdown-tag-active': current_tag == item }" @click="setTags(item)" v-for="(item, index) in tags"
|
||||
:key="index">{{ item }}</view>
|
||||
<view class="dropdown-tag cancel-btn" @click="setTags('分类')">取消</view>
|
||||
</view>
|
||||
</ms-dropdown-item>
|
||||
</view>
|
||||
<!-- 排序 end-->
|
||||
<!-- 商品列表 -->
|
||||
<view class="index-items">
|
||||
<view class="index-item" v-for="(item, index) in goods" :key="index">
|
||||
<view class="index-item-tag">新品</view>
|
||||
<view class="index-item-img" @click="toProduct(item.goods_id)">
|
||||
<image :src="item.thumbnail" mode="aspectFill"></image>
|
||||
<view class="index-item-title">{{ item.goodsName }}</view>
|
||||
<view class="index-item-price">
|
||||
<!-- ¥{{ item.price | unitPrice }}{{ item.point ? '+' + item.point + '积分' : '' }} -->
|
||||
¥{{ item.price | unitPrice }}
|
||||
<span class="tipsMkt">¥{{ item.mktprice }}</span>
|
||||
</view>
|
||||
<view class="index-item-title-desc">
|
||||
<view>已售 {{ item.buy_count }}</view>
|
||||
<view>好评率 {{ item.grade }}%</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
|
||||
<swiper-item>
|
||||
<scroll-view class="scroll-v" lower-threshold="200" enableBackToTop="true" scroll-with-animation scroll-y @scrolltolower="loadMore">
|
||||
<!-- 推荐商品图 -->
|
||||
<image class="recommend-img" src="/pages/floor/imgs/recommend/head-sample.png"></image>
|
||||
<!-- 排序 start-->
|
||||
<view class="index-navs">
|
||||
<ms-dropdown-item class="index-nav" :class="{ 'index-nav-active': nav == 1 }" v-model="sortType" @click.native="handledropdown(1)"
|
||||
:hasSlot="true" :title="sortType || '综合排序'" :contentTopReduse="44" ref="dropdownItem11">
|
||||
<view class="dropdown-item-content">
|
||||
<view class="dropdown-list" :class="{ 'dropdown-list-active': sortType == '综合排序' }" @click="setSortType('综合排序')">综合排序</view>
|
||||
<view class="dropdown-list" :class="{ 'dropdown-list-active': sortType == '新品排序' }" @click="setSortType('新品排序')">新品排序</view>
|
||||
</view>
|
||||
</ms-dropdown-item>
|
||||
<view class="index-nav-divider"></view>
|
||||
<view class="index-nav" :class="{ 'index-nav-active': nav == 3 }" @click="setNav(3)">
|
||||
销量
|
||||
<view class="index-nav-arrows">
|
||||
<view class="index-nav-arrow">
|
||||
<image class="img" src="/static/index/arrow-up-1.png" v-if="sale === 'asc'" mode="aspectFit"></image>
|
||||
<image class="img" src="/static/index/arrow-up.png" v-else mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="index-nav-arrow">
|
||||
<image class="img" src="/static/index/arrow-down.png" v-if="sale === 'dec'" mode="aspectFit"></image>
|
||||
<image class="img" src="/static/index/arrow-down-1.png" v-else mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="index-nav-divider"></view>
|
||||
<view class="index-nav" :class="{ 'index-nav-active': nav == 4 }" @click="setNav(4)">
|
||||
价格
|
||||
<view class="index-nav-arrows">
|
||||
<view class="index-nav-arrow">
|
||||
<image class="img" src="/static/index/arrow-up-1.png" v-if="price === 'asc'" mode="aspectFit"></image>
|
||||
<image class="img" src="/static/index/arrow-up.png" v-else mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="index-nav-arrow">
|
||||
<image class="img" src="/static/index/arrow-down.png" v-if="price === 'dec'" mode="aspectFit"></image>
|
||||
<image class="img" src="/static/index/arrow-down-1.png" v-else mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="index-nav-divider"></view>
|
||||
<ms-dropdown-item class="index-nav" :class="{ 'index-nav-active': nav == 2 }" @click.native="handledropdown(2)"
|
||||
v-model="current_tag" :hasSlot="true" :title="current_tag || '分类'" :contentTopReduse="44" ref="dropdownItem22">
|
||||
<view class="dropdown-tags">
|
||||
<view class="dropdown-tag" :class="{ 'dropdown-tag-active': current_tag == item }" @click="setTags(item)" v-for="(item, index) in tags"
|
||||
:key="index">{{ item }}</view>
|
||||
<view class="dropdown-tag cancel-btn" @click="setTags('分类')">取消</view>
|
||||
</view>
|
||||
</ms-dropdown-item>
|
||||
</view>
|
||||
<!-- 排序 end-->
|
||||
<!-- 商品列表 -->
|
||||
<view class="index-items">
|
||||
<view class="index-item" v-for="(item, index) in goods" :key="index">
|
||||
<view class="index-item-tag">即将上架</view>
|
||||
<view class="index-item-img" @click="toProduct(item.goods_id)">
|
||||
<image :src="item.thumbnail" mode="aspectFill"></image>
|
||||
<view class="index-item-title">{{ item.goodsName }}</view>
|
||||
<view class="index-item-price">
|
||||
<!-- ¥{{ item.price | unitPrice }}{{ item.point ? '+' + item.point + '积分' : '' }} -->
|
||||
¥{{ item.price | unitPrice }}
|
||||
<span class="tipsMkt">¥{{ item.mktprice }}</span>
|
||||
</view>
|
||||
<view class="index-item-title-desc">
|
||||
<view>已售 {{ item.buy_count }}</view>
|
||||
<view>好评率 {{ item.grade }}%</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import msDropdownItem from '@/components/ms-dropdown/dropdown-item.vue';
|
||||
import {
|
||||
getCategory,
|
||||
getTagGoods
|
||||
} from '@/api/goods.js';
|
||||
import storage from '@/utils/storage.js';
|
||||
export default {
|
||||
components: {
|
||||
msDropdownItem
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentIndex: 0,
|
||||
goods: [],
|
||||
originalGoods:[],
|
||||
nav: 1,
|
||||
sale: '',
|
||||
price: '',
|
||||
sortType: '',
|
||||
tags: [],
|
||||
current_tag: '',
|
||||
typeSort1: true,
|
||||
typeSort2: false
|
||||
};
|
||||
},
|
||||
watch:{
|
||||
currentIndex(val,oVal){
|
||||
this.nav = 1;
|
||||
this.originalGoods = []
|
||||
this.getData()
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.getData()
|
||||
this.initCategory();
|
||||
},
|
||||
methods: {
|
||||
leftBackBtn() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
toProduct(goods_id) {//跳转商品详情
|
||||
uni.navigateTo({
|
||||
url: '/pages/product/goods?id=' + goods_id
|
||||
});
|
||||
},
|
||||
goCart() { //跳转购物车
|
||||
let obj = {
|
||||
from: 'newGoods',
|
||||
id: ''
|
||||
};
|
||||
storage.setCartBackbtn(obj);
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/cart/cartList'
|
||||
});
|
||||
},
|
||||
ontabchange(e){ //swiper切换
|
||||
this.currentIndex = e.detail.current
|
||||
},
|
||||
handledropdown(val) {
|
||||
// 如果没有值的话就是全部关闭
|
||||
if (!val) {
|
||||
this.$refs.dropdownItem2.closePopup()
|
||||
this.$refs.dropdownItem1.closePopup()
|
||||
this.$refs.dropdownItem22.closePopup()
|
||||
this.$refs.dropdownItem11.closePopup()
|
||||
}
|
||||
this.sale = '';
|
||||
this.price = '';
|
||||
// 如果等于1点击综合排序
|
||||
if (val == 1) {
|
||||
this.nav = 1
|
||||
this.$refs.dropdownItem2.closePopup()
|
||||
this.$refs.dropdownItem22.closePopup()
|
||||
} else {
|
||||
this.nav = 2
|
||||
this.$refs.dropdownItem1.closePopup()
|
||||
this.$refs.dropdownItem11.closePopup()
|
||||
}
|
||||
},
|
||||
|
||||
async getData() { //获取数据
|
||||
let response = await getTagGoods(-1, this.mark, 9999);
|
||||
this.originalGoods.push(...response.data);
|
||||
this.reRank();
|
||||
},
|
||||
loadMore(){ //加载更多
|
||||
// this.getData()
|
||||
},
|
||||
|
||||
cateSort(type) { //按照所选分类过滤,返回过滤后展示列表
|
||||
let sortData = [];
|
||||
for (let i = 0; i < this.originalGoods.length; i++) {
|
||||
if (this.originalGoods[i].category_name == type) {
|
||||
sortData.push(this.originalGoods[i]);
|
||||
}
|
||||
}
|
||||
this.goods = sortData;
|
||||
},
|
||||
|
||||
// 降序
|
||||
sortDec(prop) {
|
||||
return function(obj1, obj2) {
|
||||
var val1 = obj1[prop];
|
||||
var val2 = obj2[prop];
|
||||
if (val1 < val2) {
|
||||
return 1;
|
||||
} else if (val1 > val2) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
// 升序
|
||||
sortAsc(prop) {
|
||||
return function(obj1, obj2) {
|
||||
var val1 = obj1[prop];
|
||||
var val2 = obj2[prop];
|
||||
if (val1 < val2) {
|
||||
return -1;
|
||||
} else if (val1 > val2) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
setNav(type) { //销量,价格的点击方法,升降序
|
||||
this.handledropdown();
|
||||
this.nav = type;
|
||||
if (type == 3) {
|
||||
// 销量 默认降序
|
||||
this.typeSort1 ? this.setSort('sale', 'dec') : this.setSort('sale', 'asc');
|
||||
|
||||
this.typeSort1 = !this.typeSort1;
|
||||
} else if (type == 4) {
|
||||
// 价格 默认升序
|
||||
this.typeSort2 ? this.setSort('price', 'asc') : this.setSort('price', 'dec');
|
||||
|
||||
this.typeSort2 = !this.typeSort2;
|
||||
}
|
||||
},
|
||||
setSort(key, type) {
|
||||
this.handledropdown();
|
||||
if (key === 'sale') {
|
||||
this.nav = 3;
|
||||
this.saleSort(type);
|
||||
|
||||
this.$set(this, 'price', '');
|
||||
}
|
||||
if (key === 'price') {
|
||||
this.nav = 4;
|
||||
this.priceSort(type);
|
||||
|
||||
this.$set(this, 'sale', '');
|
||||
}
|
||||
|
||||
if (this[key] === type) {
|
||||
this.$set(this, key, '');
|
||||
} else {
|
||||
this.$set(this, key, type);
|
||||
}
|
||||
},
|
||||
// 销量排序
|
||||
saleSort(type) {
|
||||
type == 'asc' ? this.originalGoods.sort(this.sortAsc('buy_count')) : this.originalGoods.sort(this.sortDec(
|
||||
'buy_count'));
|
||||
},
|
||||
|
||||
// 价格排序
|
||||
priceSort(type) {
|
||||
type == 'asc' ? this.originalGoods.sort(this.sortAsc('price')) : this.originalGoods.sort(this.sortDec('price'));
|
||||
},
|
||||
//
|
||||
setSortType(value) {
|
||||
this.nav = 1;
|
||||
this.sortType = value;
|
||||
// 新品排序
|
||||
if (value == '新品排序') {
|
||||
this.originalGoods.sort(this.sortDec('goods_id'));
|
||||
} else {
|
||||
this.getData();
|
||||
}
|
||||
this.$refs.dropdownItem1.closePopup();
|
||||
this.$refs.dropdownItem11.closePopup()
|
||||
},
|
||||
setTags(value) {
|
||||
this.current_tag = value;
|
||||
this.$refs.dropdownItem2.closePopup();
|
||||
this.$refs.dropdownItem22.closePopup()
|
||||
|
||||
if (value === '分类') {
|
||||
this.nav = 1;
|
||||
this.reRank();
|
||||
} else {
|
||||
this.nav = 2;
|
||||
this.cateSort(value);
|
||||
}
|
||||
},
|
||||
async initCategory() { //初始化分类列表项
|
||||
let res = await getCategory();
|
||||
if(res.statusCode != 200) return ;
|
||||
console.log(res)
|
||||
let tags = res.data;
|
||||
let result = [];
|
||||
for (let i = 0; i < tags.length; i++) {
|
||||
result.push(tags[i].name);
|
||||
}
|
||||
this.tags = this.unique(result);
|
||||
},
|
||||
unique(arr) { //去重
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
for (var j = i + 1; j < arr.length; j++) {
|
||||
if (arr[i] == arr[j]) {
|
||||
//第一个等同于第二个,splice方法删除第二个
|
||||
arr.splice(j, 1);
|
||||
j--;
|
||||
}
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
},
|
||||
reRank() { //重置列表数据
|
||||
this.goods = this.originalGoods;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
page{
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.status_bar {
|
||||
height: var(--status-bar-height);
|
||||
width: 100%;
|
||||
position: relative;
|
||||
background: #1abc9c;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.new-goods {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
height: 88rpx;
|
||||
width: 750rpx;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
// padding-top: var(--status-bar-height);
|
||||
position: relative;
|
||||
.u-icon,
|
||||
.alifont {
|
||||
width: 40rpx;
|
||||
margin: 20rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.head-bar {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
view {
|
||||
width: 150rpx;
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
text-align: center;
|
||||
background-color: #8DDBCB;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
view:nth-child(1) {
|
||||
border-radius: 24rpx 0 0 24rpx;
|
||||
}
|
||||
|
||||
view:nth-child(2) {
|
||||
border-radius: 0 24rpx 24rpx 0;
|
||||
}
|
||||
|
||||
.bar-active {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.swiper-box {
|
||||
height: calc(100% - 88rpx - var(--status-bar-height));
|
||||
.scroll-v {
|
||||
width: 750rpx;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.recommend-img {
|
||||
width: 100%;
|
||||
height: 280rpx;
|
||||
}
|
||||
|
||||
.index-navs {
|
||||
height: 80rpx;
|
||||
padding: 0 52rpx;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.index-nav {
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
&-active {
|
||||
color: #1abc9c;
|
||||
font-weight: 700;
|
||||
|
||||
.index-nav-desc {
|
||||
color: #1abc9c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.index-nav-desc {
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.index-nav-divider {
|
||||
height: 64rpx;
|
||||
border-left: 1px solid #dddcdf;
|
||||
}
|
||||
|
||||
.index-items {
|
||||
margin-top: 20rpx;
|
||||
padding-left: 20rpx;
|
||||
background-color: #f7f7f7;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.index-item {
|
||||
width: 346rpx;
|
||||
background-color: #fff;
|
||||
margin: 0 18rpx 20rpx 0;
|
||||
border-radius: 8rpx;
|
||||
box-sizing: border-box;
|
||||
// overflow: hidden;
|
||||
position: relative;
|
||||
&-tag{
|
||||
position: absolute;
|
||||
right: -8rpx;
|
||||
top: -7rpx;
|
||||
z-index: 1;
|
||||
width: 98rpx;
|
||||
height: 40rpx;
|
||||
color: #FFFFFF;
|
||||
text-align: center;
|
||||
font-size: 22rpx;
|
||||
line-height: 40rpx;
|
||||
background: linear-gradient(194deg,#ff9f0e 7%, #ffbb00 92%);
|
||||
border-radius: 0 0 0 20rpx;
|
||||
&::after{
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 40rpx;
|
||||
right: 0;
|
||||
z-index: 1;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-top: 8rpx solid #D95E00;
|
||||
border-right: 8rpx solid transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.index-item-img {
|
||||
image {
|
||||
width: 346rpx;
|
||||
height: 320rpx;
|
||||
border-radius: 8rpx 8rpx 0 0 ;
|
||||
}
|
||||
}
|
||||
|
||||
.index-item-title {
|
||||
font-size: 26rpx;
|
||||
color: #333333;
|
||||
padding: 20rpx 0 0 20rpx;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
|
||||
text-overflow: ellipsis;
|
||||
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.index-item-title-desc {
|
||||
font-size: 24rpx;
|
||||
color: #c0c4cc;
|
||||
margin: 10rpx 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.index-item-price {
|
||||
overflow: hidden;
|
||||
font-size: 30rpx;
|
||||
color: #ff5a10;
|
||||
padding: 20rpx 0 0 20rpx;
|
||||
}
|
||||
|
||||
.tipsMkt {
|
||||
float: right;
|
||||
color: #c0c4cc;
|
||||
text-decoration: line-through;
|
||||
margin-right: 20rpx;
|
||||
font-size:24rpx;
|
||||
line-height:40rpx;
|
||||
}
|
||||
|
||||
.index-nav-arrows {
|
||||
margin-top: 4rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.index-nav-arrow {
|
||||
image {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.index-nav-arrow:last-child {
|
||||
margin-top: -14rpx;
|
||||
}
|
||||
|
||||
.index-nav-arrow:first-child {
|
||||
margin-bottom: -14rpx;
|
||||
}
|
||||
|
||||
.dropdown-list {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
padding-left: 40rpx;
|
||||
font-size: 30rpx;
|
||||
color: #999;
|
||||
font-weight: normal;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
&-active {
|
||||
color: #1abc9c;
|
||||
}
|
||||
}
|
||||
|
||||
.dropdown-tags {
|
||||
padding:30rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.dropdown-tag {
|
||||
padding: 10rpx 20rpx;
|
||||
height: 60rpx;
|
||||
margin:0 22rpx 22rpx 0;
|
||||
border-radius: 60rpx;
|
||||
background-color: #f9f9f9;
|
||||
font-size: 30rpx;
|
||||
color: #999;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
&-active {
|
||||
background-color: #fff;
|
||||
border: 1px solid #ed4743;
|
||||
color: #ed4743;
|
||||
}
|
||||
}
|
||||
|
||||
.cancel-btn {
|
||||
background-color: #e4e1e6;
|
||||
}
|
||||
</style>
|
|
@ -18,7 +18,6 @@ export default {
|
|||
};
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.res);
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -20,7 +20,7 @@ export default {
|
|||
}
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.res);
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -14,7 +14,7 @@ export default {
|
|||
title: "三列单行图片模块",
|
||||
props: ["res"],
|
||||
mounted() {
|
||||
console.log(this.res);
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
|
@ -22,7 +22,7 @@ export default {
|
|||
title: "两张横图",
|
||||
props: ["res"],
|
||||
mounted() {
|
||||
console.log("123");
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
|
@ -55,7 +55,7 @@ export default {
|
|||
mounted() {},
|
||||
methods: {
|
||||
handleClick(item) {
|
||||
console.log(item);
|
||||
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`,
|
||||
});
|
||||
|
|
|
@ -44,7 +44,7 @@ export default {
|
|||
}
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.res);
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<template>
|
||||
<div class="wrapper">
|
||||
<!-- uni 中不能使用 vue component 所以用if判断每个组件 -->
|
||||
<!-- <u-navbar :is-back="false" title="首页"></u-navbar> -->
|
||||
<div v-for="(item,index) in pageData.list" :key="index">
|
||||
<u-navbar v-if="item.type == 'search'" :is-back="false">
|
||||
<search style="width:100%" :res="item.options" />
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
},
|
||||
onLoad(option) {
|
||||
this.goods = JSON.parse(decodeURIComponent(option.goods))
|
||||
console.log(this.goods)
|
||||
|
||||
this.getList()
|
||||
},
|
||||
onReachBottom() { //触底事件,页面整个滚动使用
|
||||
|
|
|
@ -3,7 +3,7 @@ import Vuex from "vuex";
|
|||
import storage from "@/utils/storage";
|
||||
|
||||
Vue.use(Vuex);
|
||||
//console.log("Vuex:",Vuex)
|
||||
|
||||
const store = new Vuex.Store({
|
||||
state: {
|
||||
verificationKey: "", //获取key表示验证通过
|
||||
|
@ -48,7 +48,6 @@ const store = new Vuex.Store({
|
|||
// 登录信息
|
||||
SET_USER_INFO(state, val) {
|
||||
state.userInfo = val;
|
||||
// console.log("SET_USER_INFO",val)
|
||||
},
|
||||
|
||||
login(state, userInfo) {
|
||||
|
@ -56,7 +55,6 @@ const store = new Vuex.Store({
|
|||
state.userName =
|
||||
userInfo.Name || userInfo.Nickname || userInfo.Username || "匿名用户";
|
||||
state.hasLogin = true;
|
||||
console.log("state:", state);
|
||||
},
|
||||
logout(state) {
|
||||
state.userName = "";
|
||||
|
|
|
@ -116,3 +116,39 @@ export function getPages(val) {
|
|||
|
||||
return val ? currentPage : url;
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务状态列表
|
||||
*/
|
||||
export function serviceStatusList(val) {
|
||||
let statusList = {
|
||||
APPLY: "申请售后",
|
||||
PASS: "通过售后",
|
||||
REFUSE: "拒绝售后",
|
||||
BUYER_RETURN: "买家退货,待卖家收货",
|
||||
SELLER_RE_DELIVERY: "商家换货/补发",
|
||||
SELLER_CONFIRM: "卖家确认收货",
|
||||
SELLER_TERMINATION: "卖家终止售后",
|
||||
BUYER_CONFIRM: "买家确认收货",
|
||||
BUYER_CANCEL: "买家取消售后",
|
||||
WAIT_REFUND: "等待平台退款",
|
||||
COMPLETE: "完成售后",
|
||||
};
|
||||
return statusList[val];
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单状态列表
|
||||
*/
|
||||
export function orderStatusList(val) {
|
||||
let orderStatusList = {
|
||||
UNDELIVERED: "待发货",
|
||||
UNPAID: "未付款",
|
||||
PAID: "已付款",
|
||||
DELIVERED: "已发货",
|
||||
CANCELLED: "已取消",
|
||||
COMPLETE: "已完成",
|
||||
TAKE: "已完成",
|
||||
};
|
||||
return orderStatusList[val];
|
||||
}
|
||||
|
|
|
@ -23,10 +23,9 @@ function getTokenDebounce() {
|
|||
return async function () {
|
||||
if (!lock) {
|
||||
lock = true;
|
||||
console.log('dd')
|
||||
console.log("dd");
|
||||
await refreshTokenFn(storage.getRefreshToken())
|
||||
.then((res) => {
|
||||
|
||||
if (res.data.success) {
|
||||
let { accessToken, refreshToken } = res.data.result;
|
||||
storage.setAccessToken(accessToken);
|
||||
|
@ -34,20 +33,17 @@ function getTokenDebounce() {
|
|||
success = true;
|
||||
lock = false;
|
||||
} else {
|
||||
|
||||
cleanStorage();
|
||||
success = false;
|
||||
lock = false;
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
console.log(error);
|
||||
cleanStorage();
|
||||
success = false;
|
||||
lock = false;
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
// XXX 我只能想到通过轮询来看获取新的token是否结束,有好的方案可以说。一直看lock,直到请求失败或者成功
|
||||
|
@ -56,7 +52,6 @@ function getTokenDebounce() {
|
|||
clearInterval(timer);
|
||||
|
||||
if (success) {
|
||||
|
||||
resolve("success");
|
||||
} else {
|
||||
cleanStorage();
|
||||
|
@ -74,7 +69,9 @@ function cleanStorage() {
|
|||
icon: "none",
|
||||
duration: 1500,
|
||||
});
|
||||
if(uni.showLoading()){ uni.hideLoading();}
|
||||
if (uni.showLoading()) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
|
||||
storage.setHasLogin(false);
|
||||
storage.setAccessToken("");
|
||||
|
@ -146,28 +143,21 @@ http.interceptors.response.use(
|
|||
let token = storage.getAccessToken();
|
||||
|
||||
if (token && response.statusCode === 403) {
|
||||
expireToken.includes(token) ?cleanStorage() :""
|
||||
expireToken.includes(token) ? cleanStorage() : "";
|
||||
// jwt token 过期了
|
||||
expireToken.push(token); // 把过期token 储存
|
||||
|
||||
const currentToken = storage.getAccessToken();
|
||||
|
||||
if (expireToken.includes(currentToken)) {
|
||||
|
||||
// 本地储存的是过期token了,重新获取
|
||||
const getTokenResult = await refreshToken();
|
||||
|
||||
if (getTokenResult === "success") {
|
||||
// 获取新的token成功
|
||||
|
||||
try {
|
||||
const repeatRes = await reReqest.request(
|
||||
configHandle(response.config)
|
||||
);
|
||||
response = repeatRes;
|
||||
} catch (err) {
|
||||
|
||||
}
|
||||
} catch (err) {}
|
||||
} else {
|
||||
cleanStorage();
|
||||
}
|
||||
|
@ -176,26 +166,25 @@ http.interceptors.response.use(
|
|||
const repeatRes = await reReqest.request(
|
||||
configHandle(response.config)
|
||||
);
|
||||
|
||||
response = repeatRes;
|
||||
} catch (err) {
|
||||
cleanStorage();
|
||||
}
|
||||
}
|
||||
// 如果当前返回没登录
|
||||
} else if (response.statusCode === 403 || response.data.code === 403) {
|
||||
cleanStorage();
|
||||
} else if (response.statusCode == 200 && !response.data.success) {
|
||||
// 如果当前状态码为正常但是success为不正常时
|
||||
} else if (response.statusCode == 200 && !response.data.success || response.statusCode == 400) {
|
||||
uni.showToast({
|
||||
title: response.data.message,
|
||||
icon: "none",
|
||||
duration: 1500,
|
||||
});
|
||||
|
||||
}
|
||||
return response;
|
||||
},
|
||||
(error) => {
|
||||
// 请求错误做点什么。可以使用async await 做异步操作
|
||||
return response;
|
||||
}
|
||||
);
|
||||
|
|
|
@ -152,7 +152,7 @@
|
|||
this.inputVal = v1
|
||||
// 只有value的改变是来自外部的时候,才去同步inputVal的值,否则会造成循环错误
|
||||
// if(!this.changeFromInner) {
|
||||
// console.log('change')
|
||||
|
||||
// this.inputVal = v1;
|
||||
// // 因为inputVal变化后,会触发this.handleChange(),在其中changeFromInner会再次被设置为true,
|
||||
// // 造成外面修改值,也导致被认为是内部修改的混乱,这里进行this.$nextTick延时,保证在运行周期的最后处
|
||||
|
@ -165,7 +165,7 @@
|
|||
immediate: true
|
||||
},
|
||||
inputVal(v1, v2) {
|
||||
// console.log(v1)
|
||||
|
||||
// 为了让用户能够删除所有输入值,重新输入内容,删除所有值后,内容为空字符串
|
||||
if (v1 == '') return;
|
||||
let value = 0;
|
||||
|
|
Loading…
Reference in New Issue