commit message

This commit is contained in:
Chopper
2021-05-13 11:03:32 +08:00
commit 23804939eb
2158 changed files with 149684 additions and 0 deletions

141
pages/mine/aboutUs.vue Normal file
View File

@@ -0,0 +1,141 @@
<template>
<view class="about-us">
<view class="box flex-center">
<image src="/static/logo.png" mode="scaleToFill"></image>
<view>lili商城</view>
</view>
<u-cell-group :border="false">
<!-- #ifdef APP-PLUS -->
<u-cell-item title="检查更新" @click="checkUpdate"></u-cell-item>
<!-- #endif -->
<u-cell-item title="证照信息" @click="
navigateTo('/pages/mine/help/tips?type=message')
"></u-cell-item>
<u-cell-item title="服务协议" @click="
navigateTo('/pages/mine/help/tips?type=user')
"></u-cell-item>
<u-cell-item title="隐私协议" :border-bottom="false" @click="
navigateTo('/pages/mine/help/tips?type=privacy')
"></u-cell-item>
<u-cell-item title="关于我们" :border-bottom="false" @click="
navigateTo('/pages/mine/help/tips?type=about')
"></u-cell-item>
</u-cell-group>
<view class="intro flex-center c-content">
<view>客服热线15810610731</view>
<view>客服邮箱lili@lili.com</view>
</view>
<view class="bottom flex-center">
<view @click="navigateTo('/pages/help/tips?type=user')">lili商城用户协议</view>
<view>CopyRight @ lili商城 </view>
</view>
</view>
</template>
<script>
// #ifdef APP-PLUS
import APPUpdate, { getCurrentNo, getServerNo } from "@/plugins/APPUpdate";
import { getAppVersionList } from "@/api/message.js";
// #endif
export default {
data() {
return {
showUpdate: false,
version: "",
currentNo: 0,
params: {
pageNumber: 1,
pageSize: 5,
},
};
},
onLoad(options) {
// #ifdef APP-PLUS
let _this = this;
plus.runtime.getProperty(plus.runtime.appid, function (inf) {
var wgtVer = inf.version;
_this.currentVersion = wgtVer;
});
if (uni.getSystemInfoSync().platform === "android") {
this.params.type = 0;
} else {
this.params.type = 1;
}
// #endif
},
methods: {
async checkUpdate() {
// #ifdef APP-PLUS
let needUpdate = false;
getCurrentNo((res) => {
this.currentNo = res.versionCode;
});
let res = await getAppVersionList(this.params);
res.data.data.forEach((ele) => {
let versionDetail = ele.version.replace(/\./g, "");
if (versionDetail.length < this.currentNo.length) {
versionDetail = versionDetail.padEnd(this.currentNo.length, "0");
}
if (versionDetail > this.currentNo) {
needUpdate = true;
}
});
if (needUpdate) {
APPUpdate(true);
} else {
uni.showToast({
title: "已是最新版本!",
});
}
// #endif
},
navigateTo(url) {
uni.navigateTo({
url,
});
},
},
};
</script>
<style lang="scss" scoped>
.box {
width: 100%;
height: 242rpx;
image {
transform: scale(2.5);
width: 94rpx;
height: 94rpx;
}
view {
font-size: 30rpx;
margin-top: 25rpx;
}
}
.u-cell {
padding: 35rpx 20rpx;
height: 110rpx;
}
.intro {
color: #999999;
font-size: $font-sm;
margin-top: 20rpx;
border: none;
padding: 45rpx 0;
line-height: 2em;
}
.bottom {
:nth-child(1) {
color: $main-color;
font-size: 22rpx;
margin-bottom: 20rpx;
}
:last-child {
font-size: 20rpx;
color: $font-color-light;
}
margin-top: 110rpx;
}
</style>

358
pages/mine/address/add.vue Normal file
View File

@@ -0,0 +1,358 @@
<template>
<view class="add-address">
<div class="uForm">
<u-form :border-bottom="false" :model="form" ref="uForm" :error-type="['toast']" :rule="rules">
<view class="selectAddress" @click="clickUniMap">
选择收货地址
</view>
<u-form-item class="border" label="收货人" label-width="130" prop="name">
<u-input v-model="form.name" placeholder="请输入收货人姓名" />
</u-form-item>
<u-form-item label="手机号码" label-width="130" prop="mobile">
<u-input v-model="form.mobile" type="number" maxlength="11" placeholder="请输入收货人手机号码" />
</u-form-item>
<u-form-item label="所在区域" label-width="130" prop="___path">
<u-input v-model="form.___path" type="select" @click="showPicker" placeholder="请选择所在地区" />
</u-form-item>
<u-form-item class="detailAddress" label="详细地址" label-width="130" prop="detail">
<u-input type="textarea" v-model="form.detail" maxlength="100" height="150" placeholder="街道楼牌号等" />
</u-form-item>
<u-form-item label="地址别名" label-width="130">
<u-input v-model="form.alias" placeholder="请输入地址别名" />
</u-form-item>
<u-checkbox-group shape="circle" size="30">
<u-checkbox :active-color="lightColor" v-model="form.isDefault">设为默认地址</u-checkbox>
</u-checkbox-group>
<div class="saveBtn" @click="save">保存</div>
</u-form>
<m-city :provinceData="list" headTitle="区域选择" ref="cityPicker" @funcValue="getpickerParentValue" pickerSize="4"></m-city>
<uniMap v-if="mapFlage" @close="closeMap" @callback="callBackAddress" />
</div>
</view>
</template>
<script>
import { addAddress, editAddress, getAddressDetail } from "@/api/address.js";
import gkcity from "@/components/m-city/m-city.vue";
import uniMap from "./uniMap";
import permision from "@/js_sdk/wa-permission/permission.js";
export default {
components: {
"m-city": gkcity,
uniMap,
},
onShow() {
// 判断当前系统权限定位是否开启
},
methods: {
// 关闭地图
closeMap() {
this.mapFlage = false;
},
// 打开地图并访问权限
clickUniMap() {
// #ifdef APP-PLUS
if (plus.os.name == "iOS") {
// ios系统
permision.judgeIosPermission("location")
? (this.mapFlage = true)
: this.refuseMapOuther() ;
} else {
// 安卓
this.requestAndroidPermission(
"android.permission.ACCESS_FINE_LOCATION"
);
}
// #endif
// #ifndef APP-PLUS
this.mapFlage = true;
// #endif
},
// 如果拒绝权限 提示区设置
refuseMapOuther() {
uni.showModal({
title: "温馨提示",
content: "您已拒绝定位,请开启",
confirmText: "去设置",
success(res) {
if (res.confirm) {
//打开授权设置
// #ifndef MP-WEIXIN
uni.getSystemInfo({
success(res) {
if (res.platform == "ios") {
//IOS
plus.runtime.openURL("app-settings://");
} else if (res.platform == "android") {
//安卓
let main = plus.android.runtimeMainActivity();
let Intent = plus.android.importClass(
"android.content.Intent"
);
let mIntent = new Intent("android.settings.ACTION_SETTINGS");
main.startActivity(mIntent);
}
},
});
// #endif
}
},
});
},
// 获取安卓是否拥有地址权限
async requestAndroidPermission(permisionID) {
var result = await permision.requestAndroidPermission(permisionID);
if (result == 1) {
this.mapFlage = true;
} else {
this.refuseMapOuther();
}
},
callBackAddress(val) {
uni.showLoading({
title: "加载中",
});
if (val.regeocode && val) {
let address = val.regeocode;
this.form.detail = address.formatted_address; //地址详情
this.form.___path = val.data.result.name;
this.form.consigneeAddressIdPath = val.data.result.id; // 地址id分割
this.form.consigneeAddressPath = val.data.result.name; //地址名称, ''分割
this.form.lat = val.latitude; //纬度
this.form.lon = val.longitude; //经度
uni.hideLoading();
}
this.mapFlage = !this.mapFlage;
},
save() {
this.$refs.uForm.validate((valid) => {
if (valid) {
let pages = getCurrentPages(); //获取页面栈
let beforePage = pages[pages.length - 2]; //上个页面
console.log(beforePage);
if (!this.form.id) {
delete this.form.___path;
addAddress(this.form).then((res) => {
if (res.data.success) {
if (this.routerVal.type == "order") {
uni.redirectTo({
url: `/pages/mine/address/address?way=${this.routerVal.way}`,
});
} else {
uni.redirectTo({
url: `/pages/mine/address/addressManage`,
});
}
}
});
} else {
delete this.form.___path;
delete this.form.updateBy;
delete this.form.updateTime;
editAddress(this.form).then((res) => {
if (res.data.success) {
uni.navigateTo({
url: `/${beforePage.route}`,
});
}
});
}
} else {
console.log("验证失败");
}
});
},
getpickerParentValue(e) {
this.form.consigneeAddressIdPath = [];
this.form.consigneeAddressPath = [];
let name = "";
e.forEach((item, index) => {
console.log(item);
if (item.id) {
this.form.consigneeAddressIdPath.push(item.id);
this.form.consigneeAddressPath.push(item.localName);
name += item.localName;
this.form.___path = name;
}
if (index == e.length - 1) {
//如果是最后一个
let _town = item.children.filter((_child) => {
return _child.id == item.id;
});
this.form.lat = _town[0].center.split(",")[0];
this.form.lon = _town[0].center.split(",")[1];
}
});
},
showPicker() {
this.$refs.cityPicker.show();
},
},
mounted() {},
data() {
return {
lightColor: this.$lightColor,
addSyncData: "",
mapFlage: false,
longitude: "",
markers: [],
latitude: "",
routerVal: "",
show: false,
form: {
detail: "",
name: "",
mobile: "",
consigneeAddressIdPath: [],
consigneeAddressPath: [],
___path: "",
isDefault: false,
},
rules: {
name: [
{
required: true,
message: "收货人姓名不能为空",
trigger: ["blur", "change"],
},
],
mobile: [
{
required: true,
message: "手机号码不能为空",
trigger: ["blur", "change"],
},
{
validator: (rule, value, callback) => {
return this.$u.test.mobile(value);
},
message: "手机号码不正确",
trigger: ["change", "blur"],
},
],
___path: [
{
required: true,
message: "请选择所在区域",
trigger: ["change"],
},
],
detail: [
{
required: true,
message: "请填写详细地址",
trigger: ["blur", "change"],
},
],
},
list: [
{
id: "",
localName: "请选择",
children: [],
},
],
};
},
onLoad(option) {
uni.showLoading({
title: "加载中",
});
this.routerVal = option;
if (option.id) {
getAddressDetail(option.id).then((res) => {
const params = res.data.result;
params.___path = params.consigneeAddressPath;
this.$set(this, "form", params);
uni.hideLoading();
});
}
uni.hideLoading();
},
onShow() {
},
// 必须要在onReady生命周期因为onLoad生命周期组件可能尚未创建完毕
onReady() {
this.$refs.uForm.setRules(this.rules);
},
};
</script>
<style scoped lang="scss">
.detailAddress {
/deep/ .u-form-item--left {
display: flex;
align-items: flex-start;
}
}
.saveBtn,
.selectAddress {
height: 70rpx;
line-height: 70rpx;
text-align: center;
font-size: 30rpx;
background: $aider-light-color;
color: #fff;
width: 70%;
margin: 40rpx auto 0 auto;
border-radius: 20rpx;
}
.selectAddress {
margin-top: 40rpx;
background: #fff;
color: $aider-light-color;
border: 2rpx solid $aider-light-color;
}
.uForm {
width: 94%;
overflow: hidden;
left: 3%;
position: relative;
top: 2%;
background: #fff;
border-radius: 20rpx;
padding: 0 0 40rpx 0;
}
.add-address {
width: 100%;
padding-top: 3%;
/deep/ .u-form-item {
background-color: #fff;
padding: 24rpx 30rpx;
}
.u-btn {
margin: 30rpx 30rpx 0 30rpx;
background-color: $main-color;
}
/deep/.u-checkbox {
margin: 30rpx 30rpx 0 30rpx;
.u-label-class.u-checkbox__label {
color: $font-color-light;
font-size: $font-sm;
}
}
}
/deep/ .u-checkbox__label {
font-size: 28rpx;
}
</style>

View File

@@ -0,0 +1,343 @@
<template>
<view class="address">
<view class="bar"></view>
<empty v-if="empty"></empty>
<view class="list" v-else>
<view class="item c-content" v-for="(item, index) in addressList" :key="index">
<view class="basic" @click="selectAddressData(item)">
<text>{{ item.name }}</text>
<text>{{ item.mobile }}</text>
<text class="default" v-show="item.isDefault">默认</text>
<view>
<div class="region">
<span v-if="item.consigneeAddressPath[0]">{{
item.consigneeAddressPath[0]
}}</span>
<span v-if="item.consigneeAddressPath[1]">{{
item.consigneeAddressPath[1]
}}</span>
<span v-if="item.consigneeAddressPath[2]">{{
item.consigneeAddressPath[2]
}}</span>
<span v-if="item.consigneeAddressPath[3]">{{
item.consigneeAddressPath[3]
}}</span>
<span>
{{ item.detail }}
</span>
</div>
</view>
</view>
<view class="edit">
<view class="relative" @click="setDefault(item)">
<view v-if="item.isDefault" class="alifont icon-xuanzhong"></view>
<text v-else class="unchecked"></text>
<text>{{ item.isDefault ? "默认地址" : "设为默认" }}</text>
</view>
<view class="relative">
<view class="alifont icon-bianji-copy"></view>
<text class="mr-40" @click="addAddress(item.id)">编辑</text>
<view class="alifont icon-lajitong"></view>
<text @click="delAddress(item.id)">删除</text>
</view>
</view>
</view>
<view style="height: 100px"></view>
</view>
<button type="default" class="btn" @click="addAddress('')">
<u-icon name="plus-circle"></u-icon>
添加新收货人
</button>
<u-action-sheet :list="delList" :tips="tips" v-model="showAction" @click="deleteAddressMessage"></u-action-sheet>
</view>
</template>
<script>
import * as API_Trade from "@/api/trade";
import * as API_Address from "@/api/address.js";
export default {
data() {
return {
ifOnShow: false, //组件加载为true 离开为false
activeClass: "activeClass",
addressList: [],
showAction: false,
empty: false,
delList: [
{
text: "确定",
},
],
tips: {
text: "确定要删除该收货人信息吗?",
},
delId: "",
addid: "",
routerVal: "",
params: {
pageNumber: 1,
pageSize: 50,
},
};
},
onLoad: function (val) {
this.routerVal = val;
},
onShow() {
this.addressList = [];
this.getAddressList();
},
onHide() {},
onBackPress(e) {
uni.redirectTo({
url: "/pages/order/fillorder?way=" + this.routerVal.way,
});
return true;
},
methods: {
async selectAddressData(val) {
await API_Trade.setAddressId(val.id, this.routerVal.way);
uni.redirectTo({
url: `/pages/order/fillorder?way=${this.routerVal.way}`,
});
},
//获取地址列表
getAddressList() {
uni.showLoading();
API_Address.getAddressList(
this.params.pageNumber,
this.params.pageSize
).then((res) => {
console.log("加载");
if (res.data.result.records.length == 0) {
this.empty = true;
} else {
res.data.result.records.forEach((item) => {
item.consigneeAddressPath = item.consigneeAddressPath.split(",");
});
this.$set(this, "addressList", res.data.result.records);
console.log(this.addressList);
}
uni.hideLoading();
});
},
//删除地址
delAddress(id) {
this.delId = id;
this.showAction = true;
},
deleteAddressMessage() {
API_Address.deleteAddress(this.delId).then((res) => {
if (res.statusCode == 200) {
uni.showToast({
icon: "none",
title: "删除成功",
});
this.getAddressList();
} else {
uni.showToast({
icon: "none",
title: res.data.message,
duration: 2000,
});
}
});
},
//新建。编辑地址
addAddress(id) {
console.log("点击");
if (id) {
uni.navigateTo({
url:
"/pages/mine/address/add?id=" +
id +
"&way=" +
this.routerVal.way +
"&type=order",
});
} else {
uni.navigateTo({
url:
"/pages/mine/address/add?way=" + this.routerVal.way + "&type=order",
});
}
},
//设为默认地址
setDefault(item) {
delete item.updateBy;
delete item.updateTime;
delete item.deleteFlag;
item.isDefault ? "" : (item.isDefault = !item.isDefault);
API_Address.editAddress(item).then((res) => {
uni.showToast({
title: "设置默认地址成功",
icon: "none",
});
this.getAddressList();
});
},
// 地址id
addId(params) {
API_Trade.setAddressId(params.address_id).then((res) => {});
},
},
};
</script>
<style lang="scss" scoped>
.active {
background: #f19736;
}
.alifont {
display: inline-block;
}
.region {
span {
margin: 0 4rpx !important;
}
}
.address {
.bar {
height: 20rpx;
overflow: hidden;
width: 100%;
background: url("/pages/floor/imgs/line.png") no-repeat;
background-size: 100%;
position: relative;
top: 0;
left: 0;
transform: scale(1, 0.8);
}
.default {
border: 1px solid #ff6262;
color: #ff6262;
font-size: 22rpx;
border-radius: 6rpx;
align-self: center;
padding: 2rpx 20rpx;
}
.list {
.item:hover {
background: #ededed;
}
.item {
margin-top: 20rpx;
font-size: $font-base;
color: #666;
.basic {
padding: 30rpx;
line-height: 1.5em;
border-bottom: 1px solid $border-color-light;
:nth-child(2) {
margin: 0 20rpx;
}
:nth-child(4) {
color: $font-color-light;
font-size: $font-sm;
margin-top: 10rpx;
text:nth-child(2) {
margin: 0;
}
view {
font-size: 28rpx;
}
}
}
.edit {
display: flex;
justify-content: space-between;
align-items: center;
vertical-align: middle;
height: 80rpx;
font-size: $font-sm;
color: $font-color-light;
padding: 0 30rpx;
.unchecked {
width: 28rpx;
height: 28rpx;
border-radius: 50%;
border: 1px solid #e0e0e0;
display: inline-block;
vertical-align: middle;
margin-right: 8rpx;
position: relative;
top: -2rpx;
left: 0;
}
view:nth-child(1) {
view:nth-child(1) {
font-size: $font-base;
color: $main-color;
margin-right: 8rpx;
vertical-align: middle;
}
}
view:nth-child(2) {
text {
margin-left: 5rpx;
}
.alifont {
font-size: 32rpx;
}
.icon-bianji-copy {
font-size: 28rpx;
position: relative;
top: 2rpx;
left: 0;
}
.icon-lajitong {
position: relative;
top: 4rpx;
}
}
.mr-40 {
margin-right: 40rpx;
}
}
}
}
.btn {
background: $light-color;
position: fixed;
width: 690rpx;
bottom: 60rpx;
height: 80rpx;
left: 30rpx;
font-size: 30rpx;
line-height: 80rpx;
.u-icon {
margin-right: 10rpx;
}
}
}
</style>

View File

@@ -0,0 +1,329 @@
<template>
<view class="address">
<view class="bar"></view>
<empty v-if="empty"></empty>
<view class="list" v-else>
<view class="item c-content" v-for="(item, index) in addressList" :key="index">
<view class="basic">
<text>{{ item.name }}</text>
<text>{{ item.mobile }}</text>
<text class="default" v-show="item.isDefault">默认</text>
<view>
<div class="region">
<span v-if="item.consigneeAddressPath[0]">{{
item.consigneeAddressPath[0]
}}</span>
<span v-if="item.consigneeAddressPath[1]">{{
item.consigneeAddressPath[1]
}}</span>
<span v-if="item.consigneeAddressPath[2]">{{
item.consigneeAddressPath[2]
}}</span>
<span v-if="item.consigneeAddressPath[3]">{{
item.consigneeAddressPath[3]
}}</span>
<span>
{{ item.detail }}
</span>
</div>
</view>
</view>
<view class="edit">
<view class="relative" @click="setDefault(item)">
<view v-if="item.isDefault" class="alifont icon-xuanzhong"></view>
<text v-else class="unchecked"></text>
<text>{{ item.isDefault ? "默认地址" : "设为默认" }}</text>
</view>
<view class="relative">
<view class="alifont icon-bianji-copy"></view>
<text class="mr-40" @click="addAddress(item.id)">编辑</text>
<view class="alifont icon-lajitong"></view>
<text @click="delAddress(item.id)">删除</text>
</view>
</view>
</view>
<view style="height: 100px"></view>
</view>
<button type="default" class="btn" @click="addAddress('')">
<u-icon name="plus-circle"></u-icon>
添加新收货人
</button>
<u-action-sheet :list="delList" :tips="tips" v-model="showAction" @click="deleteAddressMessage"></u-action-sheet>
</view>
</template>
<script>
import * as API_Trade from "@/api/trade";
import * as API_Address from "@/api/address.js";
import storage from "@/utils/storage.js";
export default {
data() {
return {
activeClass: "activeClass",
addressList: [],
showAction: false,
empty: false,
delList: [
{
text: "确定",
},
],
tips: {
text: "确定要删除该收货人信息吗?",
},
delId: "",
addid: "",
routerVal: "",
params: {
pageNumber: 1,
pageSize: 1000,
},
};
},
// 返回上一级
onBackPress(e) {
uni.switchTab({
url: "/pages/tabbar/user/my",
});
return true;
},
onLoad: function (val) {
this.routerVal = val;
},
onShow() {
let userInfo = storage.getUserInfo();
if (userInfo && userInfo.id) {
this.getAddressList();
}
},
onPullDownRefresh() {
this.getAddressList();
uni.stopPullDownRefresh();
},
methods: {
//获取地址列表
getAddressList() {
uni.showLoading();
API_Address.getAddressList(
this.params.pageNumber,
this.params.pageSize
).then((res) => {
if (res.data.result.records.length == 0) {
this.empty = true;
} else {
res.data.result.records.forEach((item) => {
item.consigneeAddressPath = item.consigneeAddressPath.split(",");
});
this.addressList = res.data.result.records;
}
uni.hideLoading();
});
},
//删除地址
delAddress(id) {
this.delId = id;
this.showAction = true;
},
deleteAddressMessage() {
API_Address.deleteAddress(this.delId).then((res) => {
if (res.statusCode == 200) {
uni.showToast({
icon: "none",
title: "删除成功",
});
this.getAddressList();
} else {
uni.showToast({
icon: "none",
title: res.data.message,
duration: 2000,
});
}
});
},
//新建。编辑地址
addAddress(id) {
if (id) {
uni.navigateTo({
url: "/pages/mine/address/add?id=" + id,
});
} else {
uni.navigateTo({
url: "/pages/mine/address/add",
});
}
},
//设为默认地址
setDefault(item) {
delete item.updateBy;
delete item.updateTime;
delete item.deleteFlag;
item.isDefault ? "" : (item.isDefault = !item.isDefault);
API_Address.editAddress(item).then((res) => {
uni.showToast({
title: "设置默认地址成功",
icon: "none",
});
this.getAddressList();
});
},
// 地址id
addId(params) {
API_Trade.setAddressId(params.address_id).then((res) => {});
},
},
};
</script>
<style lang="scss" scoped>
.active {
background: #f19736;
}
.alifont {
display: inline-block;
}
.region {
span {
margin: 0 4rpx !important;
}
}
.address {
.bar {
height: 20rpx;
overflow: hidden;
width: 100%;
background: url("/pages/floor/imgs/line.png") no-repeat;
background-size: 100%;
position: relative;
top: 0;
left: 0;
transform: scale(1, 0.8);
}
.default {
border: 1px solid #ff6262;
color: #ff6262;
font-size: 22rpx;
border-radius: 6rpx;
align-self: center;
padding: 2rpx 20rpx;
}
.list {
.item {
margin-top: 20rpx;
font-size: $font-base;
color: #666;
.basic {
padding: 30rpx;
line-height: 1.5em;
border-bottom: 1px solid $border-color-light;
:nth-child(2) {
margin: 0 20rpx;
}
:nth-child(4) {
color: $font-color-light;
font-size: $font-sm;
margin-top: 10rpx;
text:nth-child(2) {
margin: 0;
}
view {
font-size: 28rpx;
}
}
}
.edit {
display: flex;
justify-content: space-between;
align-items: center;
vertical-align: middle;
height: 80rpx;
font-size: $font-sm;
color: $font-color-light;
padding: 0 30rpx;
.unchecked {
width: 28rpx;
height: 28rpx;
border-radius: 50%;
border: 1px solid #e0e0e0;
display: inline-block;
vertical-align: middle;
margin-right: 8rpx;
position: relative;
top: -2rpx;
left: 0;
}
view:nth-child(1) {
view:nth-child(1) {
font-size: $font-base;
color: $main-color;
margin-right: 8rpx;
vertical-align: middle;
}
}
view:nth-child(2) {
text {
margin-left: 5rpx;
}
.alifont {
font-size: 32rpx;
}
.icon-bianji-copy {
font-size: 28rpx;
position: relative;
top: 2rpx;
left: 0;
}
.icon-lajitong {
position: relative;
top: 4rpx;
}
}
.mr-40 {
margin-right: 40rpx;
}
}
}
}
.btn {
background: $light-color;
position: fixed;
width: 690rpx;
bottom: 60rpx;
height: 80rpx;
left: 30rpx;
font-size: 30rpx;
line-height: 80rpx;
.u-icon {
margin-right: 10rpx;
}
}
}
</style>

View File

@@ -0,0 +1,66 @@
<template>
<!-- 自定义地图组件 -->
<map
class="map"
:latitude="latitude"
:longitude="longitude"
scale="18"
:markers="markers"
:show-location="true"
@markertap="markertap"
@updated="mapUpdated"
@tap="closeMapMarker"
></map>
</template>
<script>
import amap from "@/js_sdk/amap-wx.130.js";
export default {
data() {
return {};
},
mounted() {
this.initMap();
},
methods: {
markertap() {},
mapUpdated() {},
closeMapMarker() {},
// 初始化地图
initMap() {
this.amapPlugin = new amap.AMapWX({
key: "c03fe63e4ed7cfc6612304b3f46c19b5", //该key 是在高德中申请的微信小程序key
});
this.amapPlugin.getRegeo({
type: "gcj02", //map 组件使用的经纬度是国测局坐标, type 为 gcj02
success: function (res) {
const latitude = res[0].latitude;
const longitude = res[0].longitude;
that.longitude = longitude;
that.latitude = latitude;
that.mapInfo = res[0];
},
fail: (res) => {
console.log(JSON.stringify(res));
},
});
},
},
};
</script>
<style lang="scss" scoped>
.map {
width: 100%;
height: 100%;
}
</style>

View File

@@ -0,0 +1,106 @@
<template></template>
<script>
import { getAddressCode } from "@/api/address";
export default {
data() {
return {};
},
mounted() {
this.init();
},
methods: {
// 初始化地图并且调用
initMap() {
let that = this;
uni.chooseLocation({
success: function (res) {
/**获取地址详情地址 */
that.posToCity(res.latitude, res.longitude).then((val) => {
/**获取地址code */
getAddressCode(
val.regeocode.addressComponent.citycode,
val.regeocode.addressComponent.township
).then((code) => {
that.$emit("callback", { ...val, ...res, ...code });
that.$emit("close");
});
});
},
fail() {
that.$emit("close");
},
});
},
// 根据当前客户端判断
init() {
// #ifdef MP-WEIXIN
this.wechatMap();
// #endif
// #ifndef MP-WEIXIN
this.initMap();
// #endif
},
// 如果是微信小程序单独走微信小程序授权模式
wechatMap() {
let that = this;
uni.authorize({
scope: "scope.userLocation",
success() {
// 允许授权
that.initMap();
},
fail() {
//拒绝授权
uni.showModal({
content: "检测到您没打开获取地址功能权限,是否去设置打开?",
confirmText: "确认",
cancelText: "取消",
success: (res) => {
if (res.confirm) {
uni.openSetting({
success: (res) => {
that.initMap();
},
});
} else {
that.$emit("close");
return false;
}
},
});
return false;
},
});
},
posToCity(latitude, longitude) {
return new Promise((resolve, reject) => {
uni.request({
url: `https://restapi.amap.com/v3/geocode/regeo`,
method: "GET",
data: {
key: "d649892b3937a5ad20b76dacb2bcb5bd", //web服务的key
location: `${longitude},${latitude}`,
},
success: ({ data }) => {
const { status, info, regeocode } = data;
if (status === "1") {
resolve(data);
} else {
reject(info);
}
},
fail: (err) => {
reject(err);
},
});
});
},
},
};
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,236 @@
<template>
<view class="wap">
<view class="wrapper-show-money">
<view class="money-view">
<h3>预存款金额 </h3>
<view class="money">{{walletNum | unitPrice }}</view>
</view>
</view>
<view class="wrapper-tabs">
<swiper class="swiper-box" @change="changeSwiper" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
<swiper-item class="swiper-item" v-for="index in list.length" :key="index">
<scroll-view class="scroll-v view-wrapper" enableBackToTop="true" scroll-with-animation scroll-y @scrolltolower="loadMore">
<view v-if="datas.length!=0" class="view-item" v-for="(logItem, logIndex) in datas" :key="logIndex">
<view class="view-item-detail">
<view class="-title">{{logItem.detail}}</view>
<!-- <view class="-number">{{logItem.detail}}</view> -->
</view>
<view class="view-item-change">
<view class="-money green" v-if="logItem.serviceType == 'WALLET_PAY' || logItem.serviceType == 'WALLET_WITHDRAWAL'"> {{logItem.money | unitPrice}} </view>
<view class="-money" v-if="logItem.serviceType == 'WALLET_REFUND' || logItem.serviceType == 'WALLET_RECHARGE' || logItem.serviceType == 'WALLET_COMMISSION' ">
+{{logItem.money | unitPrice}} </view>
<view class="-time">{{logItem.createTime}}</view>
</view>
</view>
<u-empty v-if="datas.length==0" mode="history" text="暂无记录" />
<u-loadmore v-else bg-color='#f8f8f8' :status="status" />
</scroll-view>
</swiper-item>
</swiper>
</view>
</view>
</template>
<script>
import { getUserRecharge, getWalletLog } from "@/api/members";
import storage from "@/utils/storage.js";
import { getUserWallet } from "@/api/members";
export default {
data() {
return {
walletNum:0,
status: "loadmore",
current: 0,
swiperCurrent: 0,
userInfo: "", //用户详情信息
params: {
pageNumber: 1,
pageSize: 10,
order: "desc",
},
datas: [], //遍历的数据集合
rechargeList: "", //充值明细列表
walletLogList: "", //钱包变动列表
list: [
// {
// name: "充值明细",
// },
{
name: "预存款变动明细",
},
],
};
},
watch: {
swiperCurrent(index) {
this.swiperCurrent = index;
},
},
async mounted() {
this.getWallet();
let result = await getUserWallet(); //预存款
console.log(result)
this.walletNum = result.data.result.memberWallet;
},
methods: {
/**分页获取预存款充值记录 */
getRecharge() {
this.status = "loading";
getUserRecharge(this.params).then((res) => {
if (res.data.success) {
if (res.data.result.records.length != 0) {
this.status = "loadmore";
this.datas.push(...res.data.result.records);
} else {
this.status = "nomore";
}
}
});
},
getWallet() {
this.status = "loading";
getWalletLog(this.params).then((res) => {
if (res.data.success) {
if (res.data.result.records.length != 0) {
this.datas.push(...res.data.result.records);
} else {
this.status = "nomore";
}
}
});
},
// 点击swiper的时候清空数据
changeSwiper() {
this.groupBuy = [];
},
changed(index) {
this.datas = [];
this.swiperCurrent = index;
this.params.pageNumber = 1;
if (index == 0) {
// this.getRecharge();
this.getWallet();
} else {
this.getWallet();
}
},
// swiper-item左右移动通知tabs的滑块跟随移动
transition({ detail: { dx } }) {
this.$refs.tabs.setDx(dx);
},
// 由于swiper的内部机制问题快速切换swiper不会触发dx的连续变化需要在结束时重置状态
// swiper滑动结束分别设置tabs和swiper的状态
animationfinish(e) {
// this.groupBuy = []
let current = e.detail.current;
this.$refs.tabs.setFinishCurrent(current);
this.swiperCurrent = current;
this.current = current;
},
loadMore() {
this.params.pageNumber++;
this.getWallet();
},
},
};
</script>
<style lang="scss" scoped>
.green {
color: $aider-color-green !important;
}
.view-item {
padding: 32rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.view-item-change {
text-align: right;
> .-money {
font-size: 36rpx;
color: $main-color;
font-weight: bold;
}
> .-time {
font-size: 22rpx;
color: #999;
}
}
.view-item-detail {
line-height: 1.75;
> .-title {
font-size: 28rpx;
}
> .-number {
font-size: 22rpx;
color: #999;
}
}
.submit-btn {
line-height: 90rpx;
text-align: center;
color: #fff;
background: $main-color;
margin: 0 auto;
height: 90rpx;
}
.wap {
}
.money {
font-size: 40rpx;
font-weight: bold;
}
.money-view {
height: 100%;
width: 100%;
padding: 0 32rpx;
display: flex;
align-items: flex-end;
justify-content: center;
flex-direction: column;
color: #fff;
background-image: linear-gradient(
25deg,
$main-color,
$light-color,
$aider-light-color
);
}
.swiper-item,
.scroll-v {
height: 100%;
}
.swiper-box {
/* #ifndef H5 */
height: calc(100vh - 200rpx);
/* #endif */
/* #ifdef H5 */
height: calc(100vh - 288rpx);
/* #endif */
}
.wap {
width: 100%;
height: calc(100vh - 44px);
}
.wrapper-show-money {
height: 200rpx;
// background-image: url('/static/img/main-bg.jpg');
}
</style>

View File

@@ -0,0 +1,22 @@
<template>
<view class="wrapper">
<u-cell-group>
<u-cell-item title="申请单号"></u-cell-item>
<u-cell-item title="提现金额" value="新版本"></u-cell-item>
<u-cell-item title="收款银行"></u-cell-item>
<u-cell-item title="收款账号" value="新版本"></u-cell-item>
<u-cell-item title="开户人姓名"></u-cell-item>
<u-cell-item title="创建时间" value="新版本"></u-cell-item>
<u-cell-item title="提现状态" value="新版本"></u-cell-item>
</u-cell-group>
</view>
</template>
<script>
export default {};
</script>
<style lang="scss" scoped>
.wrapper {
}
</style>

View File

@@ -0,0 +1,11 @@
<template>
</template>
<script>
export default {
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,136 @@
<template>
<view class="wrapper">
<view>
<h4>实名认证请上传真实的个人信息认证通过后将无法修改</h4>
<view>
<u-form :model="ruleForm" label-width="200rpx" ref="uForm">
<u-form-item label="姓名" prop="name">
<u-input v-model="ruleForm.name" placeholder="请输入您的真实姓名" />
</u-form-item>
<u-form-item label="身份证" prop="idNumber">
<u-input
v-model="ruleForm.idNumber"
placeholder="请输入身份证号码"
/>
</u-form-item>
<!-- <u-form-item label="身份证正面照" prop="name">
<u-upload></u-upload>
</u-form-item>
<u-form-item label="身份证反面照" prop="name">
<u-upload></u-upload>
</u-form-item>
<u-form-item label="手持身份证照" prop="name">
<u-upload></u-upload>
</u-form-item> -->
</u-form>
<u-button :customStyle="{'background':$lightColor,'color':'#fff' }" @click="submit">提交</u-button>
</view>
</view>
<view class="tips">
<view>您提交的信息正在审核</view>
<view>提交认证申请后工作人员将在三个工作日进行核对完成审核</view>
</view>
</view>
</template>
<script>
import { applyDistribution } from "@/api/goods";
export default {
data() {
return {
ruleForm: {
name: "",
idNumber: "",
},
rules: {
name: [
{
required: true,
message: "请输入姓名",
// 可以单个或者同时写两个触发验证方式
trigger: "blur",
},
{
// 自定义验证函数,见上说明
validator: (rule, value, callback) => {
// 上面有说返回true表示校验通过返回false表示不通过
// this.$u.test.mobile()就是返回true或者false的
return this.$u.test.chinese(value);
},
message: "姓名输入不正确",
// 触发器可以同时用blur和change
trigger: ["change", "blur"],
},
],
idNumber: [
{
required: true,
message: "请输入身份证",
// 可以单个或者同时写两个触发验证方式
trigger: "blur",
},
{
// 自定义验证函数,见上说明
validator: (rule, value, callback) => {
// 上面有说返回true表示校验通过返回false表示不通过
// this.$u.test.mobile()就是返回true或者false的
return this.$u.test.idCard(value);
},
message: "身份证号码不正确",
// 触发器可以同时用blur和change
trigger: ["change", "blur"],
},
],
},
};
},
methods: {
submit() {
this.$refs.uForm.validate((valid) => {
if (valid) {
applyDistribution(this.ruleForm).then((res) => {
if (res.data.success) {
uni.showToast({
title: "认证提交成功!",
duration: 2000,
icon: "none",
});
setTimeout(()=>{
uni.navigateBack();
},500)
}
else{
uni.showToast({
title: res.data.message,
duration: 2000,
icon:"none"
});
}
});
} else {
uni.showToast({
title: "请填写有效信息",
duration: 2000,
icon: "none",
});
}
});
},
},
onReady() {
this.$refs.uForm.setRules(this.rules);
},
};
</script>
<style lang="scss" scoped>
.wrapper {
padding: 32rpx;
}
.tips {
margin-top: 20rpx;
font-size: 24rpx;
color: #999;
}
</style>

View File

@@ -0,0 +1,123 @@
<template>
<view class="log-list">
<view class="log-way" v-for="(item, index) in datas" :key="index">
<view class="log-item">
<view class="log-item-view">
<view class="title">{{
item.distributionCashStatus == "APPLY"
? "待处理"
: item.distributionCashStatus == "PASS"
? "通过"
: "拒绝"
}}</view>
<view class="price">+{{ item.price | unitPrice }}</view>
</view>
<view class="log-item-view">
<view>{{ item.createTime }}</view>
<view></view>
</view>
</view>
</view>
<view class="empty" v-if="empty">
<u-loadmore :status="status" :icon-type="iconType" bg-color="#f7f7f7" />
<!-- <u-empty text="暂无更多提现历史" mode="order"></u-empty> -->
</view>
</view>
</template>
<script>
import { cashLog, distributionOrderList } from "@/api/goods";
export default {
data() {
return {
datas: "", //数据集合
status: "loadmore",
iconType: "flower",
empty: false,
params: {
pageNumber: 1,
pageSize: 10,
},
type: 0,
routers: "",
achParams: {
distributionId: (this.routers && this.routers.id) || "", //分销商id
distributionName: (this.routers && this.routers.name) || "", //分销商名称
distributionOrderStatus: "", //分销商订单状态
pageNumber: 1,
pageSize: 10,
},
};
},
onLoad(option) {
let title;
option.type == 0 ? (title = "分销业绩") : (title = "提现记录");
uni.setNavigationBarTitle({
title: title, //这是修改后的导航栏文字
});
this.routers = option;
console.log(this.routers);
option.type == 0 ? this.achievement() : this.history();
},
mounted() {},
onReachBottom() {
this.status = "loading";
this.params.pageNumber++;
this.type == 1 ? this.history() : this.achievement();
},
methods: {
// 业绩
achievement() {
distributionOrderList(this.achParams).then((res) => {});
},
// 初始化提现历史
history() {
uni.showLoading({
title: "加载中",
});
cashLog(this.params).then((res) => {
if (res.data.success && res.data.result.records.length >= 1) {
this.datas = res.data.result.records;
} else {
this.status = "nomore";
this.empty = true;
}
uni.hideLoading();
});
},
},
};
</script>
<style lang="scss" scoped>
.empty {
margin: 40rpx 0;
}
.price {
color: $main-color;
font-weight: bold;
}
.log-list {
padding: 0 8rpx;
overflow: hidden;
margin: 20rpx 0;
}
.log-way {
margin: 10rpx 0;
overflow: hidden;
background: #fff;
border-radius: 10rpx;
padding: 20rpx 0;
}
.title {
font-size: 30rpx;
font-weight: bold;
}
.log-item-view {
padding: 8rpx 32rpx;
display: flex;
justify-content: space-between;
}
</style>

View File

@@ -0,0 +1,140 @@
<template>
<view>
<view class="nav-list">
<view class="total">可提现金额</view>
<view class="price">{{ distributionData.canRebate | unitPrice }}</view>
<view class="frozen"
>冻结金额{{ distributionData.commissionFrozen | unitPrice }}</view
>
</view>
<view class="nav">
<view class="nav-item">
<u-icon
size="50"
@click="handleClick('/pages/mine/distribution/list?id='+distributionData.id+'&name='+distributionData.memberName)"
color="#ff6b35"
name="bag-fill"
></u-icon>
<view>分销商品</view>
</view>
<view
class="nav-item"
@click="handleClick(`/pages/mine/distribution/history?type=0&id=${distributionData.id}&name=${distributionData.memberName}`)"
>
<u-icon size="50" color="#ff6b35" name="order"></u-icon>
<view>分销业绩</view>
</view>
<view
class="nav-item"
@click="handleClick('/pages/mine/distribution/history?type=1')"
>
<u-icon size="50" color="#ff6b35" name="red-packet-fill"></u-icon>
<view>提现记录</view>
</view>
<view
class="nav-item"
@click="handleClick('/pages/mine/distribution/withdrawal')"
>
<u-icon size="50" color="#ffc71c" name="rmb-circle-fill"></u-icon>
<view>提现</view>
</view>
<view class="nav-item" @click="handleClick('/pages/mine/distribution/list')">
<u-icon size="50" color="#1e9ff2" name="home-fill"></u-icon>
<view>选品库</view>
</view>
</view>
</view>
</template>
<script>
import { distribution } from "@/api/goods";
export default {
data() {
return {
distributionData: "",
};
},
methods: {
handleClick(url) {
uni.navigateTo({
url,
});
},
queryGoods(src) {
uni.navigateTo({
url: `/pages/mine/distribution/${src}`,
});
},
/**
* 初始化推广商品
*/
init() {
uni.showLoading({
title: "加载中",
});
distribution().then((res) => {
if (res.data.result) {
this.distributionData = res.data.result;
}
uni.hideLoading();
});
},
},
mounted() {
this.init();
},
};
</script>
<style lang="scss" scoped>
.nav {
// height: 176rpx;
background: #fff;
align-items: center;
display: flex;
// border-radius: 20rpx;
// transform: translateY(-20rpx);
// box-shadow: 4rpx 10rpx 22rpx rgba(0, 0, 0, 0.1);
flex-wrap: wrap;
}
.nav-list {
color: #fff;
padding: 40rpx 0;
background: $aider-light-color;
// border-bottom-left-radius: 100rpx;
// border-bottom-right-radius: 100rpx;
}
.total {
padding: 10rpx 0;
text-align: center;
font-size: 28rpx;
opacity: 0.8;
}
.frozen {
text-align: center;
font-size: 24rpx;
opacity: 0.8;
}
.price {
text-align: center;
color: #fff;
font-size: 50rpx;
}
.nav-item {
height: 240rpx;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
> * {
margin: 10rpx 0;
}
width: 33%;
// color: #fff;
}
</style>

View File

@@ -0,0 +1,103 @@
<template>
<view class="wrapper">
<u-tabs
:list="list"
:is-scroll="false"
:current="current"
@change="change"
:active-color="$lightColor"
></u-tabs>
<!-- 推广人资料 -->
<view class="message">
<u-form :model="ruleForm" label-width="250rpx" ref="uForm">
<u-form-item label="会员昵称" prop="name">
<u-input v-model="ruleForm.name" />
</u-form-item>
<u-form-item label="账户类型" prop="name"> </u-form-item>
<u-form-item
label="收款人姓名"
placeholder="请输入收款人姓名"
prop="name"
>
<u-input v-model="ruleForm.name" />
</u-form-item>
<u-form-item
label="收款账号"
placeholder="请输入收款人账号"
prop="name"
>
<u-input v-model="ruleForm.name" />
</u-form-item>
<u-form-item
label="银行名称"
placeholder="请输入开户银行支行名称"
prop="name"
>
<u-input v-model="ruleForm.name" />
</u-form-item>
</u-form>
<u-button :customStyle="{'background':$lightColor,'color':'#fff' }" @click="submit">提交</u-button>
</view>
</view>
</template>
<script>
export default {
components: {},
// 必须要在onReady生命周期因为onLoad生命周期组件可能尚未创建完毕
onReady() {
this.$refs.uForm.setRules(this.rules);
},
data() {
return {
current:0,
list: [
{
name: "推广人资料",
},
{
name: "平台审核",
},
{
name: "完成",
},
],
ruleForm: {
name: "",
radio: "",
},
rules: {
name: [
{
required: true,
message: "请输入姓名",
// 可以单个或者同时写两个触发验证方式
trigger: "blur",
},
],
},
};
},
};
</script>
<style lang="scss" scoped>
.menu {
height: 88rpx;
line-height: 88rpx;
background: $main-color;
display: flex;
> .menu-item {
flex: 1;
text-align: center;
color: $light-color;
}
}
.active {
color: #fff !important;
}
.message {
padding: 0 32rpx;
}
</style>

View File

@@ -0,0 +1,412 @@
<template>
<view class="wrapper">
<!-- 筛选弹出层 -->
<u-popup width="90%" v-model="popup" mode="right">
<view class="screen-title">商品筛选</view>
<view class="screen-view">
<view class="screen-item">
<h4>价格区间</h4>
<view class="flex">
<u-input class="u-bg" placeholder-style="font-size:22rpx;" type="number" input-align="center" placeholder="最低价"></u-input>
<view class="line"></view>
<u-input class="u-bg" placeholder-style="font-size:22rpx;" type="number" input-align="center" placeholder="最高价"></u-input>
</view>
</view>
<view class="screen-item">
<h4>销量</h4>
<view class="flex">
<u-input class="u-bg w200 flex1" placeholder-style="font-size:22rpx;" type="number" input-align="center" placeholder="销量"></u-input>
<view class="flex1">笔以上</view>
</view>
</view>
<view class="screen-item">
<h4>收入比率</h4>
<view class="flex">
<u-input class="u-bg" placeholder-style="font-size:22rpx;" type="number" input-align="center" placeholder="最低%"></u-input>
<view class="line"></view>
<u-input class="u-bg" placeholder-style="font-size:22rpx;" type="number" input-align="center" placeholder="最高%"></u-input>
</view>
</view>
<view class="screen-item">
<h4>包邮</h4>
<view class="flex">
<u-tag class="u-tag" shape="circle" text="包邮" mode="plain" type="info" />
</view>
</view>
<view class="screen-item">
<h4>促销活动</h4>
<view class="flex">
<u-tag class="u-tag" shape="circle" text="限时抢购" mode="plain" type="info" />
<u-tag class="u-tag" shape="circle" text="拼团秒杀" mode="plain" type="info" />
</view>
</view>
<view class="screen-item">
<h4>经营类型</h4>
<view class="flex">
<u-tag class="u-tag" shape="circle" text="平台自营" mode="plain" type="info" />
<u-tag class="u-tag" shape="circle" text="三方店铺" mode="plain" type="info" />
</view>
</view>
</view>
<view class="screen-btn">
<view class="screen-clear"> 重置 </view>
<view class="screen-submit"> 确定 </view>
</view>
</u-popup>
<!-- 导航栏 -->
<view class="nav">
<view class="nav-item" @click="handleMyGoods(true)" :class="{ checked: params.checked }">已选择</view>
<view class="nav-item" @click="handleMyGoods(false)" :class="{ checked: !params.checked }">未选择</view>
<!-- <view class="nav-item" @click="popup = !popup">筛选</view> -->
</view>
<!-- 商品列表 -->
<view class="goods-list">
<view class="goods-item" v-for="(item, index) in goodsList" :key="index">
<view class="goods-item-img" @click="handleNavgationGoods(item)">
<u-image width="176rpx" height="176rpx" :src="item.thumbnail"></u-image>
</view>
<view class="goods-item-desc">
<!-- 商品描述 -->
<view class="-item-title" @click="handleNavgationGoods(item)">
{{ item.goodsName }}
</view>
<!-- 商品金额 -->
<view class="-item-price" @click="handleNavgationGoods(item)">
佣金:
<span> {{ item.commission | unitPrice }}</span>
</view>
<!-- 比率佣金 -->
<view class="-item-bottom">
<view class="-item-bootom-money" @click="handleNavgationGoods(item)">
<!-- <view class="-item-bl">
比率:
<span>{{ "5.00%" }}</span>
</view> -->
<view class="-item-yj">
<span>{{ item.price | unitPrice }}</span>
</view>
</view>
<view>
<view class="click" v-if="!params.checked" @click="handleClickGoods(item)">立即选取</view>
<view class="click" v-if="params.checked" @click="handleLink(item)">分销商品</view>
</view>
</view>
</view>
</view>
<view class="empty">
<!-- <u-empty v-if="empty" text="没有分销商品了" mode="list"></u-empty> -->
</view>
</view>
<canvas class="canvas-hide" canvas-id="qrcode" />
<drawCanvas ref="drawCanvas" v-if="showFlag" :res="res" />
</view>
</template>
<script>
import {
distributionGoods,
checkedDistributionGoods,
getMpCode,
} from "@/api/goods";
import drawCanvas from "@/components/m-canvas";
export default {
data() {
return {
showFlag: false, //分销分享开关
empty: false,
popup: false, //弹出层开关
active_color: this.$mainColor,
current: 0,
params: {
pageNumber: 1,
pageSize: 10,
checked: true,
},
goodsList: [],
// 分销分享 实例
res: {
container: {
width: 600,
height: 960,
background: "#fff",
title: "分享背景",
},
// 分销分享
bottom: {
img: "",
code: "",
price: 0,
},
},
routers: "",
};
},
components: {
drawCanvas,
},
onLoad(options) {
this.routers = options;
},
watch: {
showFlag(val) {
console.log(val);
},
},
onShow() {
this.goodsList = [];
this.init();
},
methods: {
handleNavgationGoods(val) {
uni.navigateTo({
url: `/pages/product/goods?id=${val.skuId}&goodsId=${val.id}`,
});
},
async handleLink(goods) {
let page = `pages/product/goods`;
let scene = `${goods.skuId},${goods.id},${this.routers.id}`;
let result = await getMpCode({ page, scene });
if(result.data.success){
let callback = result.data.result;
this.res.container.title = `${goods.goodsName}`;
this.res.bottom.code = `data:image/png;base64,${callback}`;
this.res.bottom.price = this.$options.filters.unitPrice(goods.price, "¥");
this.res.bottom.desc = `${goods.goodsName}`;
this.res.bottom.img = `${goods.thumbnail}`;
if (this.showFlag) {
this.$refs.drawCanvas.init();
}
this.showFlag = true;
}
else{
uni.showToast({
title: `制作二维码失败!请稍后重试`,
duration: 2000,
icon:"none"
});
}
},
change(index) {
this.current = index;
},
// 点击我的选品库
handleMyGoods(flag) {
this.goodsList = [];
this.params.checked = flag;
this.init();
},
// 选择商品
handleClickGoods(val) {
uni.showLoading({
title: "加载中",
mask: true,
});
checkedDistributionGoods(val.id).then((res) => {
uni.hideLoading();
if (res.data.success) {
uni.showToast({
title: "已添加到我的选品库",
duration: 2000,
icon: "none",
});
setTimeout(() => {
this.goodsList = [];
this.init();
}, 500);
}
});
},
init() {
uni.showLoading({
title: "加载中",
});
distributionGoods(this.params).then((res) => {
uni.hideLoading();
if (res.data.success && res.data.result.records.length >= 1) {
this.goodsList.push(...res.data.result.records);
}
if (this.goodsList.length == 0) {
this.empty = true;
}
});
},
},
};
</script>
<style lang="scss" scoped>
.canvas-hide {
/* 1 */
position: fixed;
right: 100vw;
bottom: 100vh;
/* 2 */
z-index: -9999;
/* 3 */
opacity: 0;
}
.empty {
margin: 40rpx 0;
}
.checked {
color: $main-color;
font-weight: bold;
}
.screen-btn {
display: flex;
width: 100%;
height: 88rpx;
line-height: 88rpx;
position: fixed;
bottom: 0;
> .screen-clear,
.screen-submit {
width: 50%;
text-align: center;
}
.screen-submit {
background: $main-color;
color: #fff;
}
}
.screen-item {
margin-bottom: 40rpx;
}
.flex1 {
padding-left: 10rpx;
}
.u-tag {
margin-right: 20rpx;
}
.line {
width: 40rpx;
height: 2rpx;
background: #999;
margin: 0 10rpx;
}
.u-bg {
background: #eff1f4;
border-radius: 0.4em;
font-size: 22rpx;
}
.screen-title {
height: 88rpx;
text-align: center;
font-size: 28upz;
line-height: 88rpx;
border-bottom: 1px solid #ededed;
}
.flex {
display: flex;
margin: 20rpx 0;
align-items: center;
}
.screen-view {
padding: 32rpx;
}
.bar {
padding: 0 20rpx;
display: flex;
justify-content: space-between;
align-items: center;
height: 88rpx;
width: 100%;
background: #fff;
z-index: 8;
> .bar-btn {
display: flex;
}
}
.nav {
background: #fff;
width: 100%;
display: flex;
height: 88rpx;
box-sizing: border-box;
border-top: 1px solid #ededed;
border-bottom: 1px solid #ededed;
> .nav-item {
line-height: 88rpx;
height: 88rpx;
flex: 1;
text-align: center;
}
}
.click {
background: $main-color;
color: #fff;
margin: 0 4rpx;
font-size: 22rpx;
padding: 10rpx 20rpx;
border-radius: 100px;
}
.goods-list {
// #ifdef H5
height: calc(100vh - 176rpx);
// #endif
// #ifndef H5
height: calc(100vh - 88rpx);
// #endif
overflow: auto;
}
.goods-item {
border-radius: 20rpx;
background: #fff;
display: flex;
padding: 22rpx;
margin: 20rpx;
justify-content: space-between;
> .goods-item-desc {
flex: 2;
padding: 0 16rpx;
line-height: 1.7;
> .-item-bottom {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 20rpx;
> .-item-bootom-money {
> .-item-bl,
.-item-yj {
margin-right: 10rpx;
font-size: 24rpx;
color: $font-color-base;
}
}
}
> .-item-title {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
}
> .-item-price {
color: $jd-color;
> span {
font-size: 36rpx;
}
}
}
}
.wrapper {
width: 100%;
}
</style>

View File

@@ -0,0 +1,129 @@
<template>
<view>
<view class="withdrawal-list">
<view class="title">提现金额</view>
<view class="content">
<view class="price">
<span> </span>
<u-input v-model="price" placeholder="" type="number" />
</view>
<view class="all">
<view @click="handleAll" :style="{ color: $mainColor }">全部</view>
<view style="font-size: 24rpx; color: #999"
>可提现金额<span>{{ distributionData.canRebate | unitPrice }}</span
></view
>
</view>
</view>
</view>
<view class="submit" @click="cashd">提现</view>
</view>
</template>
<script>
import { distribution, cash } from "@/api/goods";
export default {
data() {
return {
price: 0,
distributionData: "",
};
},
mounted() {
this.init();
},
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) => {
if(res.data.success){
uni.showToast({
title: '提现成功!',
duration: 2000,
icon:"none"
});
setTimeout(()=>{
uni.navigateBack({
delta: 1
});
},1000)
}
});
} else {
uni.showToast({
title: "请输入正确金额",
duration: 2000,
icon: "none",
});
}
},
handleAll() {
this.price = this.distributionData.canRebate;
},
/**
* 初始化推广商品
*/
init() {
uni.showLoading({
title: "加载中",
});
distribution().then((res) => {
if (res.data.result) {
this.distributionData = res.data.result;
}
uni.hideLoading();
});
},
},
};
</script>
<style lang="scss" scoped>
/deep/ .u-input__input,
.u-input {
font-size: 80rpx !important;
height: 102rpx !important;
}
/deep/ .u-input__input{
height: 100%;
font-size: 80rpx;
}
.content {
display: flex;
> .price {
width: 60%;
margin: 20rpx 0;
font-size: 80rpx;
display: flex;
}
> .all {
justify-content: center;
width: 40%;
display: flex;
flex-direction: column;
align-items: flex-end;
}
}
.withdrawal-list {
margin: 20rpx 0;
background: #fff;
padding: 16rpx 32rpx;
}
.title {
font-size: 35rpx;
}
.submit {
margin: 80rpx auto;
width: 94%;
background: $light-color;
height: 90rpx;
color: #fff;
border-radius: 10rpx;
text-align: center;
line-height: 90rpx;
}
</style>

56
pages/mine/help/tips.vue Normal file
View File

@@ -0,0 +1,56 @@
<template>
<div class="wrapper">
<div v-html="res.content"></div>
</div>
</template>
<script>
import { getArticleDetail } from "@/api/article";
export default {
data() {
return {
res: "",
way: {
user: {
title: "用户协议",
type: "USER_AGREEMENT",
},
privacy: {
title: "隐私政策",
type: "PRIVACY_POLICY",
},
message: {
title: "证照信息",
type: "LICENSE_INFORMATION",
},
about: {
title: "关于我们",
type: "ABOUT",
},
},
};
},
mounted() {},
onLoad(option) {
uni.setNavigationBarTitle({
title: this.way[option.type].title,
});
this.init(option);
},
methods: {
init(option) {
getArticleDetail(this.way[option.type].type).then((res) => {
if (res.data.success) {
this.res = res.data.result;
}
});
},
},
};
</script>
<style lang="scss" scoped>
.wrapper {
padding: 16rpx;
}
</style>

183
pages/mine/msgTips/main.vue Normal file
View File

@@ -0,0 +1,183 @@
<template>
<view class="container">
<view class="list-cell b-b m-t" hover-class="cell-hover" :hover-stay-time="50">
<u-row gutter="12" justify="start" @click="navigateTo('/pages/msgTips/sysMsg/index')">
<u-col span="2" class="uCol" style="text-align:center;">
<image class="img" src="/static/mine/setting.png"></image>
</u-col>
<u-col span="7">
<p class="tit_title">系统消息</p>
<p class="tit_tips">查看系统消息</p>
</u-col>
<u-col span="3">
<view class="cell-more">
<u-tag size="mini" v-if="no_read.system_num>0" shape="circle" mode="dark" type="error" :text="no_read.system_num"></u-tag>
<span class="yticon icon-you"></span>
</view>
</u-col>
</u-row>
</view>
<!-- <view class="list-cell b-b m-t" hover-class="cell-hover" :hover-stay-time="50">
<u-row gutter="12" justify="start" @click="navigateTo('/pages/msgTips/packagemsg/index')">
<u-col span="2" class="uCol" style="text-align:center;">
<image class="img" src="/static/mine/logistics.png"></image>
</u-col>
<u-col span="7">
<p class="tit_title">物流消息</p>
<p class="tit_tips">查看物流消息</p>
</u-col>
<u-col span="3">
<view class="cell-more">
<u-tag v-if="no_read.logistics_num>0" shape="circle" mode="dark" type="warning" :text="no_read.logistics_num"></u-tag>
<span class="yticon icon-you"></span>
</view>
</u-col>
</u-row>
</view> -->
</view>
</template>
<script>
import {
mapMutations
} from "vuex";
import * as API_Message from "@/api/members.js";
export default {
data() {
return {
no_read: ''
};
},
onLoad() {
this.GET_NoReadMessageNum();
},
methods: {
...mapMutations(["logout"]),
navigateTo(url) {
uni.navigateTo({
url
});
},
/** 获取未读消息数量信息 */
GET_NoReadMessageNum() {
API_Message.getNoReadMessageNum().then(response => {
this.no_read = response.data
})
}
}
};
</script>
<style scoped lang='scss'>
.uCol {
display: flex;
justify-content: center !important;
}
.img {
width: 60rpx;
height: 60rpx;
}
.container {
background: #f9f9f9;
}
/deep/ .u-col-2 {
height: 60px;
line-height: 60px;
text-align: center !important;
}
.qicon {
text-align: center;
display: block;
font-size: 20px;
}
.redBox {
display: inline-block;
text-align: center;
line-height: 1.5em;
font-size: 12px;
min-width: 1.5em;
min-height: 1.5em;
background: #ed6533;
border-radius: 50%;
color: #fff;
}
.tit_title {
color: $u-main-color;
}
.tit_tips {
color: $u-tips-color;
}
.u-col-3 {
text-align: right !important;
padding-right: 20rpx !important;
}
.list-cell {
background: #fff;
align-items: baseline;
padding: 20rpx 0;
line-height: 60rpx;
background: #fff;
justify-content: center;
&.log-out-btn {
margin-top: 40rpx;
.cell-tit {
color: $uni-color-primary;
text-align: center;
margin-right: 0;
}
}
&.cell-hover {
background: #fafafa;
}
&.b-b:after {
left: 30rpx;
}
&.m-t {
margin-top: 16rpx;
}
.cell-more {
/* margin-top: 10rpx; */
height: 60rpx;
text-align: right;
/* display: flex;
justify-content: center; //这个是X轴居中
align-items: center; //这个是 Y轴居中 */
font-size: $font-lg;
color: $font-color-light;
/* width: 100rpx; */
}
.cell-tit {
flex: 1;
font-size: $font-base + 2rpx;
color: $font-color-dark;
margin-right: 10rpx;
}
.cell-tip {
font-size: $font-base;
color: $font-color-light;
}
}
</style>

View File

@@ -0,0 +1,128 @@
<template>
<view class="container " style="font-size: 13px;">
<block v-for="(row, index) in messageList" :key="index">
<view class="msgItem">
<div class="msgMsg">
<div class="bagbar">{{$u.timeFormat(row.send_time, 'yyyy-mm-dd')}}</div>
</div>
<u-card @click="goDetail(row.sn,row.logi_id,row.ship_no)" :title="title" title-color="#666666" title-size="24" sub-title-color="#666666" sub-title-size="24" :border="false" :sub-title=row.status>
<view class="msg-body" slot="body">
<image class="msgImg" :src="row.goods_img" mode=""></image>
<view class="msgView">
<view>{{row.goodsName}}</view>
<view class="msgNum">订单号:{{row.sn}}</view>
</view>
</view>
</u-card>
</view>
</block>
<uni-load-more :status="loadStatus"></uni-load-more>
</view>
</template>
<script>
import * as API_Message from "@/api/message.js";
export default {
data() {
return {
messageList: [],
title: "物流更新通知",
subTitle: "运输中",
loadStatus:'more',
params: {
pageNumber: 1,
pageSize: 10,
},
loadStatus:'more'
};
},
onLoad(){
this.GET_LogisticsList(true);
},
onReachBottom() {
this.params.pageNumber++
this.GET_LogisticsList(false)
},
methods: {
goDetail(sn,logi_id,ship_no){
uni.navigateTo({
url:'/pages/msgTips/packagemsg/logisticsDetail?order_sn=' + sn +'&logi_id='+logi_id+'&ship_no='+ship_no,
})
},
//获取物流消息
GET_LogisticsList(reset){
if (reset) {
this.params.pageNumber = 1
}
uni.showLoading({
title:"加载中"
})
API_Message.getLogisticsMessages(this.params).then(async response => {
uni.hideLoading()
const { data } = response
if (!data || !data.length) {
this.messageList.push(...data.data)
}
})
}
}
};
</script>
<style scoped lang='scss'>
.ddnumber {
color: $u-tips-color;
font-size: 24rpx;
}
.msg-body{
display: flex;
background-color: rgba(102, 110, 232, 0.0470588235294118);
.msgImg{
width: 160rpx;
height: 160rpx;
}
.msgView{
margin-left: 20rpx;
.msgNum:last-child{
margin-top: 60rpx;
}
}
}
.bagbar {
display: inline;
border-radius: 500px;
color: #fff;
font-size: 24rpx;
padding: 10rpx 20rpx;
background: $u-type-info-disabled;
}
.storeImg {
width: 100%;
height: 100rpx;
margin-right: 20rpx;
}
.container {
background: #F9F9F9;
min-height: 100vh;
}
.msgMsg {
text-align: center;
color: $u-tips-color;
}
.msgItem {
padding: 1em 0;
}
view{
font-size: 13px;
color: #666666;
}
u-card{
font-size: 13px;
color: #666666;
}
</style>

View File

@@ -0,0 +1,100 @@
<template>
<view class="logistics-detail">
<view class="card">
<view class="card-title">
<span>{{ logiList.shipper }}</span>快递 <span>{{ logiList.logisticCode }}</span>
</view>
<view class="time-line">
<u-time-line v-if="logiList.traces && logiList.traces.length != 0">
<u-time-line-item nodeTop="2" v-for="(item, index) in logiList.traces" :key="index">
<!-- 此处自定义了左边内容用一个图标替代 -->
<template v-slot:node >
<view v-if="index == logiList.traces.length - 1" class="u-node" :style="{ background: $lightColor }" style="padding: 0 4px">
<!-- 此处为uView的icon组件 -->
<u-icon name="pushpin-fill" color="#fff" :size="24"></u-icon>
</view>
</template>
<template v-slot:content>
<view>
<!-- <view class="u-order-title">待取件</view> -->
<view class="u-order-desc">{{ item.AcceptStation }}</view>
<view class="u-order-time">{{ item.AcceptTime }}</view>
</view>
</template>
</u-time-line-item>
</u-time-line>
<u-empty class="empty" v-else text="目前没有物流订单" mode="list"></u-empty>
</view>
</view>
</view>
</template>
<script>
import uniSteps from "@/components/uni-steps/uni-steps.vue";
import { getExpress } from "@/api/trade.js";
export default {
components: { uniSteps },
data() {
return {
express: "",
resData: {
title: "物流详情",
},
logiList: "",
activeStep: 0,
};
},
methods: {
init(sn) {
getExpress(sn).then((res) => {
this.logiList = res.data.result;
});
},
},
onLoad(option) {
let sn = option.order_sn;
this.init(sn);
},
};
</script>
<style lang="scss">
.card-title {
background: #f2f2f2;
}
.logistics-detail {
margin-top: 20rpx;
padding: 0 16rpx;
}
.card {
background: #fff;
border-radius: 20rpx;
width: 100%;
> .card-title {
font-size: 24rpx;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
padding: 16rpx;
}
> .time-line {
padding: 16rpx 32rpx;
}
}
.u-order-title {
font-weight: bold;
}
.u-order-desc {
font-size: 26rpx;
color: #666;
margin: 10rpx 0;
}
.u-order-time {
font-size: 24rpx;
color: #999;
}
.empty {
padding: 40rpx 0;
}
</style>

View File

@@ -0,0 +1,140 @@
<template>
<view class="container">
<view class="list-cell b-b m-t" hover-class="cell-hover" :hover-stay-time="50">
<u-row gutter="12" justify="start">
<u-col span="2">
<img
class="list_img"
src="https://web-assets.fancynode.com.cn/web_v1/images/pxcook/features/icon-cloud.png"
alt
/>
</u-col>
<u-col span="7">
<p class="tit_title">
<img
src="https://web-assets.fancynode.com.cn/web_v1/images/pxcook/features/icon-cloud.png"
alt
/>
在线客服
</p>
<p class="tit_tips">查看回复客服的消息</p>
</u-col>
<u-col span="3">
<text class="cell-more">
<p class="msgTime">2020-12-12</p>
<span class="redBox">55</span>
</text>
</u-col>
</u-row>
</view>
</view>
</template>
<script>
import { mapMutations } from "vuex";
export default {
data() {
return {};
},
methods: {
...mapMutations(["logout"]),
}
};
</script>
<style scoped lang='scss'>
.msgTime {
font-size: 13px;
}
page {
background: $page-color-base;
}
.list_img {
width: 100%;
height: 100%;
vertical-align: middle;
border-radius: 0.4em;
}
.qicon {
text-align: center;
display: block;
font-size: 20px;
}
.redBox {
padding: 10rpx 12rpx;
display: inline-block;
text-align: center;
font-size: 12px;
line-height: 1em;
width: 1em;
height: 1em;
background: #ed6533;
border-radius: 50%;
color: #fff;
}
.tit_title,
.tit_tips {
margin-left: 8rpx;
}
.tit_title {
color: $u-main-color;
> img {
vertical-align: middle;
margin-right: 10rpx;
width: 40rpx;
height: 40rpx;
}
}
.tit_tips {
color: $u-tips-color;
}
.list-cell {
align-items: baseline;
padding: 20rpx 30rpx;
line-height: 60rpx;
position: relative;
background: #fff;
justify-content: center;
&.log-out-btn {
margin-top: 40rpx;
.cell-tit {
color: $uni-color-primary;
text-align: center;
margin-right: 0;
}
}
&.cell-hover {
background: #fafafa;
}
&.b-b:after {
left: 30rpx;
}
&.m-t {
margin-top: 16rpx;
}
.cell-more {
text-align: right;
margin-top: 10rpx;
height: 60rpx;
display: flex;
justify-content: center; //这个是X轴居中
align-items: center; //这个是 Y轴居中
align-self: baseline;
font-size: $font-lg;
color: $font-color-light;
margin-left: 10rpx;
}
.cell-tit {
flex: 1;
font-size: $font-base + 2rpx;
color: $font-color-dark;
margin-right: 10rpx;
}
.cell-tip {
font-size: $font-base;
color: $font-color-light;
}
}
</style>

View File

@@ -0,0 +1,102 @@
<template>
<view class="container">
<block v-for="(row, index) in messageList" :key="index">
<view class="msgItem">
<div class="is_read">
<!-- {{row.is_read}} -->
<span v-if="row.is_read"></span>
<span v-else class="red">·</span>
</div>
<div class="msgMsg">{{$u.timeFormat(row.send_time, 'yyyy-mm-dd')}}</div>
<u-card :title="title" :title-size="35" :border="false">
<view class slot="body">
<view class="u-body-item u-flex u-row-between u-p-b-0">
<view class="u-body-item-title u-line-2">{{row.content}}</view>
</view>
</view>
</u-card>
</view>
</block>
<uni-load-more :status="loadStatus"></uni-load-more>
</view>
</template>
<script>
import { mapMutations } from "vuex";
import * as API_Message from "@/api/message.js";
export default {
data() {
return {
title: "系统消息",
subTitle: "未读",
finished: false,
loadStatus: "more",
params: {
pageNumber: 0,
pageSize: 5
},
messageList: []
};
},
onLoad() {
this.GET_MessageList(true);
},
onReachBottom() {
this.params.pageNumber++;
this.GET_MessageList(false);
},
methods: {
...mapMutations(["logout"]),
/** 获取站内消息 */
GET_MessageList(reset) {
if (reset) {
this.params.pageNumber = 1;
this.messageList = [];
}
uni.showLoading({
title: "加载中"
});
API_Message.getMessages(this.params).then(async response => {
uni.hideLoading();
const { data } = response;
if (!data || !data.length) {
this.messageList.push(...data.data);
this.handleReadPageMessages();
}
});
},
/** 设置消息已读 **/
handleReadPageMessages() {
const ids = this.messageList.map(item => item.id).join(",");
API_Message.messageMarkAsRead(ids).then(async () => {});
}
}
};
</script>
<style scoped lang='scss'>
.is_read{
position: absolute;
right: 25px;
top: 80rpx;
z-index: 999;
}
.container {
background: #f9f9f9;
min-height: 100vh;
}
.red{
color: coral;
font-size: 100rpx;
}
.msgMsg {
text-align: center;
color: $u-tips-color;
}
.msgItem {
padding: 1em 0;
position: relative;
}
</style>

460
pages/mine/myCollect.vue Normal file
View File

@@ -0,0 +1,460 @@
<template>
<view class="content">
<view class="navbar">
<view v-for="(item, index) in navList" :key="index" class="nav-item" @click="tabClick(index)">
<text :class="{current: tabCurrentIndex === index}">{{item.text}}</text>
</view>
</view>
<view class="swiper-box" duration="300" @change="changeTab">
<view v-if="tabCurrentIndex == 0" class="tab-content">
<scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadMore">
<!-- 空白页 -->
<empty v-if="goodsEmpty"></empty>
<!-- 数据 -->
<u-swipe-action @open="openChange(item,index,'goods')" :show="item.selected" btn-width="180" :options="options" v-else v-for="(item,index) in goodList"
@click="clickGoodsSwiperAction(item,index)" :index="index" :key="index">
<view class="goods" @click="goGoodsDetail(item)">
<u-image width="131rpx" height="131rpx" :src="item.image" mode="aspectFit">
<u-loading slot="loading"></u-loading>
</u-image>
<view class="goods-intro">
<view>{{item.goodsName}}</view>
<view class="goods-sn">{{item.goods_sn}}</view>
<view>{{item.price | unitPrice}}</view>
</view>
<!-- <button @click.stop="goSimilar(item)">找相似</button> -->
</view>
</u-swipe-action>
<uni-load-more :status="goodLoad"></uni-load-more>
</scroll-view>
</view>
<view v-else class="tab-content">
<scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadMore">
<!-- 空白页 -->
<empty v-if="storeEmpty"></empty>
<!-- 数据 -->
<u-swipe-action @open="openChange(item,index,'store')" :show="item.selected" btn-width="180" :options="options" v-else v-for="(item,index) in storeList" :key="index"
@click="clickstoreSwiperAction(item)">
<view class="store" @click="gostoreMainPage(item.storeId)">
<view class="intro">
<view class="store-logo">
<u-image width="102rpx" height="102rpx" :src="item.logo" :alt="item.storeName" mode="aspectFit">
<u-loading slot="loading"></u-loading>
</u-image>
</view>
<view class="store-name">
<view>{{item.storeName}}</view>
<u-tag size="mini" type="error" :color="$mainColor" v-if="item.selfOperated" text="自营" mode="plain" shape="circle" />
</view>
<view class="store-collect">
<view>进店逛逛</view>
</view>
</view>
</view>
</u-swipe-action>
<uni-load-more :status="storeLoad"></uni-load-more>
</scroll-view>
</view>
</view>
</view>
</template>
<script>
import {
getGoodsCollection,
deleteGoodsCollection,
deleteStoreCollection,
} from "@/api/members.js";
export default {
data() {
return {
options: [
{
text: "取消",
style: {
backgroundColor: this.$lightColor,
},
},
],
tabCurrentIndex: 0,
navList: [
{
text: "商品(0)",
loadingType: "more",
params: {
pageNumber: 1,
pageSize: 10,
},
},
{
text: "店铺(0)",
loadingType: "more",
params: {
pageNumber: 1,
pageSize: 10,
},
},
],
goodLoad: "more",
storeLoad: "more",
goodsEmpty: false,
storeEmpty: false,
goodList: [],
storeList: [],
};
},
onLoad() {
// this.loadData();
this.getGoodList();
this.getstoreList();
},
methods: {
openChange(val, index, type) {
const { goodList, storeList } = this;
let way;
type == "goods" ? (way = goodList) : (way = storeList);
way.forEach((item, ids) => {
this.$set(item, "selected", false);
});
this.$set(val, "selected", false);
val.selected = true;
console.log(val.selected);
},
/* openstore(val, index) {
this.storeList.forEach((item, ids) => {
this.$set(item, "selected", false);
});
this.$set(val, "selected", false);
val.selected = true;
}, */
/** 点击取消按钮 */
clickGoodsSwiperAction(val, index) {
deleteGoodsCollection(val.skuId).then((res) => {
console.log(res);
if (res.statusCode == 200) {
this.storeList = [];
this.goodList = []
this.getGoodList();
}
});
},
clickstoreSwiperAction(val) {
deleteStoreCollection(val.storeId).then((res) => {
if (res.statusCode == 200) {
this.storeList = [];
this.getstoreList();
}
});
},
//顶部tab点击
tabClick(index) {
this.tabCurrentIndex = index;
console.log(this.tabCurrentIndex);
},
changeTab(e) {
this.tabCurrentIndex = e.target.current;
},
goSimilar(goods) {
//找相似
uni.navigateTo({
url:
"/pages/user/similarGoods?goods=" +
encodeURIComponent(JSON.stringify(goods)),
});
},
goGoodsDetail(val) {
//商品详情
uni.navigateTo({
url: "/pages/product/goods?id=" + val.skuId +"&goodsId="+val.goodsId,
});
},
gostoreMainPage(id) {
//店铺主页
uni.navigateTo({
url: "/pages/product/shopPage?id=" + id,
});
},
getGoodList() {
uni.showLoading({
title: "加载中",
});
getGoodsCollection(this.navList[0].params, "GOODS").then((res) => {
uni.hideLoading();
uni.stopPullDownRefresh();
if (res.statusCode == 200) {
if (res.statusCode == 200) {
let data = res.data.result;
data.selected = false;
this.navList[0].text = `商品(${data.total})`;
if (data.total == 0) {
this.goodsEmpty = true;
} else if (data.total < 10) {
this.goodLoad = "noMore";
this.goodList.push(...data.records);
} else {
this.goodList.push(...data.records);
if (data.total.length < 10) this.goodLoad = "noMore";
}
}
}
});
},
getstoreList() {
uni.showLoading({
title: "加载中",
});
getGoodsCollection(this.navList[1].params, "store").then((res) => {
uni.hideLoading();
uni.stopPullDownRefresh();
if (res.statusCode == 200) {
if (res.statusCode == 200) {
let data = res.data.result;
data.selected = false;
this.navList[1].text = `店铺(${data.total})`;
if (data.total == 0) {
this.storeEmpty = true;
} else if (data.total < 10) {
this.storeLoad = "noMore";
this.storeList.push(...data.records);
} else {
this.storeList.push(...data.records);
if (data.total.length < 10) this.storeLoad = "noMore";
}
}
}
});
},
loadMore() {
if (this.tabCurrentIndex == 0) {
this.navList[0].params.pageNumber++;
this.getGoodList();
} else {
this.navList[1].params.pageNumber++;
this.getstoreList();
}
},
},
onPullDownRefresh() {
if (this.tabCurrentIndex == 0) {
this.navList[0].params.pageNumber = 1;
this.goodList = [];
this.getGoodList();
} else {
this.navList[1].params.pageNumber = 1;
this.storeList = [];
this.getstoreList();
}
},
};
</script>
<style lang="scss">
page,
.content {
background: $page-color-base;
height: 100%;
}
.content {
width: 100%;
overflow: hidden;
}
.swiper-box {
overflow-y: auto;
}
.goods-price {
text-align: left;
}
.list-scroll-content {
height: 100%;
width: 100%;
}
.goods-name {
color: #333 !important;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 22rpx;
}
/deep/ .u-swipe-content{
overflow: hidden;
}
.goods {
background-color: #fff;
border-bottom: 1px solid $border-color-light;
height: 190rpx;
display: flex;
align-items: center;
padding: 30rpx 20rpx;
margin-top: 20rpx;
image {
width: 131rpx;
height: 131rpx;
border-radius: 10rpx;
}
.goods-intro {
flex: 1;
font-size: $font-base;
line-height: 48rpx;
margin-left: 30rpx;
view:nth-child(1) {
line-height: 1.4em;
font-size: 24rpx;
max-height: 2.8em; //height是line-height的整数倍防止文字显示不全
overflow: hidden;
color: #666;
}
view:nth-child(2) {
color: #cccccc;
font-size: 24rpx;
}
view:nth-child(3) {
color: $light-color;
}
}
button {
color: $main-color;
height: 50rpx;
width: 120rpx;
font-size: $font-sm;
padding: 0;
line-height: 50rpx;
background-color: #ffffff;
margin-top: 80rpx;
&::after {
border-color: $main-color;
}
}
}
.store {
background-color: #fff;
border: 1px solid $border-color-light;
border-radius: 16rpx;
margin: 20rpx 10rpx;
.intro {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 30rpx 0 40rpx;
height: 170rpx;
.store-logo {
width: 102rpx;
height: 102rpx;
border-radius: 50%;
overflow: hidden;
image {
width: 100%;
height: 100%;
border-radius: 50%;
}
}
.store-name {
flex: 1;
margin-left: 30rpx;
line-height: 2em;
:first-child {
font-size: $font-base;
}
:last-child {
font-size: $font-sm;
color: #999;
}
}
.store-collect {
border-left: 1px solid $border-color-light;
padding-left: 20rpx;
text-align: center;
:last-child {
color: #999;
font-size: $font-sm;
}
}
}
.store-goods {
// height: 300rpx;
// width: 750rpx;
white-space: nowrap;
position: relative;
padding: 30rpx 20rpx;
&::before {
content: "";
width: calc(100% - 40rpx);
position: absolute;
top: 0;
left: 20rpx;
z-index: 2;
border-top: 2rpx solid #eeeeee;
}
.store-item {
display: inline-block;
margin-left: 10rpx;
width: 250rpx;
overflow: hidden;
image {
width: 228rpx;
height: 180rpx;
}
> .goods-price {
color: $main-color;
text:first-child {
font-size: $font-sm;
}
text:last-child {
font-size: $font-base;
font-weight: bold;
}
}
}
}
}
.navbar {
display: flex;
height: 40px;
padding: 0 5px;
background: #fff;
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
position: relative;
z-index: 10;
.nav-item {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
font-size: 26rpx;
text {
position: relative;
}
text.current {
color: $light-color;
font-weight: bold;
font-size: 28rpx;
&::after {
content: "";
position: absolute;
left: 20rpx;
bottom: -10rpx;
width: 30rpx;
height: 0;
border-bottom: 2px solid $light-color;
}
}
}
}
</style>

343
pages/mine/myTracks.vue Normal file
View File

@@ -0,0 +1,343 @@
<template>
<view class="myTracks" v-if="refresh">
<empty v-if="nomsg"></empty>
<view v-else v-for="(item, index) in list" :key="index">
<view class="myTracks-title" @click="gostore(item)">{{item.storeName}}</view>
<view class="myTracks-items">
<view class="myTracks-item">
<u-checkbox-group>
<u-checkbox v-model="item.___isDel" v-if="editFlag" active-color="#ff6b35" style="margin-right: 10rpx" @change="changeChecked(item)"></u-checkbox>
</u-checkbox-group>
<view class="myTracks-item-img" @click.stop="goDetail(item)">
<image :src="item.thumbnail"></image>
</view>
<view class="myTracks-item-content" @click.stop="goDetail(item)">
<view class="myTracks-item-title">
{{ item.goodsName }}
<view class="myTracks-item-title-desc"> </view>
</view>
<view class="myTracks-item-price">
{{ item.price | unitPrice }}
</view>
<!-- <view class="myTracks-item-btn" @click.stop="goSimilar(item)">
找相似
</view> -->
</view>
</view>
</view>
<view class="myTracks-divider"></view>
</view>
<uni-load-more :status="loadStatus"></uni-load-more>
<view v-if="editFlag">
<view class="myTracks-action-placeholder"></view>
<view class="myTracks-action">
<view class="myTracks-action-check">
<u-checkbox-group>
<u-checkbox v-model="allChecked" v-if="editFlag" active-color="#ff6b35" style="margin-right: 10rpx" @change="checkedAllitem"></u-checkbox>
全选
</u-checkbox-group>
</view>
<view>
<u-button type="warning" plain="true" @click="delAllTracks" class="myTracks-action-btn">
删除
</u-button>
</view>
</view>
</view>
</view>
</template>
<script>
import { myTrackList, deleteHistoryListId } from "@/api/members.js";
export default {
data() {
return {
editFlag: false,
allChecked: false,
loadStatus: "more",
nomsg: false,
params: {
pageNumber: 1,
pageSize: 10,
},
refresh: true,
list: [],
};
},
onPullDownRefresh() {
this.params.pageNumber = 1;
this.list = [];
this.getList();
},
onReachBottom() {
if (this.loadStatus != "noMore") {
this.params.pageNumber++;
this.getList();
}
},
onLoad() {
this.getList();
},
methods: {
gostore(val) {
uni.navigateTo({
url: "/pages/product/shopPage?id=" + val.storeId,
});
},
setStyle(text) {
//导航按钮文本设置
let pages = getCurrentPages();
let page = pages[pages.length - 1];
// #ifdef APP-PLUS
let currentWebview = page.$getAppWebview();
let titleNView = currentWebview.getStyle().titleNView;
titleNView.buttons[0].text = text;
if (text == "完成") {
this.list.forEach((key) => {
key.history.forEach((item) => {
this.$set(item, "___isDel", false);
});
});
}
currentWebview.setStyle({
titleNView: titleNView,
});
// #endif
// #ifdef H5
// h5 临时方案
document.getElementsByClassName("uni-btn-icon")[1].innerText = text;
// #endif
},
goDetail(item) {
//跳转详情
uni.navigateTo({
url: "/pages/product/goods?id=" + item.id + "&goodsId=" + item.goodsId,
});
},
goSimilar(item) {
//找相似
uni.navigateTo({
url:
"/pages/user/similaritem?item=" +
encodeURIComponent(JSON.stringify(item)),
});
},
getList() {
uni.showLoading({
title: "加载中",
});
myTrackList(this.params).then((res) => {
uni.stopPullDownRefresh();
uni.hideLoading();
if (res.statusCode == 200) {
res.data.result &&
res.data.result.forEach((item) => {
item.___isDel = false;
});
let data = res.data.result;
if (data.total == 0) {
this.nomsg = true;
} else if (data.total < 10) {
this.loadStatus = "noMore";
this.list.push(...data);
} else {
this.list.push(...data);
if (data.length < 10) this.loadStatus = "noMore";
}
}
});
},
changeChecked(val) {
//点击后判断是不是全选
console.log(val);
const isCheckedAll = this.list.every((key) => {
console.log(key);
return key.___isDel == val.___isDel;
});
this.allChecked = isCheckedAll;
},
checkedAllitem() {
//全选按钮
this.list.forEach((key) => {
this.$set(key, "___isDel", this.allChecked);
});
},
delAllTracks() {
let way = [];
this.list.forEach((key) => {
if (key.___isDel) {
way.push(key.goodsId);
}
});
if (way.length == 0) return false;
deleteHistoryListId(way).then((res) => {
if (res.data.code == 200) {
this.list = [];
this.allChecked = false;
this.getList();
} else {
uni.showToast({
title: res.data.message,
duration: 2000,
icon: "none",
});
}
});
},
},
onNavigationBarButtonTap(e) {
if (!this.editFlag) {
this.setStyle("完成");
} else {
this.setStyle("编辑");
}
this.editFlag = !this.editFlag;
},
};
</script>
<style lang="scss" scoped>
.myTracks {
width: 100%;
padding-top: 2rpx;
}
.myTracks-title {
width: 100%;
height: 110rpx;
padding-left: 20rpx;
font-size: 28rpx;
color: #666;
font-weight: bold;
background-color: #fff;
align-items: center;
display: -webkit-box;
display: -webkit-flex;
display: flex;
}
.myTracks-items {
padding-top: 2rpx;
align-items: center;
display: -webkit-box;
display: -webkit-flex;
display: flex;
flex-direction: column;
}
.myTracks-item {
width: 100%;
height: 226rpx;
padding-left: 20rpx;
padding-right: 20rpx;
margin-bottom: 2rpx;
// border-radius: 6/@px;
background-color: #fff;
position: relative;
align-items: center;
display: -webkit-box;
display: -webkit-flex;
display: flex;
}
.myTracks-item-img {
margin-right: 20rpx;
border-radius: 8rpx;
image {
width: 130rpx;
height: 130rpx;
border-radius: 8rpx;
}
}
.myTracks-item-content {
}
.myTracks-item-title {
font-size: 28rpx;
color: #333;
}
.myTracks-item-title-desc {
font-size: 28rpx;
color: #999;
}
.myTracks-item-price {
font-size: 28rpx;
color: $light-color;
padding: 10rpx 0 0 0;
}
.myTracks-item-price-now {
font-size: 28rpx;
color: $light-color;
margin: 0 10rpx;
}
.myTracks-item-price-origin {
font-size: 28rpx;
color: #999;
-webkit-text-decoration-line: line-through;
text-decoration-line: line-through;
text-decoration: line-through;
}
.myTracks-item-btn {
position: absolute;
right: 20rpx;
bottom: 20rpx;
width: 120rpx;
height: 42rpx;
background-color: #fff;
border: 1px solid $aider-light-color;
border-radius: 10rpx;
font-size: 24rpx;
color: $aider-light-color;
display: flex;
justify-content: center;
align-items: center;
}
.myTracks-action-btn {
width: 130rpx;
height: 60rpx;
line-height: 60rpx;
}
.myTracks-divider {
width: 100%;
height: 20rpx;
}
.myTracks-action-placeholder {
height: 110rpx;
}
.myTracks-action {
position: fixed;
bottom: 0;
width: 100%;
height: 100rpx;
padding: 0 20rpx;
box-sizing: border-box;
background-color: #fff;
align-items: center;
display: -webkit-box;
display: -webkit-flex;
display: flex;
justify-content: space-between;
}
.myTracks-action-check {
align-items: center;
display: -webkit-box;
display: -webkit-flex;
display: flex;
}
</style>

View File

@@ -0,0 +1,340 @@
<template>
<view class="content">
<view class="portrait-box">
<image src="/static/pointTrade/point_bg_1.png" mode=""></image>
<image class="point-img" src="/static/pointTrade/tradehall.png" />
<view class="position-point">
<view class="apply-point" @click="goIntro"><text>积分介绍</text></view>
</view>
</view>
<u-row class="portrait-box2">
<u-col span="6" class="portrait-box2-col" :gutter="16">
<text>累计获得</text>
<text class="pcolor">{{ pointData.point || 0 }}</text>
</u-col>
<u-col span="6" class="portrait-box2-col">
<text>未使用</text>
<text class="pcolor">{{ pointData.variablePoint || 0 }}</text>
</u-col>
</u-row>
<u-row class="portrait-box3">
<!-- #ifndef MP-WEIXIN -->
<u-col span="8">近30天记录</u-col>
<u-col textAlign="right" span="4" @click="goDetail" class="more">更多</u-col>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<view class="mp-weixin-more">
<view>近30天记录</view>
<view @click="goDetail">更多</view>
</view>
<!-- #endif -->
</u-row>
<view class="dataList" v-for="(item, index) in list" :key="index">
<view>
<view>{{ item.content }}</view>
<view>{{ item.createTime}}</view>
</view>
<view><span>{{item.pointType == "1" ? '+' : '-'}}</span>{{ item.variablePoint }}</view>
</view>
<uni-load-more :status="count.loadStatus"></uni-load-more>
<u-popup v-model="show" mode="bottom" :closeable="true">
<view class="title">申请积分</view>
<u-form :model="form" ref="uForm">
<u-form-item label="选择店铺" label-width="140">
<u-input v-model="storeParams.storeName" type="select" @click="showstore" placeholder="请选择店铺" />
</u-form-item>
<u-form-item label="申请积分" label-width="140">
<u-input v-model="storeParams.point" type="number" placeholder="请输入积分数量" />
</u-form-item>
</u-form>
<button class="btn-mini" @click="submit" :disabled="avoidClick">提交申请</button>
</u-popup>
</view>
</template>
<script>
import { getPoints, getPointsData } from "@/api/members.js";
import { getMemberPointSum } from "@/api/members.js";
import { contractStep } from "@/api/safe.js";
import storage from "@/utils/storage.js";
export default {
onShow() {
this.userInfo = storage.getUserInfo();
},
data() {
return {
count: {
loadStatus: "more",
},
list: [],
userInfo: [],
params: {
pageNumber: 1,
pageSize: 10,
start_time: 0,
end_time: 0,
},
pointData: {},
show: false,
form: {},
showAction: false,
actionList: [],
storeParams: {
point: 0,
storeId: 0,
storeName: "请选择店铺",
},
avoidClick: false,
isCertificate: true,
};
},
onLoad() {
contractStep().then((res) => {
//是否实名认证
console.log(res);
this.isCertificate = res.data == 1 ? true : false;
});
getPoints().then((res) => {
this.count = res.data;
});
this.initpointDataData();
this.getList();
},
onReachBottom() {
this.params.pageNumber++;
this.getList();
},
methods: {
getList() {
let date = Date.parse(new Date()) / 1000;
let params = this.params;
params.start_time = date - 60 * 60 * 24 * 30; //30天前时间
params.end_time = date;
// console.log(params)
// return;
uni.showLoading({
title: "加载中",
});
getPointsData(params).then((res) => {
uni.hideLoading();
if (res.data.success) {
let data = res.data.result.records;
if (data.length < 10) {
this.$set(this.count, "loadStatus", "noMore");
this.list.push(...data);
} else {
this.list.push(...data);
if (data.length < 10) this.$set(this.count, "loadStatus", "noMore");
}
}
});
},
initpointDataData() {
//累计获得累计使用
getMemberPointSum().then((res) => {
this.pointData = res.data.result;
});
},
goDetail() {
//积分明细
uni.navigateTo({
url: "/pages/point/pointDetail",
});
},
goIntro() {
//跳转详情
uni.navigateTo({
url: "/pages/pointTrade/pointIntro",
});
},
},
};
</script>
<style lang="scss" scoped>
.mp-weixin-more {
width: 96vw;
padding: 0 2vw;
display: flex;
align-items: center;
height: 100%;
justify-content: space-between;
}
.u-close--top-right {
top: 22rpx;
}
.i_time {
color: $u-tips-color;
}
.title {
height: 80rpx;
text-align: center;
line-height: 80rpx;
font-size: 32rpx;
font-weight: bold;
}
.btn-mini {
margin: 20rpx auto;
font-size: 24rpx;
border-radius: 6rpx;
}
.u-form-item {
padding: 10rpx 30rpx 10rpx 20rpx;
}
.dataList {
width: 100%;
height: 130rpx;
padding: 0 20rpx;
background: #ffffff;
font-size: $font-sm;
// line-height: 2em;
border-bottom: 1px solid $border-color-light;
display: flex;
justify-content: end;
align-items: center;
.colorRed {
color: #f04844;
}
> view:nth-child(1) {
flex: 1;
line-height: 40rpx;
view {
color: #666666;
}
:last-child {
color: #999;
}
}
> view:nth-child(2) {
width: 100rpx;
text-align: center;
}
}
.portrait-box2 {
height: 100rpx;
background: #ffffff;
border-radius: 0 0 20rpx 20rpx;
margin: 0 20rpx;
font-size: 26rpx;
/deep/ .u-col {
text-align: center !important;
}
/deep/ .u-col:first-child {
border-right: 1px solid $border-color-light;
}
.pcolor {
color: #4ebb9d;
}
}
.portrait-box3 {
// #ifdef MP-WEIXIN
display: flex;
// #endif
height: 110rpx;
background-color: #f1f1f1;
margin-top: 20rpx;
font-size: 28rpx;
.u-col {
padding: 0 20rpx;
}
}
.content {
background: #f9f9f9;
}
.more {
text-align: right;
color: $u-tips-color;
font-size: 24rpx;
padding-right: 40rpx !important;
}
.portrait-box {
background-color: $main-color;
height: 250rpx;
background: linear-gradient(134deg, #28d094 2%, #1abc9c 98%);
border-radius: 20rpx 20rpx 0 0;
margin: 20rpx 20rpx 0;
position: relative;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: #ffffff;
> image:first-child {
width: 263rpx;
height: 250rpx;
position: absolute;
left: 0;
bottom: 0;
transform: rotateY(180deg);
}
.position-point {
position: absolute;
right: -2rpx;
top: 0;
.apply-point {
margin-top: 30rpx;
text-align: center;
line-height: 40rpx;
font-size: $font-sm;
color: #ffffff;
width: 142rpx;
height: 40rpx;
background: rgba(#ffffff, 0.2);
border-radius: 20rpx 0px 0px 20rpx;
}
}
.point-img {
height: 108rpx;
width: 108rpx;
margin-bottom: 30rpx;
}
.current {
font-size: 26rpx;
text {
vertical-align: middle;
}
> text:nth-child(2) {
color: #ffee80;
font-size: 40rpx;
margin-left: 20rpx;
}
}
.point {
font-size: 56rpx;
}
}
</style>

View File

@@ -0,0 +1,135 @@
<template>
<view class="point-detail">
<empty v-if="nomsg"></empty>
<view v-else class="box" v-for="(con,conIndex) in content" :key="con.conIndex">
<view class="time">
<view> <u-icon name="calendar"></u-icon>&nbsp; {{getMonth(con.months)}}</view>
<view>获得{{con.point}} 使用{{con.consumer_point}}</view>
</view>
<view class="dataList" v-for="(item,index) in con.history" :key="index">
<view>
<view>{{item.reason}}</view>
<view>{{item.time | unixToDate}}</view>
</view>
<view :class="{colorRed:item.consum_point_type==0}">{{item.consum_point_type==0?'-':'+'}}{{item.consum_point}}</view>
<view>{{item.point}}</view>
</view>
</view>
<uni-load-more :status="loadStatus"></uni-load-more>
</view>
</template>
<script>
import {getPointsDataDetail} from '@/api/members.js';
export default {
data() {
return {
params:{
pageNumber:1,
pageSize:10,
start_time:0,
end_time:0
},
content:[],
loadStatus:'more',
nomsg:false,
};
},
onLoad() {
this.getDetailList()
},
methods:{
getDetailList(){
uni.showLoading({
title:'加载中'
})
getPointsDataDetail(this.params).then(res=>{
uni.stopPullDownRefresh();
uni.hideLoading()
if (res.statusCode == 200) {
console.log(res)
let data = res.data;
if (data.length==0) {
if(this.content.length==0){
this.nomsg = true;
}else{
this.loadStatus = 'noMore';
}
}else if(data[data.length-1].history.length<10){
this.content.push(...res.data);
this.loadStatus = 'noMore';
}else{
this.content.push(...res.data);
}
}
})
},
getMonth(time){
console.log(time)
let str = time+'';
let arr = str.split('');
arr.splice(4,0,'-');
return arr.join('')
}
},
onReachBottom(){
if(this.loadStatus == 'more'){
this.params.pageNumber++;
this.getDetailList()
}
}
}
</script>
<style lang="scss" scoped>
.point-detail{
.box{
.time{
display: flex;
justify-content: space-between;
padding: 0 20rpx;
align-items: center;
height: 112rpx;
color: #999999;
font-size: $font-sm;
}
.dataList {
width: 100%;
height: 120rpx;
border-top: 1px solid #f2f2f2;
padding: 30rpx;
background: #ffffff;
font-size: $font-sm;
// line-height: 1.5em;
margin-bottom: 10rpx;
display: flex;
justify-content: end;
align-items: center;
.colorRed{
color: #f04844;
}
>view:nth-child(1){
flex: 1;
line-height: 1.5em;
:nth-child(1){
color: #666666;
}
:nth-child(2){
color: #999;
}
}
>view:nth-child(2){
width: 80rpx;
text-align: center;
}
>view:nth-child(3){
width: 100rpx;
text-align: center;
}
}
}
}
</style>

View File

@@ -0,0 +1,125 @@
<template>
<view class="edition-intro">
<view class="logo c-content">
<view>
<image src="/static/img/edition.png" mode=""></image>
</view>
<view>版本不息&nbsp;优化不止</view>
</view>
<view class="edition c-content" v-for="(item,index) in editionHistory" :key="index">
<view class="level">
<text style="color: #1ABC9C;">{{item.version}}</text>
<text>{{$u.timeFormat(item.update_time, 'yyyy-mm-dd')}}</text>
</view>
<view class="detail" v-html="item.content"></view>
</view>
</view>
</template>
<script>
import * as API_Message from "@/api/message.js";
export default {
data() {
return {
editionHistory:[],
params: {
pageNumber: 1,
pageSize: 5
},
loadStatus:'more'
};
},
onLoad(){
if (uni.getSystemInfoSync().platform === 'android') {
this.params.type = 0;
} else {
this.params.type = 1;
}
this.GET_AppVersionList(true);
},
onReachBottom() {
if(this.loadStatus!='noMore'){
this.params.pageNumber++
this.GET_AppVersionList(false)
}
},
methods: {
GET_AppVersionList(reset){
if (reset) {
this.params.pageNumber = 1
}
uni.showLoading({
title:"加载中"
})
API_Message.getAppVersionList(this.params).then(response => {
uni.hideLoading()
if(response.statusCode==200){
const { data } = response
if(data.data.length<10){
this.loadStatus = 'noMore';
}
this.editionHistory.push(...data.data)
}
})
}
}
}
</script>
<style lang="scss">
.edition-intro{
.logo{
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
font-size: $font-lg;
color: $font-color-light;
height: 330rpx;
margin-bottom: 20rpx;
>view:nth-child(1){
width: 144rpx;
height: 144rpx;
border: 1px solid #FFC71C;
border-radius: 50%;
position: relative;
margin-bottom: 30rpx;
image{
width: 80rpx;
height: 113rpx;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin:auto;
}
}
}
.edition{
margin-bottom: 20rpx;
color: $font-color-light;
font-size: $font-sm;
.level{
display: flex;
justify-content: space-between;
align-items: center;
padding: 20rpx 30rpx ;
border-bottom: 1px solid $border-color-light;
text:nth-child(1){
font-size: $font-base;
font-weight: 700;
}
}
.detail{
margin-left: 20rpx;
line-height: 2em;
padding: 20rpx 0;
}
}
}
</style>

162
pages/mine/set/feedBack.vue Normal file
View File

@@ -0,0 +1,162 @@
<template>
<div class="feedBack">
<div class="feedBack-box">
<h4>猜你想问</h4>
<div class="feedBack-item" @click="handleClick(index)" v-for="(item,index) in list" :key="index">
{{item.text}}
</div>
</div>
<div class="feedBack-box">
<h4>问题反馈 <span style="margin-left:10rpx;" v-if="feedBack.type">@{{ list.find(item=>{return item.value == feedBack.type }).text }}</span></h4>
<u-input class="field-input" height="500" :border-bottom="false" v-model="feedBack.context" type="textarea" placeholder="请输入反馈信息">
</u-input>
</div>
<!-- 上传凭证 -->
<div class="feedBack-box">
<view class="opt-view">
<view class="img-title">上传凭证最多5张</view>
<view class="images-view">
<u-upload :header=" { accessToken: storage.getAccessToken() }" :action="action" width="150" @on-uploaded="onUploaded" :max-count="5" :show-progress="false"></u-upload>
</view>
</view>
</div>
<div class="feedBack-box">
<h4>手机号</h4>
<u-input :border-bottom="false" v-model="feedBack.mobile" placeholder="请输入您的手机号">
</u-input>
</div>
<div class="submit" @click="submit()">提交</div>
</div>
</template>
<script>
import storage from "@/utils/storage.js";
import config from "@/config/config";
import { feedBack } from "@/api/members.js";
import { upload } from "@/api/common.js";
export default {
data() {
return {
storage,
config,
feedBack: {
type:"FUNCTION"
},
action: upload,
list: [
{ text: "功能相关", value: "FUNCTION" },
{ text: "优化反馈", value: "OPTIMIZE" },
{ text: "其他", value: "OTHER" },
],
};
},
onReady() {},
methods: {
handleClick(index) {
this.$set(this.feedBack, "type", this.list[index].value);
},
//图片上传
onUploaded(lists) {
let images = [];
lists.forEach((item) => {
images.push(item.response.result);
});
console.log(images);
this.feedBack.images = images.join(",");
},
submit() {
if (!this.feedBack.type) {
uni.showToast({
title: "请填写反馈类型",
duration: 2000,
icon: "none",
});
return false;
}
if (!this.feedBack.context) {
uni.showToast({
title: "请填写反馈类型",
duration: 2000,
icon: "none",
});
return false;
}
if (this.feedBack.mobile && !this.$u.test.mobile(this.feedBack.mobile)) {
uni.showToast({
title: "请填写您的正确手机号",
duration: 2000,
icon: "none",
});
return false;
}
feedBack(this.feedBack).then((res) => {
if (res.data.success) {
uni.showToast({
title: "提交成功!",
duration: 2000,
icon: "none",
});
setTimeout(() => {
uni.navigateBack({
delta: 1,
});
}, 500);
}
});
},
},
};
</script>
<style lang="scss" scoped>
.submit {
text-align: center;
background: $light-color;
height: 70rpx;
line-height: 70rpx;
color: #fff;
width: 92%;
margin-bottom: 100rpx;
margin: 0 auto;
border-radius: 100px;
}
.feedBack {
padding-bottom: 100rpx;
}
.feedBack-box {
background: #fff;
border-radius: 20rpx;
padding: 32rpx;
margin-bottom: 40rpx;
}
/deep/ .u-input__textarea {
padding: 12px;
}
.feedBack-box:nth-of-type(1) {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.feedBack-item {
margin: 20rpx 0;
font-size: 24rpx;
color: #666;
}
h4 {
font-size: 30rpx;
}
.field-input {
margin: 20rpx 0;
padding: 20rpx 0;
background: #fafafa;
border-radius: 0.6em;
}
</style>

39
pages/mine/set/notify.vue Normal file
View File

@@ -0,0 +1,39 @@
<template>
<view class="notify">
<u-cell-group>
<u-cell-item title="账户通知" :arrow="false">
<u-switch slot="right-icon" active-color="#1abc9c" size="40" v-model="setting.account"></u-switch>
</u-cell-item>
<u-cell-item title="物流通知" :arrow="false">
<u-switch slot="right-icon" active-color="#1abc9c" size="40" v-model="setting.logistics"></u-switch>
</u-cell-item>
<u-cell-item title="优惠促销" :arrow="false">
<u-switch slot="right-icon" active-color="#1abc9c" size="40" v-model="setting.cheap"></u-switch>
</u-cell-item>
<u-cell-item title="服务通知" :arrow="false">
<u-switch slot="right-icon" active-color="#1abc9c" size="40" v-model="setting.service"></u-switch>
</u-cell-item>
</u-cell-group>
</view>
</template>
<script>
export default {
data() {
return {
setting:{
account:false,
logistics:false,
cheap:false,
service:false
}
};
}
}
</script>
<style lang="scss" scoped>
uni-view{
font-size: 20rpx;
}
</style>

View File

@@ -0,0 +1,220 @@
<template>
<view class="person-msg">
<view class="head c-content" @click="changeFace">
<image :src="form.face || '/static/missing-face.png'" mode=""></image>
<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>
</u-radio-group>
</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-form-item>
<u-form-item label="城市" label-width="150" placeholder="请选择城市" right-icon="arrow-right">
<u-input v-model="form.___path" disabled @click="clickRegion" />
</u-form-item>
<view class="submit" @click="submit">保存</view>
</u-form>
<m-city :provinceData="region" headTitle="区域选择" ref="cityPicker" @funcValue="getpickerParentValue" pickerSize="4"></m-city>
</view>
</template>
<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";
export default {
components: { uFormItem, "m-city": gkcity },
data() {
return {
lightColor: this.$lightColor,
form: {
face: "/static/missing-face.png",
regionId: [],
region: [],
sex: "1",
___path: "",
},
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,
};
},
created() {},
methods: {
getpickerParentValue(e) {
this.form.region = [];
this.form.regionId = [];
let name = "";
e.forEach((item, index) => {
if (item.id) {
this.form.region.push(item.localName);
this.form.regionId.push(item.id);
if (index == e.length - 1) {
name += item.localName;
} else {
name += item.localName + ",";
}
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();
}
});
} else {
uni.showToast({
title: "请填写生日和城市!",
duration: 2000,
icon: "none",
});
}
},
changeFace(index) {
uni.chooseImage({
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
uni.uploadFile({
url: upload,
filePath: tempFilePaths[0],
name: "file",
header: {
accessToken: storage.getAccessToken(),
},
success: (uploadFileRes) => {
let data = JSON.parse(uploadFileRes.data);
this.form.face = data.result;
},
});
},
});
},
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);
},
};
</script>
<style lang="scss" scoped>
.submit {
height: 90rpx;
line-height: 90rpx;
text-align: center;
margin-top: 90rpx;
width: 100%;
margin: 0 auto;
color: $main-color;
border-radius: 100px;
}
.head {
height: 260rpx;
color: $font-color-light;
font-size: $font-sm;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
line-height: 2em;
image {
width: 144rpx;
height: 144rpx;
border-radius: 50%;
}
}
/deep/ .u-form {
background-color: #ffffff;
padding: 0;
margin-top: 30rpx;
.u-form-item {
padding: 0 20rpx;
height: 110rpx;
line-height: 110rpx;
}
}
.form {
background-color: #ffffff;
}
</style>

View File

@@ -0,0 +1,40 @@
<template>
<view class="device-manage">
<u-cell-group>
<u-cell-item class="border-top" :arrow="false" title="常用设备保护">
<u-switch slot="right-icon" active-color="#1abc9c" size="40" v-model="checked"></u-switch>
</u-cell-item>
</u-cell-group>
<view class="describe">开启常用设备保护后在不常用的手机上登录时需要进行账号及密码验证通过后继续登录</view>
<view class="title">常用设备</view>
<u-cell-group class="">
<u-cell-item
title="HUAWEI Mate30"
:center="true"
label="最近使用2020-06-28北京市"
value="正在使用"
:value-style="{color:'#1abc9c','font-size':'14px'}"
:title-style="{'color':'#333'}"
>
</u-cell-item>
</u-cell-group>
</view>
</template>
<script>
export default {
data() {
return {
checked:true
};
}
}
</script>
<style lang="scss">
.device-manage{
.title{
padding:0 30rpx 20rpx;
}
}
</style>

View File

@@ -0,0 +1,250 @@
<template>
<view class="box">
<view class="box-tips">
<h2>
{{verificationTitle[validateFlage==false ? 0 : 1].title}}
</h2>
<view class="verification">{{verificationTitle[step].desc}}</view>
</view>
<u-form :model="codeForm" class="form" ref="validateCodeForm">
<view v-if="!validateFlage">
<u-form-item label-width="120" label="手机号" prop="mobile">
<u-input v-model="codeForm.mobile" placeholder="请输入您的手机号" />
</u-form-item>
<u-form-item class="sendCode" label-width="120" prop="code" label="验证码">
<u-input v-model="codeForm.code" placeholder="请输入验证码" />
<u-verification-code unique-key="page-edit" :seconds="seconds" @end="end" @start="start" ref="uCode" @change="codeChange"></u-verification-code>
<view @tap="getCode" class="text-tips">{{ tips }}</view>
</u-form-item>
<view class="submit" @click="validatePhone">验证</view>
<myVerification keep-running @send="verification" class="verification" ref="verification" business="LOGIN" />
</view>
<view v-if="validateFlage">
<u-form-item label-width="120" label="旧密码">
<u-input type="password" v-model="password" placeholder="请输入您的旧密码" />
</u-form-item>
<u-form-item label-width="120" label="新密码">
<u-input type="password" v-model="newPassword" placeholder="请输入您的新密码" />
</u-form-item>
<view class="submit" @click="updatePassword">修改密码</view>
</view>
</u-form>
</view>
</template>
<script>
import { sendMobile, resetByMobile, modifyPass } from "@/api/login";
import storage from "@/utils/storage.js";
import { md5 } from "@/utils/md5.js";
import myVerification from "@/components/verification/verification.vue";
import uuid from "@/utils/uuid.modified.js";
export default {
components: {
myVerification,
},
data() {
return {
uuid,
validateFlage: false, //是否进行了手机号验证
verificationTitle: [
{
title: "安全验证",
desc: "请输入当前手机号进行安全验证",
},
{
title: "修改密码",
desc: "请输入新密码",
},
],
step: 0, //当前验证步骤
flage: false, //是否验证码验证
// 验证码登录form
codeForm: {
mobile: "", //手机号
code: "", //验证码
},
newPassword: "",//新密码
password: "", //密码
tips: "", //提示
seconds: 60,
// 验证码登录校验
codeRules: {
mobile: [
{
validator: (rule, value, callback) => {
return this.$u.test.mobile(value);
},
message: "手机号码不正确",
trigger: ["blur"],
},
],
code: [
{
min: 4,
max: 6,
required: true,
message: "请输入验证码",
trigger: ["blur"],
},
],
},
};
},
onReady() {
// 必须要在onReady生命周期因为onLoad生命周期组件可能尚未创建完毕
this.$refs.validateCodeForm.setRules(this.codeRules);
},
watch: {
flage(val) {
if (val) {
if (this.$refs.uCode.canGetCode) {
uni.showLoading({
title: "正在获取验证码",
});
sendMobile(this.codeForm.mobile).then((res) => {
uni.hideLoading();
// 这里此提示会被this.start()方法中的提示覆盖
if (res.data.code == 200) {
this.$refs.uCode.start();
} else {
uni.showToast({
title: res.data.message,
duration: 2000,
icon: "none",
});
}
});
} else {
this.$u.toast("请倒计时结束后再发送");
}
}
},
},
methods: {
// 修改密码
updatePassword() {
modifyPass({
newPassword: md5(this.newPassword),
password: md5(this.password),
}).then((res) => {
if (res.data.success) {
uni.showToast({
title: "修改成功!",
duration: 2000,
icon: "none",
});
setTimeout(() => {
uni.navigateBack({
delta: 1,
});
}, 1000);
}
});
},
// 验证码验证
verification(val) {
this.flage = val == this.$store.state.verificationKey ? true : false;
},
// 验证手机号
validatePhone() {
this.$refs.validateCodeForm.validate((valid) => {
if (valid) {
resetByMobile(this.codeForm).then((res) => {
if (res.data.success) {
storage.setAccessToken(res.data.result.accessToken);
storage.setRefreshToken(res.data.result.refreshToken);
// 登录成功
uni.showToast({
title: "验证成功!",
icon: "none",
});
}
});
}
});
},
codeChange(text) {
this.tips = text;
},
end() {},
/**判断是否是当前用户的手机号 */
isUserPhone() {
let flage = false;
let user = this.$options.filters.isLogin();
if (user.mobile != this.codeForm.mobile) {
uni.showToast({
title: "请输入当前绑定手机号",
icon: "none",
});
flage = false;
} else {
flage = true;
}
return flage;
},
/**获取验证码 */
getCode() {
if (this.isUserPhone()) {
if (this.tips == "重新获取") {
this.flage = true;
}
if (!this.$u.test.mobile(this.codeForm.mobile)) {
uni.showToast({
title: "请输入正确手机号",
icon: "none",
});
return false;
}
if (!this.flage) {
this.$refs.verification.hide();
return false;
}
}
},
start() {
this.$u.toast("验证码已发送");
this.flage = false;
},
},
};
</script>
<style lang="scss" scoped>
@import url("../../../passport/login.scss");
.u-form-item {
margin: 40rpx 0;
}
.sendCode {
/deep/ .u-form-item--right__content__slot {
display: flex;
}
}
page {
background: #fff;
}
.box {
padding: 80rpx 0;
border-radius: 20rpx;
}
.box-tips {
margin: 0 72rpx;
}
.verification {
font-size: 24rpx;
color: #999;
margin-top: 10rpx;
}
</style>

View File

@@ -0,0 +1,84 @@
<template>
<view class="face-login">
<u-cell-group>
<u-cell-item class="border-top" :arrow="false" title="面容登录">
<u-switch slot="right-icon" @change="faceSwitchChange" active-color="#1abc9c" size="40" v-model="checked"></u-switch>
</u-cell-item>
</u-cell-group>
<view class="describe">开启后可使用面容认证完成快捷登录设置仅对本机生效</view>
</view>
</template>
<script>
import storage from '@/utils/storage.js';
import { setBiolofy } from '@/api/passport.js';
export default {
data() {
return {
checked: true
};
},
methods: {
faceSwitchChange(value) {
if (value === true) {
const res = uni.getSystemInfoSync();
plus.device.getInfo({
success: function(e) {
let params = {
mobile_type: res.model,
secret_key: e.uuid
};
setBiolofy(params).then(res => {
if (res.statusCode === 200) {
storage.setFaceLogin(true);
}
});
},
fail: function(e) {
//plus.nativeUI.toast('获取设备信息错误:' + JSON.stringify(e));
console.error('getDeviceInfo failed: ' + JSON.stringify(e));
}
});
} else {
storage.setFaceLogin(false);
}
}
},
onLoad() {
// #ifdef APP-PLUS
uni.checkIsSupportSoterAuthentication({
success(res) {
if (!res.supportMode.find(e => e === 'facial')) {
plus.nativeUI.toast('此设备不支持面部识别');
uni.navigateBack();
}
uni.checkIsSoterEnrolledInDevice({
checkAuthMode: 'facial',
success(_res) {
if (!_res.isEnrolled) {
plus.nativeUI.toast('此设备未录入面部信息');
uni.navigateBack();
}
},
fail(_err) {
// plus.nativeUI.toast(JSON.stringify(_err));
uni.navigateBack();
}
});
},
fail(err) {
// plus.nativeUI.toast(JSON.stringify(err));
uni.navigateBack();
}
});
this.checked = storage.getFaceLogin() || false;
// #endif
}
};
</script>
<style lang="scss" scoped>
.face-login {
}
</style>

View File

@@ -0,0 +1,70 @@
<template>
<view class="finger">
<u-cell-group>
<u-cell-item class="border-top" :arrow="false" title="指纹登录">
<u-switch slot="right-icon" @change="fingerSwitchChange" active-color="#1abc9c" size="40" v-model="checked"></u-switch>
</u-cell-item>
</u-cell-group>
<view class="describe">开启后可使用指纹认证完成快捷登录设置仅对本机生效如需修改指纹请在系统设置中操作</view>
</view>
</template>
<script>
import storage from '@/utils/storage.js';
import { setBiolofy } from '@/api/passport.js';
export default {
data() {
return {
checked: false
};
},
methods: {
fingerSwitchChange(value) {
if (value === true) {
const res = uni.getSystemInfoSync();
plus.device.getInfo({
success: function(e) {
let params = {
mobile_type: res.model,
secret_key: e.uuid
};
setBiolofy(params).then(res => {
if (res.statusCode === 200) {
storage.setFingerLogin(true);
}
});
},
fail: function(e) {
console.error('getDeviceInfo failed: ' + JSON.stringify(e));
}
});
} else {
storage.setFingerLogin(false);
}
}
},
onLoad() {
// #ifdef APP-PLUS
if (!plus.fingerprint.isSupport()) {
plus.nativeUI.toast('此设备不支持指纹识别');
uni.navigateBack();
}
if (!plus.fingerprint.isKeyguardSecure()) {
plus.nativeUI.toast('此设备未设置密码锁屏');
uni.navigateBack();
}
if (!plus.fingerprint.isEnrolledFingerprints()) {
plus.nativeUI.toast('此设备未录入指纹');
uni.navigateBack();
}
this.checked = storage.getFingerLogin() || false;
// #endif
}
};
</script>
<style lang="scss">
.finger {
}
</style>

View File

@@ -0,0 +1,36 @@
<template>
<view class="securityCenter">
<u-cell-group>
<u-cell-item title="修改密码" @click="navigateTo('/pages/mine/set/securityCenter/editPassword')"></u-cell-item>
</u-cell-group>
</view>
</template>
<script>
export default {
data() {
return {
mobile: "", //存储手机号
};
},
methods: {
navigateTo(url) {
uni.navigateTo({
url: url + `?mobile=${this.mobile}`,
});
},
},
onLoad(option) {
this.mobile = option.mobile;
},
};
</script>
<style lang="scss" scoped>
.securityCenter {
.u-cell {
line-height: normal;
}
}
</style>

219
pages/mine/set/setUp.vue Normal file
View File

@@ -0,0 +1,219 @@
<template>
<view class="container">
<view class="person" @click="checkUserInfo()">
<u-image width=140 height="140" shape="circle" :src="userInfo.face || '/static/missing-face.png'" mode=""></u-image>
<view class="user-name">
<view>{{ userInfo.id ? userInfo.username || '' : '暂未登录' }}</view>
</view>
<u-icon color="#ccc" name="arrow-right"></u-icon>
</view>
<!-- #ifdef MP-WEIXIN -->
<view style="height: 20rpx; width: 100%"></view>
<!-- #endif -->
<u-cell-group :border="false">
<!-- #ifdef APP-PLUS -->
<u-cell-item title="清除缓存" :value="fileSizeString" @click="clearCache"></u-cell-item>
<!-- #endif -->
<u-cell-item title="安全中心" @click="navigateTo('/pages/mine/set/securityCenter/securityCenter')"></u-cell-item>
<u-cell-item title="意见反馈" @click="navigateTo('/pages/mine/set/feedBack')"></u-cell-item>
<!-- #ifndef H5 -->
<u-cell-item title="版本说明" @click="navigateTo('/pages/mine/set/editionIntro')"></u-cell-item>
<!-- #endif -->
<!-- <u-cell-item title="好评鼓励"></u-cell-item> -->
<u-cell-item title="关于我们" @click="navigateTo('/pages/mine/aboutUs')"></u-cell-item>
</u-cell-group>
<view class="submit" @click="showModalDialog">{{userInfo.id ?'退出登录':'返回登录'}}</view>
<u-modal show-cancel-button v-model="quitShow" @confirm="confirm" :confirm-color="lightColor" :async-close="true" :content="userInfo.id ? '确定要退出登录么?' : '确定要返回登录么?'"></u-modal>
</view>
</template>
<script>
import storage from "@/utils/storage.js";
export default {
data() {
return {
lightColor: this.$lightColor,
quitShow: false,
isCertificate: false,
userInfo: {},
fileSizeString: "0B",
};
},
methods: {
navigateTo(url) {
if (url == "/pages/set/securityCenter/securityCenter") {
url += `?mobile=${this.userInfo.mobile}`;
}
uni.navigateTo({
url: url,
});
},
/**
* 确认退出
* 清除缓存重新登录
*/
confirm() {
storage.setAccessToken("");
storage.setRefreshToken("");
storage.setUserInfo({});
uni.redirectTo({
url: "/pages/passport/login",
});
},
/**
* 显示退出登录对话框
*/
showModalDialog() {
this.quitShow = true;
},
/**
* 读取当前缓存
*/
getCacheSize() {
//获取缓存数据
let that = this;
plus.cache.calculate(function (size) {
let sizeCache = parseInt(size);
if (sizeCache == 0) {
that.fileSizeString = "0B";
} else if (sizeCache < 1024) {
that.fileSizeString = sizeCache + "B";
} else if (sizeCache < 1048576) {
that.fileSizeString = (sizeCache / 1024).toFixed(2) + "KB";
} else if (sizeCache < 1073741824) {
that.fileSizeString = (sizeCache / 1048576).toFixed(2) + "MB";
} else {
that.fileSizeString = (sizeCache / 1073741824).toFixed(2) + "GB";
}
});
},
/**
* 点击用户详情
* 判断当前是否进入用户中心
*/
checkUserInfo() {
if (this.$options.filters.isLogin("auth")) {
this.navigateTo("/pages/mine/set/personMsg");
} else {
uni.showToast({
title: "当前暂无用户请登录后重试",
duration: 2000,
icon: "none",
});
}
},
/**
* 清除当前设备缓存
*/
clearCache() {
//清理缓存
let that = this;
let os = plus.os.name;
if (os == "Android") {
let main = plus.android.runtimeMainActivity();
let sdRoot = main.getCacheDir();
let files = plus.android.invoke(sdRoot, "listFiles");
let len = files.length;
for (let i = 0; i < len; i++) {
let filePath = "" + files[i]; // 没有找到合适的方法获取路径,这样写可以转成文件路径
plus.io.resolveLocalFileSystemURL(
filePath,
function (entry) {
if (entry.isDirectory) {
entry.removeRecursively(
function (entry) {
//递归删除其下的所有文件及子目录
uni.showToast({
title: "缓存清理完成",
duration: 2000,
icon: "none",
});
that.getCacheSize(); // 重新计算缓存
},
function (e) {
console.log(e.message);
}
);
} else {
entry.remove();
}
},
function (e) {
uni.showToast({
title: "文件路径读取失败",
duration: 2000,
icon: "none",
});
}
);
}
} else {
// ios
plus.cache.clear(function () {
uni.showToast({
title: "缓存清理完成",
duration: 2000,
icon: "none",
});
that.getCacheSize();
});
}
},
},
onShow() {
this.userInfo = this.$options.filters.isLogin();
// #ifdef APP-PLUS
this.getCacheSize();
// #endif
},
};
</script>
<style lang='scss' scoped>
.submit {
height: 90rpx;
line-height: 90rpx;
text-align: center;
margin-top: 90rpx;
background: #fff;
width: 100%;
margin: 0 auto;
color: $main-color;
}
.person {
height: 208rpx;
display: flex;
padding: 0 20rpx;
font-size: $font-base;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
.user-name {
flex: 1;
margin-left: 30rpx;
line-height: 2em;
font-size: 34rpx;
}
}
.u-cell {
height: 110rpx;
/* line-height: 110rpx; */
padding: 0 20rpx;
align-items: center;
color: #333333;
}
/deep/ .u-cell__value {
color: #cccccc !important;
}
/deep/ .u-cell__right-icon-wrap {
color: #cccccc !important;
}
</style>

538
pages/mine/signIn.vue Normal file
View File

@@ -0,0 +1,538 @@
<template>
<view class="sign-in">
<view class="signin-btn-con">
<div class="circle-box">
<div class="cricle" @click="signIn()">
<span v-if="!ifSign" :class="{ active: signFlag || ifSign }">签到</span>
<span v-else :class="{ active: signFlag || ifSign }" :style="ifSign ? 'transform: rotateY(0deg);' : ''">已签</span>
</div>
</div>
<text class="tips">坚持每天连续签到可以获多重奖励哦</text>
</view>
<div class="date-card">
<view class="date-con">
<view class="date-tit">
<u-row style="width: 100%; justify-content: center;">
<div style="text-align: center; " class="text">{{ currentMonth }} {{ currentYear }}</div>
</u-row>
</view>
<view class="week">
<text v-for="item in weekArr" :key="item.id">{{ item }}</text>
</view>
<view class="date" v-for="obj in dataObj" :key="obj.id">
<view class="item" v-for="item in obj" :key="item.id" :class="item == '' ? 'hide' : ''" :animation="item == currentDay ? animationData : ''">
<view class="just" :class="signArr.indexOf(item) != -1 ? 'active' : ''">
<view class="top">{{ item }} </view>
<view class="bottom">
<u-icon name="error" v-if="item <= currentDay" color="#999"></u-icon>
</view>
</view>
<view class="back" :class="signArr.indexOf(item) != -1 ? 'active' : ''" :style="
signArr.indexOf(item) != -1 && ifSign
? 'transform: rotateY(0deg);'
: signArr.indexOf(item) != -1 && item != currentDay
? 'transform: rotateY(0deg);'
: ''
">
<view class="top">{{ item }}</view>
<view class="bottom">
<u-icon name="checkmark" color="#ff9f28"></u-icon>
</view>
</view>
</view>
</view>
</view>
</div>
<view class="mask" :class="{ show: maskFlag, trans: transFlag }" ref="mask">
<view class="mask-header">
<text class="close"></text>
<text>签到成功</text>
<text class="close" @click="close">×</text>
</view>
<view class="mask-con">
<view class="keep-sign">
本月已连续签到
<text>{{ continuity }}</text>
</view>
<u-icon size="120" style="margin: 50rpx 0" color="#ff9f28" name="checkmark"></u-icon>
<view class="mark">
<view>获得积分</view>
<text>{{ continuity_point }}</text>
</view>
<text class="text">连续签到可获得额外奖励哦</text>
</view>
</view>
</view>
</template>
<script>
import { sign, signTime } from "@/api/point.js";
export default {
data() {
return {
continuity: 1,
continuity_point: 2,
header: {
top: 0,
height: 50,
},
signFlag: false,
animationData: {},
maskFlag: false,
transFlag: false,
weekArr: ["日", "一", "二", "三", "四", "五", "六"],
dateArr: [], //每个月的天数
monthArr: [
"1月",
"2月",
"3月",
"4月",
"5月",
"6月",
"7月",
"8月",
"9月",
"10月",
"11月",
"12月",
], //今天一个月英文
currentMonth: "", //当月
currentMonthIndex: "", //当月
currentYear: "", //今年
currentDay: "", //今天
currentWeek: "", //获取当月一号是周几
dataObj: [], //一个月有多少天这个获取
signArr: [], //本月签到过的天数 该参数用于请求接口后获取当月都哪天签到了
signAll: [], //所有签到数据
ifSign: false, //今天是否签到
};
},
async onLoad() {
//获取签到数据
var response = await signTime(
new Date().getFullYear() + "" + this.makeUp(new Date().getMonth() + 1)
);
this.signAll = response.data.result;
//获取展示数据
this.getDate();
},
methods: {
makeUp(val) {
if (val >= 10) {
return val;
} else {
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,
icon: "none",
});
return false;
}
var that = this;
var animation = uni.createAnimation({
duration: 200,
timingFunction: "linear",
});
this.signArr.push(this.currentDay);
this.animation = animation;
animation.rotateY(0).step();
this.animationData = animation.export();
setTimeout(
function () {
that.signFlag = true;
this.maskFlag = true;
this.ifSign = !this.ifSign;
animation.rotateY(0).step();
this.animationData = animation.export();
}.bind(this),
200
);
});
},
// 关闭弹窗
close() {
var that = this;
this.maskFlag = false;
this.transFlag = true;
setTimeout(function () {
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;
this.currentYear = date.getFullYear();
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(),
curDay = null;
this.signArr = [];
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()) &&
Number(itemVal[1]) === Number(index + 1) &&
Number(itemVal[2]) === Number(date.getDate())
) {
this.ifSign = true;
}
}
},
getMonthDays(index, day) {
//day 当月1号是周几
this.dateArr = [];
this.dataObj = [];
for (var i = 0; i < day; i++) {
this.dateArr.push("");
}
if (
index == 0 ||
index == 2 ||
index == 4 ||
index == 6 ||
index == 7 ||
index == 9 ||
index == 11
) {
for (let i = 1; i < 32; i++) {
this.dateArr.push(i);
}
}
if (index == 3 || index == 5 || index == 8 || index == 10) {
for (let i = 1; i < 31; i++) {
this.dateArr.push(i);
}
}
if (index == 1) {
if (
(this.currentYear % 4 == 0 && this.currentYear % 100 != 0) ||
this.currentYear % 400 == 0
) {
for (let i = 1; i < 30; i++) {
this.dateArr.push(i);
}
} else {
for (let i = 1; i < 29; i++) {
this.dateArr.push(i);
}
}
}
for (var y = 0; y < 10; y++) {
if (this.dateArr.length > 7) {
this.dataObj.push(this.dateArr.splice(0, 7));
} else {
for (let i = 0; i < 7 - this.dateArr.length; i++) {
this.dateArr.push("");
}
}
}
this.dataObj.push(this.dateArr);
},
getWeekByDay(dayValue) {
//dayValue=“2014-01-01”
var day = new Date(Date.parse(dayValue.replace(/-/g, "/"))).getDay(); //将日期值格式化
return day;
},
},
};
</script>
<style lang="scss" scoped>
.date-card {
padding: 0 40rpx;
}
.tips {
margin-top: 34rpx;
}
.circle-box {
width: 200rpx;
height: 200rpx;
border-radius: 50%;
margin-top: 60rpx;
background: #ff9f28;
display: flex;
justify-content: center; //这个是X轴居中
align-items: center; //这个是 Y轴居中
}
.cricle {
width: 160rpx;
height: 160rpx;
border-radius: 50%;
background: #ff9f28;
text-align: center;
line-height: 160rpx;
color: #fff;
font-size: 40rpx;
}
page {
background: #fff;
}
.sign-in {
color: #333;
.signin-btn-con {
width: 100%;
height: 670rpx;
background-image: linear-gradient(180deg, #ff6b35, #ff9f28, #ffcc03);
display: flex;
flex-direction: column;
align-items: center;
text {
color: #fff;
font-size: 28rpx;
font-weight: 400;
}
}
.date-con {
background: #fff;
min-height: 730rpx;
border-radius: 0.8em;
border: 1px solid #ededed;
padding: 0 28rpx;
transform: translateY(-320rpx);
box-shadow: (1px 3px 5px rgba(0, 0, 0, 0.2));
}
.date-tit {
display: flex;
justify-content: space-between;
margin: 30rpx 0;
}
.week {
display: flex;
justify-content: space-between;
color: #a6a6a6;
font-size: 26rpx;
text {
width: 66rpx;
text-align: center;
}
}
.date {
margin: 10rpx 0 36rpx;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.item {
width: 66rpx;
height: 80rpx;
border-radius: 5px;
overflow: hidden;
position: relative;
&.hide {
opacity: 0;
}
.just,
.back {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
position: absolute;
.top {
position: relative;
flex: 1;
text-align: center;
line-height: 40rpx;
&:before {
content: "";
width: 40rpx;
height: 40rpx;
position: absolute;
left: 50%;
transform: translateX(-50%);
top: 15rpx;
}
}
}
.just {
&.active {
display: none;
}
}
.back {
display: none;
&.active {
display: flex;
}
.top {
color: #ff9f28;
}
}
.bottom {
color: #999;
font-size: 20rpx;
height: 20rpx;
line-height: 20rpx;
text-align: center;
}
}
}
.mask {
position: fixed;
top: 0;
bottom: 0;
left: -100%;
right: 100%;
background: rgba(0, 0, 0, 0.2);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
opacity: 0;
transition: opacity 0.5s;
&.show {
opacity: 1;
left: 0;
right: 0;
}
&.trans {
left: 0;
right: 0;
}
.mask-header {
width: 540rpx;
height: 130rpx;
line-height: 130rpx;
background: #ff9f28;
color: #fff;
font-size: 40rpx;
font-weight: 500;
display: flex;
justify-content: space-between;
.close {
width: 60rpx;
font-size: 66rpx;
font-weight: 400;
line-height: 60rpx;
}
}
.mask-con {
width: 540rpx;
height: 460rpx;
background: #fff;
display: flex;
flex-direction: column;
align-items: center;
color: #999;
font-size: 24rpx;
border-radius: 0 0 9px 9px;
.keep-sign {
font-size: 30rpx;
margin-top: 30rpx;
text {
font-size: 46rpx;
font-weight: 500;
color: #999;
padding: 0 6rpx 0 8rpx;
}
}
.mark {
// flex: 1;
display: flex;
align-items: flex-end;
position: relative;
margin-bottom: 16rpx;
text {
margin-left: 4rpx;
color: #999;
}
}
.text {
color: #6f6f6f;
height: 90rpx;
}
}
}
}
</style>