会员中心我的伙伴
This commit is contained in:
311
pages/employees/add.vue
Normal file
311
pages/employees/add.vue
Normal file
@@ -0,0 +1,311 @@
|
||||
<template>
|
||||
<view class="content" v-if="!loging">
|
||||
<!-- 基础信息 -->
|
||||
<view class="info-card">
|
||||
<view class="cover">
|
||||
<view class="cover-add vertical" @click="updCover">
|
||||
<block v-if="cover.showpath != ''">
|
||||
<image :src="cover.showpath" mode="aspectFill"></image>
|
||||
</block>
|
||||
<block v-else>
|
||||
<image class="cover-default" src="@/static/icons/add-icon.png" mode="widthFix"></image>
|
||||
<view>员工寸照</view>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-text">
|
||||
<view class="info-inputs">
|
||||
<input type="text" v-model="name" placeholder="姓名"/>
|
||||
</view>
|
||||
<view class="info-inputs">
|
||||
<input type="number" v-model="phone" placeholder="手机号码"/>
|
||||
</view>
|
||||
<view class="info-inputs">
|
||||
<input type="text" v-model="job" placeholder="职业"/>
|
||||
</view>
|
||||
<view class="info-inputs">
|
||||
<picker :range="section" range-key="name" :value="sectionIndex" @change="pickerChange">
|
||||
<view class="picker-text">
|
||||
{{section[sectionIndex].name}}
|
||||
<uni-icons class="icon" type="arrowdown" color="#555"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="jurisdiction switch">
|
||||
<view class="item">
|
||||
<label>
|
||||
<view class="item-title">设为推荐</view>
|
||||
<view class="item-info">设为推荐员工将在企业自媒体中优先展示</view>
|
||||
<switch class="item-switch" :checked="isPosition" color="#e93340" @change="switchChange" />
|
||||
</label>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 权限设置 -->
|
||||
<view class="title">权限设置</view>
|
||||
<view class="jurisdiction">
|
||||
<checkbox-group @change="permissionChange">
|
||||
<view class="item" v-for="(item, index) in permissions" :key="index">
|
||||
<label>
|
||||
<view class="item-title">{{item.title}}</view>
|
||||
<view class="item-info">{{item.description}}</view>
|
||||
<checkbox class="item-checkbox" :checked="item.check" color="#e93340" :value="item.permission_id" />
|
||||
</label>
|
||||
</view>
|
||||
</checkbox-group>
|
||||
</view>
|
||||
<!-- 按钮 -->
|
||||
<view class="add-btns">
|
||||
<button size="default" @click="onAddEmployees">{{type === 'PUT' ? '修改': '添加'}}</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { employeesConfig, addEmployees, employeesInfo, employeesPut } from '@/apis/interfaces/employees'
|
||||
import { uploads } from '@/apis/interfaces/uploading'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
type : '',
|
||||
loging : true,
|
||||
section : [],
|
||||
permissions : [],
|
||||
permissionIds: [],
|
||||
sectionIndex : 0,
|
||||
cover : {
|
||||
showpath : '',
|
||||
path : ''
|
||||
},
|
||||
name : '',
|
||||
phone : '',
|
||||
job : '',
|
||||
isPosition : false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
if(this.$Route.query.type === 'PUT'){
|
||||
this.type = 'PUT'
|
||||
uni.setNavigationBarTitle({
|
||||
title: '编辑员工'
|
||||
})
|
||||
}
|
||||
employeesConfig().then(res => {
|
||||
this.section = res.store
|
||||
if(this.$Route.query.type === 'PUT'){
|
||||
employeesInfo(this.$Route.query.id || 4).then(res => {
|
||||
let permissionIds = []
|
||||
for(let val of res.permission){
|
||||
if(val.check){
|
||||
permissionIds.push(val.permission_id)
|
||||
}
|
||||
}
|
||||
this.permissions = res.permission
|
||||
this.sectionIndex = this.section.findIndex(val => val.store_id == res.store.store_id)
|
||||
this.permissionIds= permissionIds
|
||||
this.name = res.name
|
||||
this.phone = res.mobile
|
||||
this.job = res.job
|
||||
this.cover = res.cover
|
||||
this.isPosition = res.is_position
|
||||
this.loging = false
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}else{
|
||||
this.permissions = res.permissions
|
||||
this.loging = false
|
||||
}
|
||||
})
|
||||
},
|
||||
methods:{
|
||||
// 设为推荐
|
||||
switchChange(e){
|
||||
this.isPosition = e.detail.value
|
||||
},
|
||||
// 选择部门
|
||||
pickerChange(e){
|
||||
this.sectionIndex = e.detail.value
|
||||
},
|
||||
// 权限选择
|
||||
permissionChange(e){
|
||||
this.permissionIds = e.detail.value
|
||||
},
|
||||
// 上传照片
|
||||
updCover(){
|
||||
uni.chooseImage({
|
||||
crop: {width: 229, height: 320},
|
||||
success: path=> {
|
||||
uploads([{
|
||||
uri : path.tempFilePaths[0]
|
||||
}]).then(res => {
|
||||
this.cover = {
|
||||
showpath: res.url[0],
|
||||
path : res.path[0]
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 添加员工
|
||||
onAddEmployees(){
|
||||
let data = {
|
||||
name : this.name,
|
||||
mobileNo : this.phone,
|
||||
job : this.job,
|
||||
cover : this.cover.path,
|
||||
position : this.isPosition ? 1: 0,
|
||||
order : 0,
|
||||
store_id : this.section[this.sectionIndex].store_id,
|
||||
permission : this.permissionIds
|
||||
}
|
||||
let submitAdd = this.type == 'PUT' ? employeesPut(this.$Route.query.id, data) : addEmployees(data)
|
||||
|
||||
submitAdd.then(res => {
|
||||
uni.showModal({
|
||||
title : '提示',
|
||||
content : res,
|
||||
showCancel : false,
|
||||
success : () => {
|
||||
this.$Router.back()
|
||||
}
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content{
|
||||
min-height: 100vh;
|
||||
@extend .ios-bottom;
|
||||
.title{
|
||||
padding: ($padding/2) $padding;
|
||||
color: $text-gray;
|
||||
}
|
||||
.jurisdiction{
|
||||
background: white;
|
||||
&.switch{
|
||||
margin-top: $margin;
|
||||
}
|
||||
.item{
|
||||
position: relative;
|
||||
padding: $padding 150rpx $padding $padding;
|
||||
&::after{
|
||||
position: absolute;
|
||||
left: $padding;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: 1rpx;
|
||||
content: " ";
|
||||
background: $border-color;
|
||||
}
|
||||
&:last-child::after{
|
||||
display: none;
|
||||
}
|
||||
.item-checkbox{
|
||||
position: absolute;
|
||||
right: $padding;
|
||||
top: 50%;
|
||||
height: 40rpx;
|
||||
margin-top: -27rpx;
|
||||
}
|
||||
.item-switch{
|
||||
position: absolute;
|
||||
right: $padding;
|
||||
top: 50%;
|
||||
height: 40rpx;
|
||||
margin-top: -27rpx;
|
||||
}
|
||||
.item-title{
|
||||
font-size: $title-size;
|
||||
padding-bottom: $margin/3;
|
||||
}
|
||||
.item-info{
|
||||
font-size: $title-size-m;
|
||||
color: $text-gray;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 基础信息
|
||||
.info-card{
|
||||
background: white;
|
||||
padding: $padding;
|
||||
position: relative;
|
||||
min-height: 238rpx;
|
||||
.cover{
|
||||
position: absolute;
|
||||
top: $padding;
|
||||
left: $padding;
|
||||
background: #f8f8f8;
|
||||
width: 229rpx;
|
||||
height: 320rpx;
|
||||
.cover-add{
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
image{
|
||||
width: 229rpx;
|
||||
height: 320rpx;
|
||||
}
|
||||
image.cover-default{
|
||||
width: 128rpx;
|
||||
}
|
||||
color: $text-gray-m;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
}
|
||||
.info-text{
|
||||
padding-left: $padding + 229;
|
||||
.info-inputs{
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
border-bottom: solid 1rpx $border-color;
|
||||
input{
|
||||
height: 80rpx;
|
||||
}
|
||||
.picker-text{
|
||||
position: relative;
|
||||
padding-right: 80rpx;
|
||||
.icon{
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 添加按钮
|
||||
.add-btns{
|
||||
padding: $padding;
|
||||
button[size='default']{
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background: $text-price;
|
||||
font-size: $title-size;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
260
pages/employees/list.vue
Normal file
260
pages/employees/list.vue
Normal file
@@ -0,0 +1,260 @@
|
||||
<template>
|
||||
<view class="ios-bottom" v-if="!loding">
|
||||
<view class="header-flex">
|
||||
员工数量 {{total}} 人
|
||||
<view class="add-btn" @click="addEmployees">添加员工</view>
|
||||
</view>
|
||||
<!-- 员工列表 -->
|
||||
<uni-collapse v-if="lists.length > 0">
|
||||
<block v-for="(listItem, listIndex) in lists" :key="listIndex">
|
||||
<uni-collapse-item :show-animation="true" :open="listIndex === 0">
|
||||
<template v-slot:title>
|
||||
<view class="collapse-title">{{listItem.name}}</view>
|
||||
</template>
|
||||
<block v-if="listItem.data.length > 0">
|
||||
<view class="employees-border" v-for="(item, index) in listItem.data" :key="index">
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action-item :rightOptions="options" @click="onEmployees($event, listIndex, index)">
|
||||
<view class="employees-item">
|
||||
<view class="cover">
|
||||
<block v-if="item.user.avatar === ''">{{item.name.slice(0,1)}}</block>
|
||||
<block v-else>
|
||||
<image class="cover-img" :src="item.user.avatar" mode="aspectFill"></image>
|
||||
</block>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="nickname nowrap">{{item.name}}<text>{{item.job}}</text></view>
|
||||
<view class="job nowrap">
|
||||
<text v-for="(permissionItem, permissionIndex) in item.permission" :key="permissionIndex">{{permissionItem}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-swipe-action-item>
|
||||
</uni-swipe-action>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<view class="employees-null">店铺暂无员工</view>
|
||||
</block>
|
||||
</uni-collapse-item>
|
||||
</block>
|
||||
</uni-collapse>
|
||||
<view v-else class="list-null">
|
||||
<image class="icon" src="@/static/icons/listnull-icon.png" mode="widthFix" />
|
||||
<view class="sub-title">暂未添加员工</view>
|
||||
<view class="sub-btn" @click="$Router.push({name: 'employeesAdd'})">添加员工</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { employees, employeesDelete } from '@/apis/interfaces/employees'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loding : true,
|
||||
lists : [],
|
||||
total : 0,
|
||||
options : [{
|
||||
text : '编辑',
|
||||
type : 'PUT',
|
||||
style : {
|
||||
backgroundColor: '#3688ee'
|
||||
}
|
||||
},{
|
||||
text : '删除',
|
||||
type : 'DELETE',
|
||||
style : {
|
||||
backgroundColor: '#e93340'
|
||||
}
|
||||
}]
|
||||
};
|
||||
},
|
||||
onShow(){
|
||||
employees().then(res => {
|
||||
this.lists = res.data
|
||||
this.total = res.total
|
||||
this.loding = false
|
||||
})
|
||||
},
|
||||
methods:{
|
||||
// 编辑,删除
|
||||
onEmployees(e, upIndex, index){
|
||||
let type = e.content.type,
|
||||
val = this.lists[upIndex].data[index]
|
||||
if(type == 'PUT'){
|
||||
this.$Router.push({name: 'addEmployees', params: {type: 'PUT', id: val.employee_id}})
|
||||
return
|
||||
}
|
||||
uni.showModal({
|
||||
title : '提示',
|
||||
content : '删除后无法恢复,确定删除员工[' + val.name + ']吗?',
|
||||
cancelText : '取消',
|
||||
cancelColor : '#555',
|
||||
confirmText : '确认',
|
||||
confirmColor: '#e93340',
|
||||
success : res => {
|
||||
if(res.confirm) {
|
||||
employeesDelete(val.employee_id).then(res => {
|
||||
uni.showToast({
|
||||
title: res,
|
||||
icon : 'none'
|
||||
})
|
||||
this.lists[upIndex].data.splice(index, 1)
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 添加员工
|
||||
addEmployees(){
|
||||
if(this.lists.length <= 0){
|
||||
uni.showModal({
|
||||
title : '提示',
|
||||
content : '暂未创建门店,无法添加员工',
|
||||
cancelText : '稍后创建',
|
||||
cancelColor : '#555',
|
||||
confirmText : '立即创建',
|
||||
confirmColor: '#e93340',
|
||||
success : res => {
|
||||
if(res.confirm) {
|
||||
this.$Router.push({name: 'shopCreate'})
|
||||
}
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
this.$Router.push({name: 'employeesAdd'})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.collapse-title{
|
||||
padding: 0 $padding;
|
||||
line-height: 90rpx;
|
||||
font-weight: bold;
|
||||
font-size: $title-size-lg;
|
||||
}
|
||||
.employees-item {
|
||||
background: white;
|
||||
padding: ($padding - 10) $padding;
|
||||
position: relative;
|
||||
&::before {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: $padding + 98;
|
||||
right: 0;
|
||||
content: ' ';
|
||||
height: 1rpx;
|
||||
background: $border-color;
|
||||
}
|
||||
.cover {
|
||||
position: absolute;
|
||||
top: $padding - 10;
|
||||
left: $padding;
|
||||
background: $text-price;
|
||||
color: white;
|
||||
height: 88rpx;
|
||||
width: 88rpx;
|
||||
line-height: 88rpx;
|
||||
text-align: center;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
font-size: $title-size-lg;
|
||||
.cover-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
.content {
|
||||
height: 88rpx;
|
||||
padding-left: 108rpx;
|
||||
.nickname{
|
||||
line-height: 40rpx;
|
||||
font-size: $title-size;
|
||||
padding-bottom: 10rpx;
|
||||
text{
|
||||
font-size: $title-size-sm;
|
||||
color: $text-gray-m;
|
||||
padding-left: 10rpx;
|
||||
}
|
||||
}
|
||||
.job{
|
||||
line-height: 38rpx;
|
||||
text{
|
||||
background-color: $border-color-lg;
|
||||
color: $text-gray;
|
||||
padding: 0 10rpx;
|
||||
line-height: 38rpx;
|
||||
margin-left: $margin/2;
|
||||
display: inline-block;
|
||||
&:first-child{
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 空提示
|
||||
.list-null{
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
background: white;
|
||||
padding-bottom: 20vh;
|
||||
@extend .vertical;
|
||||
.sub-title{
|
||||
color: $text-gray;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
.icon{
|
||||
width: 288rpx;
|
||||
}
|
||||
.sub-btn{
|
||||
width: 200rpx;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
text-align: center;
|
||||
background: $mian-color;
|
||||
color: white;
|
||||
display: inline-block;
|
||||
margin-top: $margin*2;
|
||||
}
|
||||
}
|
||||
.employees-null{
|
||||
text-align: center;
|
||||
line-height: 10vh;
|
||||
padding-bottom: $padding;
|
||||
font-size: $title-size-m;
|
||||
color: $text-gray;
|
||||
}
|
||||
|
||||
// 添加员工header
|
||||
.header-flex{
|
||||
background: white;
|
||||
padding: ($padding/2) $padding;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: $margin - 10;
|
||||
line-height: 60rpx;
|
||||
color: $text-gray;
|
||||
.add-btn{
|
||||
background: $mian-color;
|
||||
color: white;
|
||||
width: 150rpx;
|
||||
text-align: center;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,51 +1,60 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<!-- 水晶获得公告 -->
|
||||
<view class="notice" v-if="notice.length >= 1">
|
||||
<swiper class="notice-swiper" :vertical="true" autoplay circular>
|
||||
<swiper-item v-for="(item, index) in notice" :key="index">
|
||||
<view class="notice-item">
|
||||
<image class="notice-cover" :src="item.avatar" mode="aspectFill"></image>
|
||||
<view class="notice-title ellipsis">{{item.nickname}} {{item.title}} {{item.amount}}</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
<!-- 账户余额 -->
|
||||
<view class="info">
|
||||
<view class="info-number">
|
||||
<image class="number-background number-rotate" src="@/static/background/chain-back-01.png" />
|
||||
<view class="info-content webkit-box">
|
||||
<view class="text">{{isAuth ? '持有原石量': '恒量发行原石量'}}<uni-icons class="help-icon" @click="showHelp('occ')" type="help-filled" size="18" color="#fff" /></view>
|
||||
<view class="number">{{occ}}</view>
|
||||
<view class="login" @click="$Router.push({name: 'Login'})" v-if="!isAuth">立即登录</view>
|
||||
<view class="login" @click="openWallet" v-else>我的钱包</view>
|
||||
<view class="total">
|
||||
<view class="item nowrap"><image src="@/static/icons/gemstone-icon.png"/>能量球 99</view>
|
||||
<view class="item nowrap"><image src="@/static/icons/crystal-icon.png"/>能量碎片 11</view>
|
||||
</view>
|
||||
<!-- 矿机 -->
|
||||
<view class="ore">
|
||||
<image class="ore-back" src="@/static/background/chain-back-00.png" mode="widthFix"></image>
|
||||
<view class="ball">
|
||||
<view class="shadow"></view>
|
||||
</view>
|
||||
<view class="ore-lists">
|
||||
<view class="oct-float ore-item" v-for="(item, index) in crystalArr" :key="index" @click="ledCrystal(index)">
|
||||
<block v-if="item.amount !== null">
|
||||
<image src="/static/imgs/crystal-ore-icon.png" mode="widthFix" class="icon" />
|
||||
<view class="text">能量碎片{{ item.amount || '-'}}</view>
|
||||
</block>
|
||||
</view>
|
||||
<navigator url="../index/index" open-type="switchTab" hover-class="none" class="oct-float ore-item-nav">
|
||||
<image src="/static/imgs/gemstone-ore-icon.png" mode="widthFix" class="icon" />
|
||||
<view class="text">购物<uni-icons type="arrowright" color="#FFFFFF" size="14"></uni-icons></view>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 公告信息 -->
|
||||
<!-- <view class="increase">今日消费100元,预计原石单价增长0.1%</view> -->
|
||||
<!-- 任务分类 -->
|
||||
<scroll-view class="task-block" scroll-x="true">
|
||||
<view class="item" v-for="(item, index) in categoryArr" :key="index" @click="JumpUrl(item.url, item.title)">
|
||||
<view class="text">{{ item.remark }}</view>
|
||||
<view class="icon">
|
||||
<image :src="item.cover" />
|
||||
</view>
|
||||
<view class="title">{{ item.title }}</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- 平台概况 -->
|
||||
<view class="situation">
|
||||
<view class="header">
|
||||
<view class="header-item">
|
||||
<view class="title">平台原石余量<uni-icons class="help-icon" @click="showHelp('occBalance')" type="help-filled" size="18" color="#009b69" /></view>
|
||||
<view class="title">平台原石余量<uni-icons class="help-icon" @click="showHelp('occBalance')" type="help-filled" size="18" color="rgba(255,255,255,.3)" /></view>
|
||||
<view class="number ellipsis">{{ occBalance }}</view>
|
||||
</view>
|
||||
<view class="header-item">
|
||||
<view class="title">昨日瓜分水晶<uni-icons class="help-icon" @click="showHelp('yesterdayCrystal')" type="help-filled" size="18" color="#009b69" /></view>
|
||||
<view class="title">昨日瓜分水晶<uni-icons class="help-icon" @click="showHelp('yesterdayCrystal')" type="help-filled" size="18" color="rgba(255,255,255,.3)" /></view>
|
||||
<view class="number ellipsis">{{ yesterdayCrystal }}</view>
|
||||
</view>
|
||||
<view class="header-item">
|
||||
<view class="title">区块链高度<uni-icons class="help-icon" @click="showHelp('blockHeight')" type="help-filled" size="18" color="#009b69" /></view>
|
||||
<view class="title">区块链高度<uni-icons class="help-icon" @click="showHelp('blockHeight')" type="help-filled" size="18" color="rgba(255,255,255,.3)" /></view>
|
||||
<view class="number ellipsis">{{ blockHeight }}</view>
|
||||
</view>
|
||||
<view class="header-item">
|
||||
<view class="title">平台累计盈利额<uni-icons class="help-icon" @click="showHelp('gain')" type="help-filled" size="18" color="#009b69" /></view>
|
||||
<view class="title">平台累计盈利额<uni-icons class="help-icon" @click="showHelp('gain')" type="help-filled" size="18" color="rgba(255,255,255,.3)" /></view>
|
||||
<view class="number ellipsis">{{ gain }}</view>
|
||||
</view>
|
||||
<view class="header-item">
|
||||
<view class="title">已开通节点数<uni-icons class="help-icon" @click="showHelp('nodeNumber')" type="help-filled" size="18" color="#009b69" /></view>
|
||||
<view class="title">已开通节点数<uni-icons class="help-icon" @click="showHelp('nodeNumber')" type="help-filled" size="18" color="rgba(255,255,255,.3)" /></view>
|
||||
<view class="number ellipsis">{{ nodeNumber }}</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -93,11 +102,10 @@
|
||||
import F2 from '@/uni_modules/lime-f2/components/lime-f2/f2.min.js'
|
||||
import lF2 from '@/uni_modules/lime-f2/components/lime-f2/'
|
||||
export default {
|
||||
components: {
|
||||
lF2
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
crystalArr : [],
|
||||
categoryArr : [],
|
||||
occs: {},
|
||||
blockHeight: 0,
|
||||
occBalance: 0,
|
||||
@@ -125,8 +133,8 @@
|
||||
// 求助信息
|
||||
showHelp(type) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: this.helpToast[type],
|
||||
title: '提示',
|
||||
content: this.helpToast[type],
|
||||
showCancel: false
|
||||
})
|
||||
},
|
||||
@@ -179,6 +187,7 @@
|
||||
// occ信息
|
||||
getOcc(){
|
||||
occ().then(res => {
|
||||
console.log(res)
|
||||
this.occs = res.occs
|
||||
this.yesterdayCrystal = res.yesterday_crystal
|
||||
this.occ = res.occ
|
||||
@@ -190,7 +199,10 @@
|
||||
if(res.help_toast) this.helpToast = res.help_toast
|
||||
this.showCartc(res.movements)
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 绘制图表
|
||||
@@ -264,154 +276,100 @@
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 气泡漂浮 */
|
||||
.number-float{
|
||||
/* 星球旋转 */
|
||||
.ball{
|
||||
position: absolute;
|
||||
height: 480rpx;
|
||||
width: 480rpx;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-top: -240rpx;
|
||||
margin-left: -240rpx;
|
||||
border-radius: 50%;
|
||||
-webkit-transform-style: preserve-3d;
|
||||
background: url(/static/background/chain-back-02.png) repeat-x;
|
||||
background-size: auto 100%;
|
||||
-webkit-animation: move-map 30s infinite linear;
|
||||
-moz-animation: move-map 30s infinite linear;
|
||||
-o-animation: move-map 30s infinite linear;
|
||||
-ms-animation: move-map 30s infinite linear;
|
||||
animation: move-map 30s infinite linear;
|
||||
box-shadow: 0 0 50rpx 50rpx rgba(31,25,34, .2);
|
||||
}
|
||||
.shadow{
|
||||
position: absolute;
|
||||
top: 1%;
|
||||
left: 5%;
|
||||
width: 90%;
|
||||
height: 90%;
|
||||
border-radius: 50%;
|
||||
filter: blur(5px);
|
||||
z-index: 3;
|
||||
background: radial-gradient(circle at 50% 0, rgba(255,255,255, .6) , rgba(255, 255, 255, .0) 58%);
|
||||
}
|
||||
.ball:before,
|
||||
.ball::after{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
content: "";
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
filter: blur(5px);
|
||||
z-index: 2;
|
||||
}
|
||||
.ball:before {
|
||||
background: radial-gradient(circle at 100% 50%, #5881d3 , rgba(255, 255, 255, .0) 45%);
|
||||
}
|
||||
.ball::after {
|
||||
background: radial-gradient(circle at 0 50%, #ca66e0 , rgba(255, 255, 255, .0) 45%);
|
||||
}
|
||||
@-webkit-keyframes move-map {
|
||||
0% {background-position: -1250rpx 0; }
|
||||
100% {background-position: 0 0;}
|
||||
}
|
||||
@-ms-keyframes move-map {
|
||||
0% {background-position: -1250rpx 0; }
|
||||
100% {background-position: 0 0;}
|
||||
}
|
||||
|
||||
@keyframes move-map {
|
||||
0% {background-position: -1250rpx 0; }
|
||||
100% {background-position: 0 0;}
|
||||
}
|
||||
|
||||
/* 水晶漂浮动画 */
|
||||
.oct-float {
|
||||
animation: 4s octfloat infinite;
|
||||
}
|
||||
@keyframes octfloat{
|
||||
0%{
|
||||
@keyframes octfloat {
|
||||
0% {
|
||||
margin-top: 0;
|
||||
}
|
||||
50%{
|
||||
|
||||
50% {
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
100%{
|
||||
|
||||
100% {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
/* 背景旋转 */
|
||||
.number-rotate{
|
||||
animation: 30s octrotate infinite linear;
|
||||
}
|
||||
@keyframes octrotate{
|
||||
from{
|
||||
transform:rotate(0deg);
|
||||
}
|
||||
to{
|
||||
transform:rotate(360deg);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss">
|
||||
// 背景
|
||||
<style lang="scss" scoped>
|
||||
.content{
|
||||
background: $mian-color-deep;
|
||||
min-height: 100vh;
|
||||
padding-top: var(--status-bar-height);
|
||||
box-sizing: border-box;
|
||||
background-image: url(@/static/background/chain-back-00.png);
|
||||
background-size: 100%;
|
||||
background-position: top center;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
// 求助icon
|
||||
.help-icon{
|
||||
vertical-align: middle;
|
||||
margin-bottom: 4px;
|
||||
margin-left: $margin/2;
|
||||
opacity: .7;
|
||||
}
|
||||
// 原石账户
|
||||
.info{
|
||||
margin-top: calc(#{$margin * 2} + 60rpx);
|
||||
padding: var(--status-bar-height) $padding * 2 $padding * 3;
|
||||
text-align: center;
|
||||
.info-number{
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 568rpx;
|
||||
height: 568rpx;
|
||||
.number-background{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.info-content{
|
||||
position: absolute;
|
||||
top: 12%;
|
||||
left: 12%;
|
||||
width: 76%;
|
||||
height: 76%;
|
||||
background-image: url(@/static/background/chain-back-02.png);
|
||||
background-size: cover;
|
||||
color: white;
|
||||
.text{
|
||||
font-size: $title-size-m;
|
||||
text-shadow: 2rpx 2rpx 0 rgba($color: $mian-color-deep, $alpha: .5);
|
||||
}
|
||||
.number{
|
||||
font-weight: bold;
|
||||
font-size: $title-size + 8;
|
||||
line-height: 70rpx;
|
||||
text-shadow: 2rpx 2rpx 0 rgba($color: $mian-color-deep, $alpha: .5);
|
||||
}
|
||||
.login{
|
||||
margin-top: $margin;
|
||||
background-color: $mian-color;
|
||||
display: inline-block;
|
||||
padding: ( $padding / 2 ) $padding;
|
||||
font-size: $title-size-m;
|
||||
border-radius: 30rpx;
|
||||
border:solid 1rpx $mian-color-deep;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 预计增长
|
||||
.increase{
|
||||
margin: 0 ($margin + $margin / 2) ($margin * 2);
|
||||
background: rgba($color: $mian-color, $alpha: .1);
|
||||
text-align: center;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
font-size: $title-size-m;
|
||||
color: $mian-color;
|
||||
border-radius: $radius-sm;
|
||||
padding: 0 $padding;
|
||||
}
|
||||
// 公告信息
|
||||
.notice{
|
||||
position: fixed;
|
||||
top: $margin * 2;
|
||||
left: $margin + $margin / 2;
|
||||
right: $margin + $margin / 2;
|
||||
padding-top: var(--status-bar-height);
|
||||
z-index: 99;
|
||||
.notice-swiper{
|
||||
height: 60rpx;
|
||||
}
|
||||
.notice-item{
|
||||
position: relative;
|
||||
height: 60rpx;
|
||||
padding-left: 80rpx;
|
||||
padding-right: $padding * 2;
|
||||
display: inline-block;
|
||||
background: rgba($color: $mian-color-deep, $alpha: .3);
|
||||
border-radius: 30rpx;
|
||||
box-sizing: border-box;
|
||||
max-width: 100%;
|
||||
.notice-cover{
|
||||
position: absolute;
|
||||
height: 60rpx;
|
||||
width: 60rpx;
|
||||
left: 0;
|
||||
top: 0;
|
||||
background-color: $mian-color-deep;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.notice-title{
|
||||
line-height: 60rpx;
|
||||
color: white;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
}
|
||||
min-height: calc(100vh - 60px);
|
||||
background: #1f1922;
|
||||
overflow: hidden;
|
||||
}
|
||||
// 平台概况
|
||||
.situation{
|
||||
margin: 0 ($margin + $margin / 2);
|
||||
background-image: linear-gradient(to bottom, rgba($color: $mian-color, $alpha: .1), $mian-color-deep);
|
||||
border-radius: $radius-sm;
|
||||
padding: $padding;
|
||||
margin: 0 $margin;
|
||||
background-image: linear-gradient(to bottom, $block-color, #1f1922);
|
||||
border-radius: $radius;
|
||||
padding: $padding $padding/2 $padding*2;
|
||||
// 平台统计
|
||||
.header{
|
||||
display: flex;
|
||||
@@ -419,23 +377,22 @@
|
||||
margin-bottom: $margin*2;
|
||||
.number{
|
||||
color: white;
|
||||
font-size: $title-size + 4;
|
||||
font-size: $title-size;
|
||||
padding-top: $padding/2;
|
||||
font-weight: bold;
|
||||
line-height: 90rpx;
|
||||
}
|
||||
.title{
|
||||
color: $mian-color;
|
||||
font-weight: bold;
|
||||
color: rgba($color: white, $alpha: .4);
|
||||
font-size: $title-size-sm;
|
||||
}
|
||||
.header-item{
|
||||
width: 50%;
|
||||
padding: $padding $padding / 2;
|
||||
padding: $padding / 2;
|
||||
box-sizing: border-box;
|
||||
&:first-child{
|
||||
width: 100%;
|
||||
.number{
|
||||
font-size: $title-size + 10;
|
||||
font-size: $title-size;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -446,12 +403,12 @@
|
||||
flex-wrap: wrap;
|
||||
margin: 0 -$margin / 2;
|
||||
.node-item{
|
||||
background: rgba($color: $mian-color, $alpha: .2);
|
||||
background: rgba($color: $block-color, $alpha: .8);
|
||||
width: calc(50% - #{$margin});
|
||||
margin: $margin / 2;
|
||||
padding: $padding;
|
||||
box-sizing: border-box;
|
||||
border-radius: $radius-sm;
|
||||
border-radius: $radius/2;
|
||||
}
|
||||
.number{
|
||||
font-size: $title-size + 4;
|
||||
@@ -459,21 +416,20 @@
|
||||
color: white;
|
||||
}
|
||||
.title{
|
||||
font-size: $title-size-m;
|
||||
font-weight: bold;
|
||||
color: rgba($color: white, $alpha: .7);
|
||||
font-size: $title-size-sm;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
// 图表
|
||||
.chart{
|
||||
background: rgba($color: $mian-color, $alpha: .2);
|
||||
background: rgba($color: $block-color, $alpha: .8);
|
||||
padding: $padding;
|
||||
border-radius: $radius-sm;
|
||||
margin-top: $margin*2;
|
||||
border-radius: $radius/2;
|
||||
margin-top: $margin;
|
||||
.title{
|
||||
text-align: center;
|
||||
line-height: 80rpx;
|
||||
color: rgba($color: $mian-color, $alpha: 1.0);
|
||||
color: white;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
.chart-f2{
|
||||
@@ -481,4 +437,137 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
// 数据统计
|
||||
.total {
|
||||
position: relative;
|
||||
margin: $margin;
|
||||
background: #2b2449;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
border-radius: $radius;
|
||||
.item {
|
||||
width: 50%;
|
||||
padding: 0 $padding;
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-size: $title-size-sm;
|
||||
line-height: 76rpx;
|
||||
image{
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
vertical-align: top;
|
||||
margin-top: calc((76rpx - 38rpx) / 2);
|
||||
margin-right: $margin / 2;
|
||||
}
|
||||
}
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
content: "";
|
||||
width: 2rpx;
|
||||
left: 50%;
|
||||
background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, .7), transparent);
|
||||
}
|
||||
}
|
||||
// 求助icon
|
||||
.help-icon{
|
||||
vertical-align: middle;
|
||||
margin-left: $margin/3;
|
||||
opacity: .7;
|
||||
}
|
||||
// 矿石
|
||||
.ore {
|
||||
position: relative;
|
||||
padding-top: 120%;
|
||||
&>image {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
.ore-lists {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
.oct-float-item{
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
.text {
|
||||
margin-top: $margin / 2;
|
||||
color: white;
|
||||
font-size: $title-size-sm;
|
||||
line-height: 40rpx;
|
||||
text-shadow: 0 3rpx 3rpx rgba($color: #000000, $alpha: .2);
|
||||
}
|
||||
.icon {
|
||||
width: 58rpx;
|
||||
vertical-align: top;
|
||||
}
|
||||
}
|
||||
.ore-item-nav{
|
||||
@extend .oct-float-item;
|
||||
right: $margin * 3;
|
||||
top: 12%;
|
||||
}
|
||||
.ore-item {
|
||||
@extend .oct-float-item;
|
||||
&:nth-child(1) { top: 16%; left: 13%; }
|
||||
&:nth-child(2) { top: 50%; right: 10%; }
|
||||
&:nth-child(3) { top: 23%; right: 20%; }
|
||||
&:nth-child(4) { top: 70%; left: 33%;}
|
||||
&:nth-child(5) { top: 40%; left: 20%; }
|
||||
&:nth-child(6) { top: 58%; left: 10%;}
|
||||
&:nth-child(7) { top: 10%; right: 43%;}
|
||||
&:nth-child(8) { top: 46%; right: 29%;}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 任务
|
||||
.task-block {
|
||||
white-space: nowrap;
|
||||
.item {
|
||||
background: rgba($color: $mian-color, $alpha: .2);
|
||||
display: inline-block;
|
||||
margin-left: $margin;
|
||||
width: 210rpx;
|
||||
padding: $padding * 2 $padding;
|
||||
border-radius: $radius;
|
||||
box-sizing: 0 0 4rpx 4rpx rgba($color: #000000, $alpha: .06);
|
||||
text-align: center;
|
||||
&:first-child {
|
||||
margin-left: $margin + $margin/2;
|
||||
}
|
||||
&:last-child {
|
||||
margin-right: $margin + $margin/2;
|
||||
}
|
||||
.icon {
|
||||
display: inline-block;
|
||||
margin: $margin 0;
|
||||
width: 98rpx;
|
||||
height: 98rpx;
|
||||
line-height: 98rpx;
|
||||
background: $mian-color-deep;
|
||||
border-radius: 50%;
|
||||
text-align: center;
|
||||
image {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
.text {
|
||||
font-size: $title-size-m;
|
||||
color: $mian-color;
|
||||
}
|
||||
.title {
|
||||
font-size: $title-size;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
249
pages/instrument/Spread.vue
Normal file
249
pages/instrument/Spread.vue
Normal file
@@ -0,0 +1,249 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<view class="codeContent">
|
||||
<image class="codeContent-back" src="../../static/icons/store_codeBack.png" mode="widthFix"></image>
|
||||
<image class="codeContent-cont" src="../../static/icons/store_contBack.png" mode="widthFix"></image>
|
||||
<view class="textContent">
|
||||
<view class="company">
|
||||
<image class="company-logo" :src="companyInfo.cover" mode="aspectFill"></image>
|
||||
<view class="company-cont">
|
||||
<view class="nowrap company-name">{{companyInfo.name}}</view>
|
||||
<view class="company-tips">易货平台</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="code">
|
||||
<image class="code-img" :src="companyInfo.code" mode="aspectFit"></image>
|
||||
<!-- <view class="code-text">简单扫一扫,即可进入平台</view> -->
|
||||
</view>
|
||||
<!-- @click="shareCanvas" -->
|
||||
<view class="codeBnt">
|
||||
扫码推广
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<canvas class="codeImg" canvas-id="qrcodeCard"></canvas>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { companiesCode } from '@/apis/interfaces/store'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
companyInfo : ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
companiesCode().then(res=>{
|
||||
this.companyInfo = res
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 绘制图片
|
||||
shareCanvas(e){
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
})
|
||||
|
||||
// 下载头像
|
||||
let avatarImg = new Promise(success=>{
|
||||
uni.getImageInfo({
|
||||
src : this.companyInfo.cover,
|
||||
success : res => {
|
||||
success(res.path)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// 下载二维码
|
||||
let codeImg = new Promise(success => {
|
||||
uni.getImageInfo({
|
||||
src : this.companyInfo.code,
|
||||
success : res => {
|
||||
success(res.path)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Promise.all([avatarImg, codeImg]).then(res => {
|
||||
// 绘制海报
|
||||
const ctx = uni.createCanvasContext('qrcodeCard')
|
||||
ctx.save()
|
||||
|
||||
// 绘制背景图片
|
||||
ctx.drawImage('../../static/icons/store_downBack', 0, 0, 375, 603)
|
||||
|
||||
// 绘制头像
|
||||
ctx.drawImage(res[0], 0, 0, 60, 60)
|
||||
|
||||
// 绘制二维码
|
||||
ctx.drawImage(res[1], 140, 250, 110, 110)
|
||||
|
||||
// 文字
|
||||
ctx.setFontSize(16)
|
||||
ctx.fillText(this.companyInfo.name, 194, 180 , 270)
|
||||
|
||||
ctx.setFontSize(16)
|
||||
ctx.fillText('邀请你加入易货平台', 194, 180 , 270)
|
||||
|
||||
ctx.save();
|
||||
ctx.beginPath(); //开始绘制
|
||||
ctx.arc(50 / 2 + 170, 50 / 2 + 110, 50 / 2, 0, Math.PI * 2, false);
|
||||
ctx.clip();
|
||||
|
||||
// 保存图片
|
||||
ctx.draw(true, () => {
|
||||
uni.hideLoading()
|
||||
uni.canvasToTempFilePath({
|
||||
canvasId: 'qrcodeCard',
|
||||
x: 0,
|
||||
y: 0,
|
||||
success: res => {
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: res.tempFilePath,
|
||||
success : res=>{
|
||||
if (res.errMsg == "saveImageToPhotosAlbum:ok"){
|
||||
uni.showToast({
|
||||
title: '分享海报已保存至相册',
|
||||
icon : 'none'
|
||||
})
|
||||
}else{
|
||||
uni.hideLoading()
|
||||
}
|
||||
},
|
||||
fail : err=>{
|
||||
if (err.errMsg == "saveImageToPhotosAlbum:fail auth deny"){
|
||||
uni.showModal({
|
||||
title : '提示',
|
||||
content : '暂未授权小程序写入您的相册,无法存储二维码海报',
|
||||
confirmColor: '#d82526',
|
||||
confirmText : '去设置',
|
||||
success : res=>{
|
||||
if (res.confirm){
|
||||
uni.openSetting()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
}).catch(err=>{
|
||||
uni.showToast({
|
||||
title: '海报下载,请检查网络',
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
background-color: #e93340;
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.codeContent {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
.codeContent-back {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
}
|
||||
.codeContent-cont {
|
||||
left: 5%;
|
||||
width: 90%;
|
||||
top: 100px;
|
||||
z-index: 2;
|
||||
position: absolute;
|
||||
}
|
||||
.codeContent-tips {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 20rpx;
|
||||
width: 200rpx;
|
||||
z-index: 2;
|
||||
}
|
||||
.textContent {
|
||||
position: absolute;
|
||||
padding: 20rpx 20rpx 0 40rpx;
|
||||
box-sizing: border-box;
|
||||
width: 70%;
|
||||
z-index: 3;
|
||||
left: 15%;
|
||||
right: 15%;
|
||||
top: 140px;
|
||||
}
|
||||
.company {
|
||||
width: 100%;
|
||||
.company-logo {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.company-cont {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 230rpx;
|
||||
left: 0;
|
||||
top: 0;
|
||||
padding: 20rpx 20rpx 30rpx 210rpx;
|
||||
font-size: $title-size;
|
||||
.company-name {
|
||||
font-weight: 600;
|
||||
margin: 10rpx 0;
|
||||
}
|
||||
.company-tips {
|
||||
font-size: 26rpx;
|
||||
color: #787878;
|
||||
}
|
||||
}
|
||||
}
|
||||
.code {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: $margin;
|
||||
.code-img {
|
||||
width: 90%;
|
||||
}
|
||||
.code-text {
|
||||
color: #787878;
|
||||
margin-top: $margin - 10;
|
||||
font-size: $title-size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.codeBnt {
|
||||
background-color: #e1293f;
|
||||
text-align: center;
|
||||
border-radius: 10rpx;
|
||||
line-height: 90rpx;
|
||||
font-weight: 600;
|
||||
font-size: $title-size;
|
||||
color: #FFFFFF;
|
||||
box-shadow: 4rpx 0 10rpx rgba(155,0,19,.5);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* canvas */
|
||||
.codeImg {
|
||||
position: absolute;
|
||||
left: -1000%;
|
||||
height: 603px;
|
||||
width: 375px;
|
||||
background: white;
|
||||
}
|
||||
</style>
|
||||
249
pages/news/detail.vue
Normal file
249
pages/news/detail.vue
Normal file
@@ -0,0 +1,249 @@
|
||||
<template>
|
||||
<view class="News-detail" v-if="loaded">
|
||||
<view class="item" v-for="(item,index) in items" :key="index" v-if="items.length>0"
|
||||
@click="item.read_at === ''?read(index,item):noread(item)">
|
||||
<view class="top">
|
||||
<image src="/static/images/news_2_1.png" mode="widthFix"></image>
|
||||
<!-- <image v-if="index===1" src="/static/img/news_1_1.png" mode="widthFix"></image>
|
||||
<image v-if="index===2" src="/static/img/news_3_1.png" mode="widthFix"></image> -->
|
||||
<view :style="item.read_at=== '' ?'flex:1;':'flex:1;color:#808080;'">{{item.title}}</view>
|
||||
</view>
|
||||
<view class="des">{{item.content}}</view>
|
||||
<view class="time">{{item.created_at}}</view>
|
||||
<view class="read_at" v-if="item.read_at === ''"></view>
|
||||
</view>
|
||||
<no-list v-if="items.length === 0" name='no-new1' txt="空空如也~" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
notificationsList,
|
||||
notificationsDetail,
|
||||
notificationsReaded
|
||||
} from '@/apis/interfaces/news.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
items: [],
|
||||
page: 1,
|
||||
has_more: true,
|
||||
loaded: false
|
||||
};
|
||||
},
|
||||
onLoad(e) {
|
||||
this.type = e.type
|
||||
this.notificationsList()
|
||||
},
|
||||
onReachBottom() {
|
||||
this.notificationsList()
|
||||
},
|
||||
// 右侧全部已读
|
||||
onNavigationBarButtonTap(e) {
|
||||
// #ifdef APP-PLUS
|
||||
var currentWebview = this.$mp.page.$getAppWebview()
|
||||
var tn = currentWebview.getStyle().titleNView
|
||||
var text = tn.buttons[0].text
|
||||
if (text == '全部已读') {
|
||||
notificationsReaded(this.type).then(res => {
|
||||
this.items.find((item, index) => {
|
||||
this.$set(item, 'read_at', 'zdx')
|
||||
})
|
||||
uni.showToast({
|
||||
title: '全部已读',
|
||||
icon: 'none'
|
||||
})
|
||||
uni.setStorageSync('refresh',true)
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: 'nonde'
|
||||
})
|
||||
})
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
methods: {
|
||||
// 点击每个消息,假装查看详情,触发已读效果$set
|
||||
read(index, item) {
|
||||
let notification_id = item.notification_id
|
||||
notificationsDetail(notification_id).then(res => {
|
||||
this.$set(this.items[index], 'read_at', '已读已读')
|
||||
uni.setStorageSync('refresh',true)
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: 'nonde'
|
||||
})
|
||||
})
|
||||
if (item.url) {
|
||||
switch (item.url.openType) {
|
||||
case 'web':
|
||||
// #ifdef APP-PLUS
|
||||
plus.runtime.openURL(item.url.url)
|
||||
return
|
||||
// #endif
|
||||
window.location.href = item.url.url
|
||||
break;
|
||||
case 'navigateTo':
|
||||
uni.navigateTo({
|
||||
url: item.url.path
|
||||
})
|
||||
break;
|
||||
case 'switchTab':
|
||||
uni.switchTab({
|
||||
url: item.url.path
|
||||
})
|
||||
break;
|
||||
default:
|
||||
uni.showToast({
|
||||
title: '活动过期,请联系系统管理员',
|
||||
icon: 'none'
|
||||
})
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 消息列表
|
||||
notificationsList() {
|
||||
if (this.has_more) {
|
||||
notificationsList(this.type, {
|
||||
page: this.page
|
||||
}).then(res => {
|
||||
this.items = this.items.concat(res.data)
|
||||
if (res.page.has_more) {
|
||||
this.page = this.page + 1
|
||||
}
|
||||
this.has_more = res.page.has_more
|
||||
this.loaded = true
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: 'nonde'
|
||||
})
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '没有更多啦~',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
noread(item) {
|
||||
if(item.url){
|
||||
switch (item.url.openType) {
|
||||
case 'web':
|
||||
// #ifdef APP-PLUS
|
||||
plus.runtime.openURL(item.url.url)
|
||||
return
|
||||
// #endif
|
||||
window.location.href = item.url.url
|
||||
break;
|
||||
case 'navigateTo':
|
||||
uni.navigateTo({
|
||||
url: item.url.path
|
||||
})
|
||||
break;
|
||||
case 'switchTab':
|
||||
uni.switchTab({
|
||||
url: item.url.path
|
||||
})
|
||||
break;
|
||||
default:
|
||||
uni.showToast({
|
||||
title: '活动过期,请联系系统管理员',
|
||||
icon: 'none'
|
||||
})
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: '哎呦,已经读过了~',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.News-detail {
|
||||
min-height: 100vh;
|
||||
width: 100%;
|
||||
padding: 0 $padding*1.5 $padding*1.5 $padding*1.5;
|
||||
box-sizing: border-box;
|
||||
|
||||
|
||||
.item {
|
||||
background-color: #fff;
|
||||
padding: $padding*1.5;
|
||||
box-shadow: 0 0 40rpx 2rpx rgba(0, 0, 0, 0.1);
|
||||
border-radius: $radius-m;
|
||||
margin-top: $padding*1.5;
|
||||
position: relative;
|
||||
|
||||
.top {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
color: #353535;
|
||||
font-weight: bold;
|
||||
border-bottom: solid 1rpx #f8f8f8;
|
||||
padding-bottom: $padding*1.3;
|
||||
|
||||
image {
|
||||
width: 42rpx;
|
||||
margin-right: $padding;
|
||||
}
|
||||
|
||||
span {
|
||||
font-size: $title-size;
|
||||
}
|
||||
}
|
||||
|
||||
.des {
|
||||
font-size: $title-size-m;
|
||||
padding-top: $padding;
|
||||
color: #808080;
|
||||
}
|
||||
|
||||
.time {
|
||||
color: #999;
|
||||
font-size: $title-size*0.9;
|
||||
padding-top: $padding*0.9;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 无消息
|
||||
.no-news {
|
||||
font-size: $title-size-m;
|
||||
color: #666;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
|
||||
image {
|
||||
width: 70%;
|
||||
margin: $padding*7 0 $margin*3 0;
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
.read_at {
|
||||
background-color: red;
|
||||
width: 14rpx;
|
||||
height: 14rpx;
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
right: 20rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
</style>
|
||||
179
pages/news/index.vue
Normal file
179
pages/news/index.vue
Normal file
@@ -0,0 +1,179 @@
|
||||
<template>
|
||||
<view class="News">
|
||||
<view class="list" v-for="(item,index) in items" :key="index" v-if="items.length>0">
|
||||
<navigator class="item" open-type="navigate" hover-class="none" :url="'/pages/news/detail?type='+item.type">
|
||||
<view class="left">
|
||||
<image class="img" v-if='item.type ==="SystemNotification"' :src="item.icon?item.icon:'/static/imgs/news_1.png'" mode="aspectFill"></image>
|
||||
<image class="img" v-if='item.type ==="OrderNotification"' :src="item.icon?item.icon:'/static/imgs/news_2.png'" mode="aspectFill"></image>
|
||||
<image class="img" v-if='item.type ==="CouponNotification"' :src="item.icon?item.icon:'/static/imgs/news_3.png'" mode="aspectFill"></image>
|
||||
<view class="content">
|
||||
<view class="title">{{item.name}}</view>
|
||||
<view class="des">{{item.title || '暂无任何未读消息'}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="num" v-if="item.count>0">{{item.count}}</view>
|
||||
</navigator>
|
||||
</view>
|
||||
<view class="no-news" v-else>
|
||||
<image src="/static/img/no-news.png" mode="widthFix"></image>
|
||||
暂时没有收到任何消息~
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
notificationsType,
|
||||
notificationsDelete
|
||||
} from '@/apis/interfaces/news.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
items: [],
|
||||
editShow: false
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
this.notificationsType()
|
||||
},
|
||||
// 右侧编辑按钮触发事件
|
||||
onNavigationBarButtonTap(e) {
|
||||
let that = this
|
||||
let index = e.index
|
||||
// 按钮文字的改变所需
|
||||
// #ifdef APP-PLUS
|
||||
let currentWebview = that.$mp.page.$getAppWebview()
|
||||
let tn = currentWebview.getStyle().titleNView
|
||||
let text = tn.buttons[0].text
|
||||
if (text == '全部清空') {
|
||||
uni.showModal({
|
||||
title: '是否确认清空全部消息',
|
||||
content: '确认清空',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
notificationsDelete().then(res => {
|
||||
that.notificationsType()
|
||||
uni.showToast({
|
||||
title: '全部清除啦~',
|
||||
icon: 'none'
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
methods: {
|
||||
notificationsType() {
|
||||
notificationsType().then(res => {
|
||||
this.items = res
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: 'nonde'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.News {
|
||||
height: 100vh;
|
||||
// #ifdef APP-PLUS
|
||||
min-height: calc(100vh - 20rpx);
|
||||
// #endif
|
||||
width: 100%;
|
||||
// background-color: pink;
|
||||
|
||||
// 无消息
|
||||
.no-news {
|
||||
font-size: $title-size-m;
|
||||
color: #666;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
|
||||
image {
|
||||
width: 70%;
|
||||
margin-top: $padding*7;
|
||||
}
|
||||
}
|
||||
|
||||
// 消息列表
|
||||
.list {
|
||||
width: 94%;
|
||||
margin-left: 3%;
|
||||
|
||||
.item {
|
||||
margin-top: 20rpx;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
padding: $padding*1.5;
|
||||
background-color: #fff;
|
||||
border-radius: $radius*0.6;
|
||||
box-sizing: 0 0 20rpx 40rpx rgba(0, 0, 0, 0.3);
|
||||
|
||||
.left {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
flex: 1;
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
padding: 0 $padding*0.5;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
margin-right: $padding*1.2;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: $title-size-m*1.1;
|
||||
margin-bottom: $padding*0.5;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.des {
|
||||
font-size: $title-size-m*0.9;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.num {
|
||||
background-color: $mian-color;
|
||||
color: #fff;
|
||||
border-radius: 50%;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: $title-size*.8;
|
||||
padding: $padding*0.3;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -33,20 +33,28 @@
|
||||
<u-icon name="arrow-right" color="#f1f1f1" size="28" />
|
||||
</button>
|
||||
<!-- 个人认证 -->
|
||||
<view @click="certification(is_certification)" class="list-item">
|
||||
<view @click="certificationClick(certification)" class="list-item">
|
||||
<view class="list-item-left">
|
||||
<image src="/static/imgs/self-icon.png" mode="widthFix" />
|
||||
<span>个人认证</span>
|
||||
</view>
|
||||
<u-icon name="arrow-right" color="#f1f1f1" size="28" />
|
||||
<view class="input">
|
||||
<input type="text" :value="certification.is_true?'已认证':''"
|
||||
:placeholder="certification.is_true?'':'未认证'" disabled="true" maxlength="12" />
|
||||
<u-icon name="arrow-right" color="#f1f1f1" size="28" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- 企业认证 -->
|
||||
<view @click="company(is_company)" class="list-item">
|
||||
<view @click="company(companyCode.code)" class="list-item">
|
||||
<view class="list-item-left">
|
||||
<image src="/static/imgs/company-icon.png" mode="widthFix" />
|
||||
<span>企业认证</span>
|
||||
</view>
|
||||
<u-icon name="arrow-right" color="#f1f1f1" size="28" />
|
||||
<view class="input">
|
||||
<input type="text" :value="companyCode.code=== 1?'已认证':''"
|
||||
:placeholder="companyCode.code !== 1?companyCode.message:''" disabled="true" maxlength="12" />
|
||||
<u-icon name="arrow-right" color="#f1f1f1" size="28" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- 关于我们 -->
|
||||
<view @click="$router.push({name:'aboutUs'})" class="list-item">
|
||||
@@ -80,7 +88,8 @@
|
||||
import {
|
||||
wechatbind,
|
||||
resetUserInfo,
|
||||
getUserSettingInfo
|
||||
getUserSettingInfo,
|
||||
companyStatus
|
||||
} from '@/apis/interfaces/setting'
|
||||
import {
|
||||
uploads
|
||||
@@ -96,8 +105,8 @@
|
||||
showPath: ''
|
||||
},
|
||||
is_bind: true, // 微信绑定
|
||||
is_certification: true, // 个人认证
|
||||
is_company: true, // 企业认证
|
||||
certification: {}, // 个人认证
|
||||
companyCode: {}, // 企业认证 -1.未认证,0.审核中,1.审核通过,2.驳回
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
@@ -107,38 +116,59 @@
|
||||
}
|
||||
})
|
||||
this.getUserInfo()
|
||||
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.getUserInfo()
|
||||
},
|
||||
methods: {
|
||||
// 是否个人认证
|
||||
certification(is_certfication) {
|
||||
console.log(is_certfication)
|
||||
if (is_certfication) {
|
||||
certificationClick(certfication) {
|
||||
console.log(certfication)
|
||||
if (certfication.is_true) {
|
||||
// 跳转到个人认证信息完成展示页面
|
||||
this.$router.push({
|
||||
name: ''
|
||||
// this.$refs.uToast.show({
|
||||
// title: '认证通过!',
|
||||
// type: 'primary',
|
||||
// duration: 3000
|
||||
// })
|
||||
uni.showModal({
|
||||
title: '认证信息',
|
||||
content: '真实姓名:<' + certfication.message.name + '>,身份证号:' + certfication.message.idcard,
|
||||
showCancel:false
|
||||
})
|
||||
} else {
|
||||
// 跳转到个人认证信息页面
|
||||
this.$router.push({
|
||||
name: ''
|
||||
uni.navigateTo({
|
||||
url: '/pages/certification/personal'
|
||||
})
|
||||
}
|
||||
},
|
||||
// 是否展示企业信息
|
||||
company(is_company) {
|
||||
console.log(is_company)
|
||||
if (is_company) {
|
||||
// 跳转到企业认证完成信息展示页面
|
||||
this.$router.push({
|
||||
name: ''
|
||||
})
|
||||
} else {
|
||||
// 是否展示企业信息 企业认证 -1.未认证,0.审核中,1.审核通过,2.驳回
|
||||
company(code) {
|
||||
console.log(code, '是否企业认证')
|
||||
if (code === -1) {
|
||||
// 跳转到企业认证页面
|
||||
this.$router.push({
|
||||
name: ''
|
||||
uni.navigateTo({
|
||||
url: '/pages/company/approve'
|
||||
})
|
||||
} else if (code === 2) {
|
||||
// 跳转到企业认证页面
|
||||
uni.navigateTo({
|
||||
url: '/pages/company/approve?form_type=put'
|
||||
})
|
||||
} else if (code === 0) {
|
||||
this.$refs.uToast.show({
|
||||
title: '审核中',
|
||||
type: 'primary',
|
||||
duration: 3000
|
||||
})
|
||||
} else if (code === 1) {
|
||||
// 跳转到企业认证页面
|
||||
this.$refs.uToast.show({
|
||||
title: '认证通过!',
|
||||
type: 'primary',
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -148,8 +178,7 @@
|
||||
this.avatar.showPath = res.avatar
|
||||
this.nickname = res.nickname
|
||||
this.is_bind = res.is_bind
|
||||
this.is_certification = res.is_certification
|
||||
this.is_company = res.is_company
|
||||
this.certification = res.certification
|
||||
uni.stopPullDownRefresh()
|
||||
}).catch(err => {
|
||||
this.$refs.uToast.show({
|
||||
@@ -158,6 +187,17 @@
|
||||
duration: 3000
|
||||
})
|
||||
})
|
||||
// -1.未认证,0.审核中,1.审核通过,2.驳回
|
||||
companyStatus().then(res => {
|
||||
console.log(res)
|
||||
this.companyCode = res
|
||||
}).catch(err => {
|
||||
this.$refs.uToast.show({
|
||||
title: err.message,
|
||||
type: 'primary',
|
||||
duration: 3000
|
||||
})
|
||||
})
|
||||
},
|
||||
// 点击绑定用户得授权信息,且绑定带修改
|
||||
getUser() {
|
||||
@@ -385,8 +425,9 @@
|
||||
flex: 1;
|
||||
|
||||
input {
|
||||
padding-right: 30rpx;
|
||||
padding-right: 20rpx;
|
||||
width: 100%;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
327
pages/shop/create.vue
Normal file
327
pages/shop/create.vue
Normal file
@@ -0,0 +1,327 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="create-form">
|
||||
<view class="header">
|
||||
<view @click="updLogo">
|
||||
<image class="logo" style="border: none;" v-if="cover.showpath" :src="cover.showpath" mode="aspectFill" />
|
||||
<image class="logo" v-else src="@/static/icons/add-icon.png" mode="aspectFill" />
|
||||
</view>
|
||||
<view class="inputs">
|
||||
<input type="text" v-model="name" placeholder="门店/部门名称" />
|
||||
</view>
|
||||
<view class="inputs">
|
||||
<input type="number" v-model="mobile" placeholder="门店联系电话" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="inputs">
|
||||
<label class="inputs-label">开店时间</label>
|
||||
<picker mode="time" @change="pickerTime" :value="startTime" data-key="startTime">
|
||||
<view class="time-text">
|
||||
{{startTime || '选择开店时间'}}
|
||||
<uni-icons class="time-icon" type="arrowdown" size="18" color="#999"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="inputs">
|
||||
<label class="inputs-label">闭店时间</label>
|
||||
<picker mode="time" @change="pickerTime" :value="endTime" data-key="endTime">
|
||||
<view class="time-text">
|
||||
{{endTime || '选择闭店时间'}}
|
||||
<uni-icons class="time-icon" type="arrowdown" size="18" color="#999"></uni-icons>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="inputs addrss-input">
|
||||
<label class="inputs-label">门店地址</label>
|
||||
<textarea class="inputs-textarea" v-model="address" placeholder="输入门店地址" auto-height/>
|
||||
<view class="addrss-icon" @click="onLocation">
|
||||
<uni-icons type="location-filled" size="20" color="#c82626"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="inputs">
|
||||
<label class="inputs-label">门店简介</label>
|
||||
<textarea class="inputs-textarea" v-model="description" placeholder="门店简介..." />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="create-btns">
|
||||
<button class="item-btn btn-submit" type="default" @click="createShop">{{type === 'add' ? '创建': '保存'}}</button>
|
||||
<button class="item-btn btn-delete" type="default" @click="onDeleteShop" v-if="type === 'edit'">删除</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { create, putShop, deleteShop, editInfo } from '@/apis/interfaces/shop'
|
||||
import { uploads } from '@/apis/interfaces/uploading'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
type : 'add',
|
||||
id : '',
|
||||
cover : {
|
||||
showpath: '',
|
||||
path : '',
|
||||
},
|
||||
name : '',
|
||||
mobile : '',
|
||||
address : '',
|
||||
startTime : '',
|
||||
endTime : '',
|
||||
description : '',
|
||||
latitude : '',
|
||||
longitude : ''
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
if(this.$Route.query.id){
|
||||
this.type = 'edit'
|
||||
this.getInfo()
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
// 获取编辑信息
|
||||
getInfo(){
|
||||
editInfo(this.$Route.query.id).then(res => {
|
||||
this.id = res.store_id
|
||||
this.cover = res.cover
|
||||
this.name = res.name
|
||||
this.mobile = res.mobile
|
||||
this.address = res.address
|
||||
this.startTime = res.start_time
|
||||
this.endTime = res.end_time
|
||||
this.description= res.description
|
||||
this.latitude = res.latitude
|
||||
this.longitude = res.longitude
|
||||
})
|
||||
},
|
||||
// 获取地址
|
||||
onLocation(){
|
||||
uni.chooseLocation({
|
||||
success: res => {
|
||||
this.address = res.address
|
||||
this.longitude = res.longitude
|
||||
this.latitude = res.latitude
|
||||
},
|
||||
fail: err => {
|
||||
uni.showToast({
|
||||
title: err,
|
||||
icon : 'none'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 选择营业时间
|
||||
pickerTime(e){
|
||||
this[e.target.dataset.key] = e.detail.value
|
||||
},
|
||||
// 编辑创建
|
||||
createShop(){
|
||||
let data = {
|
||||
cover : this.cover.path,
|
||||
name : this.name,
|
||||
mobile : this.mobile,
|
||||
address : this.address,
|
||||
latitude : this.latitude,
|
||||
longitude : this.longitude,
|
||||
description : this.description,
|
||||
start_time : this.startTime,
|
||||
end_time : this.endTime
|
||||
}
|
||||
|
||||
if(this.type === 'edit'){
|
||||
putShop(this.id, {...data}).then(res => {
|
||||
uni.showModal({
|
||||
title : '提示',
|
||||
content : res,
|
||||
showCancel : false,
|
||||
success : modalRes => {
|
||||
this.$Router.back()
|
||||
}
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
return
|
||||
}
|
||||
create({...data}).then(res => {
|
||||
uni.showModal({
|
||||
title : '提示',
|
||||
content : res,
|
||||
showCancel : false,
|
||||
success : modalRes => {
|
||||
this.$Router.back()
|
||||
}
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 删除门店
|
||||
onDeleteShop(){
|
||||
deleteShop(this.id).then(res => {
|
||||
uni.showModal({
|
||||
title : '提示',
|
||||
content : res,
|
||||
showCancel : false,
|
||||
success : modalRes => {
|
||||
this.$Router.back()
|
||||
}
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 上传logo
|
||||
updLogo(){
|
||||
uni.chooseImage({
|
||||
crop: { width: 188, height: 188 },
|
||||
success: path => {
|
||||
uploads([{
|
||||
name: 'logo',
|
||||
uri : path.tempFilePaths[0]
|
||||
}]).then(res => {
|
||||
this.cover = {
|
||||
showpath: res.url[0],
|
||||
path: res.path[0]
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon : 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 门店信息
|
||||
.create-form{
|
||||
.header{
|
||||
position: relative;
|
||||
background: white;
|
||||
padding-left: $padding + 150;
|
||||
.logo{
|
||||
width: 108rpx;
|
||||
height: 108rpx;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
left: $padding;
|
||||
top: 26rpx;
|
||||
border: dashed 2rpx $border-color;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.inputs{
|
||||
position: relative;
|
||||
padding-right: $padding;
|
||||
input,
|
||||
.time-text{
|
||||
line-height: 80rpx;
|
||||
height: 80rpx;
|
||||
font-size: $title-size-lg;
|
||||
}
|
||||
&::after{
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
content: " ";
|
||||
height: 1rpx;
|
||||
background: $border-color;
|
||||
}
|
||||
&:last-child::after{
|
||||
display: none;
|
||||
}
|
||||
.time-text{
|
||||
padding-right: 80rpx;
|
||||
.time-icon{
|
||||
position: absolute;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: right;
|
||||
width: 80rpx;
|
||||
right: $padding;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.info{
|
||||
@extend .header;
|
||||
margin-top: $margin;
|
||||
padding-left: 0;
|
||||
background: white;
|
||||
.inputs{
|
||||
padding-left: $padding + 150;
|
||||
.inputs-label{
|
||||
position: absolute;
|
||||
left: $padding;
|
||||
top: 0;
|
||||
font-size: $title-size-lg;
|
||||
line-height: 80rpx;
|
||||
height: 80rpx;
|
||||
width: 150rpx;
|
||||
}
|
||||
.inputs-textarea{
|
||||
width: 100%;
|
||||
padding: 20rpx 0;
|
||||
height: 160rpx;
|
||||
font-size: $title-size-lg;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
&.addrss-input{
|
||||
padding-right: $padding + 100;
|
||||
.addrss-icon{
|
||||
position: absolute;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: right;
|
||||
width: 80rpx;
|
||||
right: $padding;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 按钮组
|
||||
.create-btns{
|
||||
padding: $padding;
|
||||
.item-btn{
|
||||
border-radius: 0;
|
||||
background: white;
|
||||
font-size: $title-size;
|
||||
line-height: 90rpx;
|
||||
height: 90rpx;
|
||||
&::after{
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
.btn-submit{
|
||||
background: $text-price;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
margin-bottom: $margin;
|
||||
}
|
||||
.btn-delete{
|
||||
border: solid 1rpx $border-color;
|
||||
color: $text-gray;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
120
pages/shop/lists.vue
Normal file
120
pages/shop/lists.vue
Normal file
@@ -0,0 +1,120 @@
|
||||
<template>
|
||||
<view class="lists">
|
||||
<block v-if="lists.length > 0">
|
||||
<view class="lists-item" v-for="(item, index) in lists" :key="index" @click="$Router.push({name: 'shopCreate', params: { id: item.store_id }})">
|
||||
<view class="header">
|
||||
<image class="logo" :src="item.cover" mode="aspectFill"></image>
|
||||
<view class="title">{{item.name}}</view>
|
||||
<view class="time"><text>营业时间{{item.start_time}} 至 {{item.end_time}}</text></view>
|
||||
<view class="icons">
|
||||
<uni-icons type="arrowright" color="#999" size="18"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="address">店铺地址:{{item.address}}</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<view class="list-null">
|
||||
<image class="icon" src="@/static/icons/approve-icon.png" mode="widthFix"></image>
|
||||
<view class="sub-title">暂未创建店铺/部门</view>
|
||||
<view class="sub-btn" @click="$Router.push({name: 'shopCreate'})">创建</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { shops } from '@/apis/interfaces/shop'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
lists: []
|
||||
};
|
||||
},
|
||||
onShow(){
|
||||
shops().then(res => {
|
||||
console.log(res)
|
||||
this.lists = res.data
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
// 空提示
|
||||
.list-null{
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
padding-bottom: 20vh;
|
||||
box-sizing: border-box;
|
||||
background: white;
|
||||
text-align: center;
|
||||
@extend .vertical;
|
||||
.sub-title{
|
||||
color: $text-gray;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
.icon{
|
||||
width: 288rpx;
|
||||
}
|
||||
.sub-btn{
|
||||
width: 200rpx;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
text-align: center;
|
||||
background: $mian-color;
|
||||
color: white;
|
||||
display: inline-block;
|
||||
margin-top: $margin*2;
|
||||
}
|
||||
}
|
||||
// 列表
|
||||
.lists-item{
|
||||
background: white;
|
||||
margin: $margin;
|
||||
border-radius: $radius/2;
|
||||
padding: $padding;
|
||||
.header{
|
||||
position: relative;
|
||||
padding-left: 128rpx;
|
||||
padding-right: 100rpx;
|
||||
min-height: 108rpx;
|
||||
padding-bottom: $padding - 10;
|
||||
.logo{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 108rpx;
|
||||
height: 108rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.title{
|
||||
line-height: 60rpx;
|
||||
font-size: $title-size;
|
||||
font-weight: bold;
|
||||
}
|
||||
.time{
|
||||
line-height: 40rpx;
|
||||
font-size: $title-size-sm;
|
||||
text{
|
||||
background-color: $border-color-lg;
|
||||
color: $text-gray;
|
||||
padding: 0 $padding/2;
|
||||
}
|
||||
}
|
||||
.icons{
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
line-height: 108rpx;
|
||||
}
|
||||
}
|
||||
.address{
|
||||
border-top: solid 1rpx $border-color;
|
||||
padding-top: $padding - 10;
|
||||
font-size: $title-size-m;
|
||||
color: $text-gray;
|
||||
left: 50rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -127,7 +127,7 @@
|
||||
<view class="withdraw-name">
|
||||
当前能量球价值<view class="withdraw-number">¥0.00</view>
|
||||
</view>
|
||||
<view class="withdraw-btn">
|
||||
<view class="withdraw-btn" @click="$Router.push({name: 'Extract'})">
|
||||
去提现
|
||||
</view>
|
||||
</view>
|
||||
@@ -136,12 +136,12 @@
|
||||
我的资产
|
||||
</view>
|
||||
<view class="assets-list" v-if="userData.account">
|
||||
<view class="assets-label">
|
||||
<view class="assets-label-name">能量球钱包<image @click="showHelp('wallet')" class="assets-label-icon" src="/static/user/userAssets_tips.png"></image></view>
|
||||
<view class="assets-label" @click="$Router.push({name:'walletProperty'})">
|
||||
<view class="assets-label-name">能量球钱包<image @click.stop="showHelp('wallet')" class="assets-label-icon" src="/static/user/userAssets_tips.png"></image></view>
|
||||
<view class="assets-label-number">{{userData.account.coins || 0}}</view>
|
||||
</view>
|
||||
<view class="assets-label">
|
||||
<view class="assets-label-name">能量碎片<image @click="showHelp('chip')" class="assets-label-icon" src="/static/user/userAssets_tips.png"></image></view>
|
||||
<view class="assets-label" @click="$Router.push({name:'Fragment'})">
|
||||
<view class="assets-label-name">能量碎片<image @click.stop="showHelp('chip')" class="assets-label-icon" src="/static/user/userAssets_tips.png"></image></view>
|
||||
<view class="assets-label-number">{{userData.account.score || 0}}</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -183,7 +183,7 @@
|
||||
<image class="tool-label-img" src="/static/user/userTool-01.png" mode=""></image>
|
||||
<view class="tool-label-name">优惠券管理</view>
|
||||
</view>
|
||||
<view class="tool-label" @click="$Router.push({name: ''})">
|
||||
<view class="tool-label" @click="$Router.push({name: 'instrumentSpread'})">
|
||||
<image class="tool-label-img" src="/static/user/userTool-02.png" mode=""></image>
|
||||
<view class="tool-label-name">营销推广码</view>
|
||||
</view>
|
||||
@@ -191,14 +191,18 @@
|
||||
<image class="tool-label-img" src="/static/user/userTool-03.png" mode=""></image>
|
||||
<view class="tool-label-name">基础信息</view>
|
||||
</view>
|
||||
<view class="tool-label">
|
||||
<view class="tool-label" @click="$Router.push({name: 'shopLists'})">
|
||||
<image class="tool-label-img" src="/static/user/userTool-04.png" mode=""></image>
|
||||
<view class="tool-label-name">部门门店</view>
|
||||
</view>
|
||||
<view class="tool-label" @click="$Router.push({name: ''})">
|
||||
<view class="tool-label" @click="$Router.push({name: 'employeesList'})">
|
||||
<image class="tool-label-img" src="/static/user/userTool-05.png" mode=""></image>
|
||||
<view class="tool-label-name">员工管理</view>
|
||||
</view>
|
||||
<!-- <view class="tool-label" @click="$Router.push({name: 'verificationIndex'})">
|
||||
<image class="tool-label-img" src="/static/user/userTool-05.png" mode=""></image>
|
||||
<view class="tool-label-name">扫码核销</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@
|
||||
width: calc(100% - 60rpx);
|
||||
height: 360rpx;
|
||||
background-image: linear-gradient(to left, #076cff, #076cff);
|
||||
box-shadow: 0 10rpx 20rpx 0rpx rgba($color: $main-color, $alpha: 0.4);
|
||||
box-shadow: 0 10rpx 20rpx 0rpx rgba($color: $mian-color, $alpha: 0.4);
|
||||
margin: 0 30rpx;
|
||||
border-radius: 20rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
65
pages/wallet/add.vue
Normal file
65
pages/wallet/add.vue
Normal file
@@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<view class="content webkit-box">
|
||||
<!-- logo -->
|
||||
<image class="logo" src="@/static/img/oc-logo.png" mode="widthFix"></image>
|
||||
<!-- 副标题 -->
|
||||
<view class="sub-title">激活您的OC Chain区块链钱包地址。</br>地址可以理解为您的个人银行卡卡号,与他人转账时是区块链上两个地址的交易行为</view>
|
||||
<!-- 按钮 -->
|
||||
<navigator class="wallet-btn" url="./mnemonic" open-type="redirect">激活钱包</navigator>
|
||||
<!-- <navigator class="wallet-btn hollow" url="./guide">导入钱包</navigator> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background-color: white;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content{
|
||||
position: relative;
|
||||
height: 100vh;
|
||||
padding: 0 15vw;
|
||||
text-align: center;
|
||||
.logo{
|
||||
width: 138rpx;
|
||||
vertical-align: top;
|
||||
margin-bottom: 30vh;
|
||||
}
|
||||
.sub-title{
|
||||
font-size: $title-size-m;
|
||||
color: $text-gray;
|
||||
}
|
||||
.wallet-btn{
|
||||
width: 100%;
|
||||
background-color: $mian-color;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
margin-top: $margin * 2;
|
||||
border-radius: $radius-lg;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
font-size: $title-size;
|
||||
&.hollow{
|
||||
background-color: white;
|
||||
color: $mian-color;
|
||||
border:solid 2rpx $mian-color;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
50
pages/wallet/cmsWithDraw.vue
Normal file
50
pages/wallet/cmsWithDraw.vue
Normal file
@@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="clauseCont">
|
||||
<rich-text :nodes="clauseData"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
cmsWithdraw
|
||||
} from '@/apis/interfaces/wallet.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
clauseData: [] //服务条款
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
// 获取服务条款
|
||||
this.clauseInfo()
|
||||
},
|
||||
methods: {
|
||||
// 服务条款
|
||||
clauseInfo() {
|
||||
cmsWithdraw().then(res => {
|
||||
this.clauseData = res.content.replace(/\<img/gi,
|
||||
'<img style="max-width:100%; height:auto; vertical-align: top;"')
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: err.message
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: $uni-bg-color;
|
||||
}
|
||||
|
||||
.clauseCont {
|
||||
padding: $padding + 10 $padding * 2;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
136
pages/wallet/code.vue
Normal file
136
pages/wallet/code.vue
Normal file
@@ -0,0 +1,136 @@
|
||||
<template>
|
||||
<view class="webkit-box code">
|
||||
<view class="webkit-box code-content">
|
||||
<view class="sub-title">扫码转入OC COIN</view>
|
||||
<view class="code-img">
|
||||
<image :src="code" mode="widthFix" />
|
||||
</view>
|
||||
<view class="hr"></view>
|
||||
<view class="sub-title">钱包地址</view>
|
||||
<view class="hash">{{address || '-'}}</view>
|
||||
<view class="buttons">
|
||||
<button class="item red" type="default" @click="showShare()">分享</button>
|
||||
<button class="item greed" type="default" @click="copyAddress">复制</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="footer">OC CHNIA</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { code } from '@/apis/interfaces/wallet'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
address: '',
|
||||
code: ''
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
code().then(res=>{
|
||||
this.code = res.image
|
||||
this.address = res.address
|
||||
}).catch(err=>{
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: err.message
|
||||
})
|
||||
})
|
||||
},
|
||||
methods:{
|
||||
copyAddress(){
|
||||
uni.setClipboardData({
|
||||
data: this.address
|
||||
})
|
||||
},
|
||||
showShare(){
|
||||
uni.share({
|
||||
provider: 'weixin',
|
||||
title: '我正在使用ocChain钱包收款',
|
||||
scene: 'WXSceneSession',
|
||||
href: 'https://live.funnyzhibo.com/blockdownload',
|
||||
imageUrl: 'https://live.funnyzhibo.com/oc-chain.png',
|
||||
summary: '我的收款地址' + this.address
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.code{
|
||||
height: 100vh;
|
||||
background:linear-gradient(to bottom, $mian-color, $mian-color-deep);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
box-sizing: border-box;
|
||||
// 收款码
|
||||
.code-content{
|
||||
text-align: center;
|
||||
background: white;
|
||||
margin: 0 8vw;
|
||||
border-radius: $radius;
|
||||
padding: $padding * 2;
|
||||
height: 70vh;
|
||||
box-shadow: 0 0 6rpx 6rpx rgba($color: #000000, $alpha: .02);
|
||||
box-sizing: border-box;
|
||||
.sub-title{
|
||||
font-size: $title-size + 8;
|
||||
}
|
||||
.code-img{
|
||||
width: 20vh;
|
||||
height: 20vh;
|
||||
margin: $margin * 3 0 $margin * 2;
|
||||
display: inline-block;
|
||||
background-image: url(../../static/background/wallet-code-background.png);
|
||||
padding: $padding;
|
||||
box-sizing: border-box;
|
||||
background-position: center;
|
||||
background-size: cover;
|
||||
image{
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.hr{
|
||||
height: 1rpx;
|
||||
background: $border-color;
|
||||
margin: $margin * 2 0;
|
||||
}
|
||||
.hash{
|
||||
word-wrap: break-word;
|
||||
font-size: $title-size;
|
||||
padding: $padding 0;
|
||||
}
|
||||
.buttons{
|
||||
display: flex;
|
||||
padding-top: $padding * 2;
|
||||
.item{
|
||||
width: 40%;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
font-size: $title-size;
|
||||
color: white;
|
||||
&::after{
|
||||
border: none;
|
||||
}
|
||||
&.red{
|
||||
background: $red-color;
|
||||
}
|
||||
&.greed{
|
||||
background: $mian-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 底部
|
||||
.footer{
|
||||
height: 10vh;
|
||||
line-height: 10vh;
|
||||
text-align: center;
|
||||
font-size: $title-size + 10;
|
||||
font-weight: bold;
|
||||
color: #58876e;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
138
pages/wallet/create.vue
Normal file
138
pages/wallet/create.vue
Normal file
@@ -0,0 +1,138 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 设置钱包密码 -->
|
||||
<view class="password">
|
||||
<view class="prompt">请设置6位数字密码。建议不要使用连续的数字。</view>
|
||||
<view class="group">
|
||||
<view class="inputs">
|
||||
<label>密码</label>
|
||||
<input type="digit" v-model="password" maxlength="6" placeholder="请设置密码" />
|
||||
</view>
|
||||
<view class="inputs">
|
||||
<label>确认密码</label>
|
||||
<input type="digit" v-model="verify" maxlength="6" placeholder="请确认密码" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 按钮 -->
|
||||
<view class="buttons">
|
||||
<button type="default" form-type="submit" @click="createWallet">确认</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
security
|
||||
} from '@/apis/interfaces/wallet'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
password: '',
|
||||
verify: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 激活钱包
|
||||
createWallet() {
|
||||
if (this.password === '' || this.verify === '') {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请设置密码'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.password !== this.verify) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '两次输入密码不一致'
|
||||
})
|
||||
return
|
||||
}
|
||||
security({
|
||||
code: this.password
|
||||
}).then(res => {
|
||||
uni.navigateBack()
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: err.message
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 副标题
|
||||
.sub-title {
|
||||
color: $text-gray;
|
||||
text-align: center;
|
||||
margin: $margin * 2 $margin;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
|
||||
// 设置密码
|
||||
.password {
|
||||
padding: 0 $padding * 2;
|
||||
|
||||
.prompt {
|
||||
margin-top: $margin * 2;
|
||||
font-size: $title-size-m;
|
||||
color: $mian-color;
|
||||
}
|
||||
|
||||
.group {
|
||||
margin-top: $margin;
|
||||
border-radius: $radius-m;
|
||||
box-shadow: 0 0 4rpx 4rpx rgba($color: $text-color, $alpha: .02);
|
||||
background-color: white;
|
||||
|
||||
.inputs {
|
||||
padding: $padding $padding + 10;
|
||||
border-bottom: solid 1rpx $border-color;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
label {
|
||||
color: $text-gray;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
|
||||
input {
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
font-size: $title-size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 按钮
|
||||
.buttons {
|
||||
padding: $padding * 2;
|
||||
|
||||
.text {
|
||||
text-align: center;
|
||||
line-height: 90rpx;
|
||||
height: 90rpx;
|
||||
margin-bottom: $margin * 2;
|
||||
font-size: $title-size-lg;
|
||||
color: $mian-color;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
button {
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
background-color: $mian-color;
|
||||
border-radius: $radius-lg;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
font-size: $title-size;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
393
pages/wallet/extract.vue
Normal file
393
pages/wallet/extract.vue
Normal file
@@ -0,0 +1,393 @@
|
||||
<template>
|
||||
<view class="WithdrawingCoin ">
|
||||
<view class="withdrawing-content">
|
||||
<view class="item-name">能量球提现至银行卡</view>
|
||||
<view class="item">
|
||||
<view style="flex: 1;">
|
||||
<input class="input_num" v-model="withdraw_input" @input='inputNum' type="number"
|
||||
placeholder-style="color:#999;font-weight:normal; font-size:30rpx;" placeholder="请输入能量球数量" />
|
||||
<view v-if="total">≈ ¥{{total}}</view>
|
||||
</view>
|
||||
<view class="all" @click="all">全部提现</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<input class="input_num" v-model="card" type="number"
|
||||
placeholder-style="color:#999;font-weight:normal; font-size:30rpx;" placeholder="请输入您要收款得银行卡卡号" />
|
||||
</view>
|
||||
<view class="item">
|
||||
<input class="input_num" v-model="name" maxlength="10"
|
||||
placeholder-style="color:#999;font-weight:normal; font-size:30rpx;" placeholder="请输入收款人姓名" />
|
||||
</view>
|
||||
<number-jpan :length="6" @closeChange="closeChange($event)" ref="numberPad"></number-jpan>
|
||||
<view class="item-total">
|
||||
<view class="total"><span>能量球总数 : {{balance}}</span><span class="money">总估值(CNY)≈¥{{(balance*price).toFixed(2)}}</span></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn" @click="open">提现至银行卡</view>
|
||||
<view class="ew_lists" v-if="withdrawLists.length>0">
|
||||
<view class="" v-for="(item,index) in withdrawLists " :key="index">
|
||||
<view class="receiptCode">
|
||||
回执单号:{{item.receipt_code}}
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="left">
|
||||
<span>能量球:{{item.total}}</span>
|
||||
<span>金额≈¥{{item.arrival}}</span>
|
||||
</view>
|
||||
<view class="right">
|
||||
<span> {{item.created_at}} 提现</span>
|
||||
<span> {{item.paid_at?item.paid_at+'到账':'努力打款中'}}</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="hasmore">
|
||||
{{has_more?'努力加载中~':'我是有底线的~'}}
|
||||
</view>
|
||||
</view>
|
||||
<no-list v-else name='no-records' txt="暂无任何提现记录哦~" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
withdraw,
|
||||
withdrawLogs,
|
||||
withdrawDo
|
||||
} from '@/apis/interfaces/wallet.js';
|
||||
import numberJpan from "@/components/numberJpan/numberJpan.vue";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
balance: 0, // 钱包能量球数量
|
||||
price: 0, // 当前能量球价格
|
||||
card: '', // 银行卡号
|
||||
name: '', // 姓名
|
||||
password: '', //
|
||||
withdraw_input: '', // 提现能量球数量
|
||||
total: '', // 提现能量球转化成的钱数
|
||||
page: 1,
|
||||
has_more: true,
|
||||
withdrawLists: [],
|
||||
};
|
||||
},
|
||||
components: {
|
||||
'number-jpan': numberJpan
|
||||
},
|
||||
onLoad() {
|
||||
this.reset()
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.withdrawLists.length > 0) {
|
||||
if (this.has_more) {
|
||||
this.withdrawLogs()
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '没有更多~',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 提现基本信息
|
||||
withdraw() {
|
||||
withdraw().then(res => {
|
||||
this.balance = Number(res.balance)
|
||||
this.price = Number(res.price)
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 提现记录
|
||||
withdrawLogs() {
|
||||
withdrawLogs({
|
||||
page: this.page
|
||||
}).then(res => {
|
||||
this.withdrawLists = this.withdrawLists.concat(res.data)
|
||||
if (res.page.has_more) {
|
||||
this.page = this.page + 1
|
||||
this.has_more = true
|
||||
} else {
|
||||
this.has_more = false
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 输入提现能量球数量
|
||||
inputNum(e) {
|
||||
let number = Number(e.detail.value)
|
||||
if (number <= this.balance) {
|
||||
this.total = Number(e.detail.value) * this.price
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '最大值能超过' + this.balance+'',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
this.withdraw_input = ''
|
||||
this.total = 0
|
||||
}
|
||||
|
||||
},
|
||||
// 点击全部
|
||||
all() {
|
||||
if (this.balance > 0) {
|
||||
this.withdraw_input = this.balance
|
||||
this.total = this.balance * this.price
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '啥也没有,我也做不到~',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
},
|
||||
// 打开密码 出发提现功能
|
||||
open() {
|
||||
if (this.total > 0) {
|
||||
let params = {
|
||||
name: this.name,
|
||||
card: this.card,
|
||||
total: this.withdraw_input
|
||||
}
|
||||
if (params.name === '' || params.card === '' || params.total === 0) {
|
||||
uni.showToast({
|
||||
title: '重新确认提现信息',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
} else {
|
||||
this.$refs.numberPad.open()
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '啥也没有,我也做不到~',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
},
|
||||
// 输入密码成功后,,,
|
||||
closeChange(e) {
|
||||
uni.showLoading({
|
||||
title: '提现中~'
|
||||
})
|
||||
let params = {
|
||||
name: this.name,
|
||||
card: this.card,
|
||||
total: this.withdraw_input,
|
||||
code: e
|
||||
}
|
||||
withdrawDo(params).then(res => {
|
||||
uni.showToast({
|
||||
title: '申请提现成功,耐心等待打款',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
this.reset()
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
})
|
||||
},
|
||||
reset() {
|
||||
this.name = ''
|
||||
this.card = ''
|
||||
this.page = 1
|
||||
this.has_more = true
|
||||
this.withdraw_input = ''
|
||||
this.total = 0
|
||||
this.withdrawLists = []
|
||||
this.withdrawLogs();
|
||||
this.withdraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page{
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
background-color: #fff;
|
||||
}
|
||||
.hasmore {
|
||||
color: #808080;
|
||||
font-size: $title-size-m;
|
||||
text-align: center;
|
||||
padding: $padding*2;
|
||||
}
|
||||
|
||||
.nomore {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
font-size: $title-size-m;
|
||||
color: #808080;
|
||||
margin-top: $margin*4;
|
||||
|
||||
image {
|
||||
width: 320rpx;
|
||||
margin-bottom: $margin*2;
|
||||
}
|
||||
}
|
||||
|
||||
.receiptCode {
|
||||
color: #808080;
|
||||
text-align: left;
|
||||
// margin: $margin 0;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
|
||||
.WithdrawingCoin {
|
||||
background-color: #fff;
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
padding-bottom: 100rpx;
|
||||
}
|
||||
|
||||
.all {
|
||||
color: $text-price;
|
||||
width: 160rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.withdrawing-content {
|
||||
min-height: 300rpx;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 30rpx 1rpx rgba($color: #000000, $alpha: 0.2);
|
||||
margin: $margin*1.4;
|
||||
border-radius: 20rpx;
|
||||
padding: $padding*1.4 ;
|
||||
font-size: $title-size-m;
|
||||
|
||||
.item-name {
|
||||
text-align: center;
|
||||
padding: $padding * .6;
|
||||
color: #303030;
|
||||
font-weight: bold;
|
||||
margin-bottom: $margin;
|
||||
font-size: $title-size *1.2;
|
||||
}
|
||||
|
||||
.item {
|
||||
border-bottom: solid 1rpx #f8f8f8;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
box-sizing: border-box;
|
||||
padding: $padding 0;
|
||||
|
||||
span:nth-child(1) {
|
||||
color: #666;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.input_num {
|
||||
font-size: $title-size*1.5;
|
||||
color: #3a3a3a;
|
||||
font-weight: bolder;
|
||||
flex: 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.item-total {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: $padding*1 0 0 0;
|
||||
color: #3a3a3a;
|
||||
|
||||
.total {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
|
||||
.money {
|
||||
padding-top: $padding *0.5;
|
||||
}
|
||||
}
|
||||
|
||||
.lists {
|
||||
color: $text-price;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.btn {
|
||||
background-image: linear-gradient(to right, #7c52fc, #976dff);
|
||||
color: #fff;
|
||||
border-radius: 10rpx;
|
||||
text-align: center;
|
||||
padding: $padding * .9 ;
|
||||
margin: $margin * 2;
|
||||
font-size: $title-size;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.ew_lists {
|
||||
padding: $padding *2;
|
||||
border-top: solid 4rpx #f8f8f8;
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
box-sizing: border-box;
|
||||
border-bottom: solid 1rpx #f8f8f8;
|
||||
background-color: #fff;
|
||||
padding: 0 0 $padding*0.8 0;
|
||||
|
||||
.left,
|
||||
.right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.left {
|
||||
font-size: $title-size-m;
|
||||
font-weight: bold;
|
||||
color: #808080;
|
||||
|
||||
span:nth-child(2) {
|
||||
color: $text-price;
|
||||
font-size: $title-size-m;
|
||||
font-weight: normal;
|
||||
padding-top: $padding *0.5;
|
||||
}
|
||||
}
|
||||
|
||||
.right {
|
||||
font-size: $title-size-m;
|
||||
align-items: flex-end;
|
||||
color: #666;
|
||||
|
||||
span:nth-child(1) {
|
||||
padding-bottom: $padding*0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
338
pages/wallet/fragment.vue
Normal file
338
pages/wallet/fragment.vue
Normal file
@@ -0,0 +1,338 @@
|
||||
<template>
|
||||
<view class="Record">
|
||||
<view class="record-top">
|
||||
<image src="/static/imgs/account-bg.png" mode="widthFix" class="record-bg" />
|
||||
<view class="record-top-nav">
|
||||
<view :class="['record-top-item',type==='year'?'selectTopItem':'']"
|
||||
@click="selectType('year')">年账单</view>
|
||||
<view :class="['record-top-item',type==='month'?'selectTopItem':'']"
|
||||
@click="selectType('month')">月账单</view>
|
||||
<view :class="['record-top-item',type==='day'?'selectTopItem':'']"
|
||||
@click="selectType('day')">日账单</view>
|
||||
</view>
|
||||
<view class="record-mouth-year">
|
||||
<view class="record-type-right">
|
||||
<view class="record-title">碎片个数</view>
|
||||
<view class="record-money">{{account || '0.00'}} <span>个</span> </view>
|
||||
</view>
|
||||
<view class="record-type-left">
|
||||
<u-picker mode="time" v-model="show" :params="params"
|
||||
@confirm ='confirm' title ='筛选日期' start-year='2021' :end-year='currentYear'/>
|
||||
<view @click="show = true">
|
||||
{{date?date:'选择日期'}}
|
||||
<uni-icons type="arrowdown" color="#fff" size="12" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="record-title">碎片个数</view>
|
||||
<view class="record-money"><span>¥</span>{{account || '0.00'}}</view> -->
|
||||
</view>
|
||||
|
||||
<!-- 列表。。。 -->
|
||||
<view class="record-list" v-if="lists.length>0">
|
||||
<view class="record-list-item" v-for="(item,index) in lists" :key='index'>
|
||||
<image src="/static/imgs/record-icon.png" mode="widthFix" class="record-icon" />
|
||||
<view class="">
|
||||
<view class="record-list-item-top">
|
||||
<view class="title ellipsis-2">完成任务获得碎片</view>
|
||||
<view class="money" >{{cointype==='in'?'+':'-'}}5</view>
|
||||
</view>
|
||||
<view class="record-list-item-date">2021-12-22 12:12:12</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 无列表 -->
|
||||
<no-list v-if="lists.length === 0" name='no-record' txt="没有任何碎片记录 ~ " />
|
||||
|
||||
<!-- <u-toast ref="uToast" /> -->
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {chaineb} from '@/apis/interfaces/mine';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
lists:[1,1.1,1,1],
|
||||
has_next_page:true,
|
||||
page:1,
|
||||
type:'year', // 统计类型day日,month月,year年
|
||||
cointype:'in',// in 收入 out 支出
|
||||
date:new Date().toISOString().slice(0,4), // 日:Y-m-d,月Y-m,年Y
|
||||
params: {
|
||||
year: true,
|
||||
month: false,
|
||||
day: false
|
||||
},
|
||||
show: false, // 显示
|
||||
currentDay:new Date().toISOString().slice(0,10),
|
||||
currentMonth:new Date().toISOString().slice(0,7),
|
||||
currentYear:new Date().toISOString().slice(0,4),
|
||||
account:''
|
||||
}
|
||||
},
|
||||
onLoad(){
|
||||
this.getList()
|
||||
},
|
||||
onReachBottom(){
|
||||
if (this.has_next_page) {
|
||||
this.page = this.page + 1
|
||||
this.getList()
|
||||
} else {
|
||||
this.$refs.uToast.show({
|
||||
title: '吼吼吼~我是有底的~',
|
||||
type: 'primary',
|
||||
duration: 3000
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 获取列表
|
||||
getList(){
|
||||
let data = {
|
||||
page:this.page,
|
||||
type:this.type,
|
||||
date:this.date,
|
||||
cointype:this.cointype
|
||||
}
|
||||
chaineb(data).then(res => {
|
||||
this.account = res.account
|
||||
this.lists = this.lists.concat(res.lists)
|
||||
this.has_next_page = res.has_next_page
|
||||
}).catch(err => {
|
||||
this.$refs.uToast.show({
|
||||
title: err.message,
|
||||
type: 'primary',
|
||||
duration: 3000
|
||||
})
|
||||
})
|
||||
},
|
||||
selectCoinType(type){
|
||||
if(this.cointype !== type){
|
||||
this.cointype = type
|
||||
this.reset()
|
||||
}
|
||||
},
|
||||
// 重置
|
||||
reset(){
|
||||
this.page = 1
|
||||
this.lists = []
|
||||
this.has_next_page = true
|
||||
this.getList()
|
||||
},
|
||||
// 选择 年 月 日 切换要重置数据
|
||||
selectType(type){
|
||||
if(this.type !== type){
|
||||
switch(type){
|
||||
case 'year':
|
||||
this.type = type
|
||||
this.params= {
|
||||
year: true,
|
||||
month: false,
|
||||
day: false
|
||||
}
|
||||
this.date = this.currentYear
|
||||
this.reset()
|
||||
break;
|
||||
case 'month':
|
||||
this.type = type
|
||||
this.params= {
|
||||
year: true,
|
||||
month: true,
|
||||
day: false
|
||||
}
|
||||
this.date = this.currentMonth
|
||||
this.reset()
|
||||
break;
|
||||
case 'day':
|
||||
this.type = type
|
||||
this.params= {
|
||||
year: true,
|
||||
month: false,
|
||||
day: false
|
||||
}
|
||||
this.date = this.currentDay
|
||||
this.reset()
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
// 点击确认按钮
|
||||
confirm(e){
|
||||
let type = this.type
|
||||
switch(type){
|
||||
case 'year':
|
||||
this.date = e.year
|
||||
this.reset()
|
||||
break;
|
||||
case 'month':
|
||||
this.date = e.year + '-' + e.month
|
||||
this.reset()
|
||||
break;
|
||||
case 'day':
|
||||
this.date = e.year + '-' + e.month + '-' + e.day
|
||||
this.reset()
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.Record {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
padding-top: 30rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.record-top {
|
||||
width: calc(100% - 60rpx);
|
||||
height: 360rpx;
|
||||
background-image: linear-gradient(to right, #7c52fc, #976dff);
|
||||
box-shadow: 0 10rpx 20rpx 0rpx rgba($color: #976dff, $alpha: 0.4);
|
||||
margin: 0 30rpx;
|
||||
border-radius: 20rpx;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
padding: 10rpx 50rpx 20rpx 50rpx;
|
||||
z-index: 1;
|
||||
|
||||
.record-bg {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
z-index: 1;
|
||||
opacity: .5;
|
||||
}
|
||||
|
||||
.record-top-nav {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
|
||||
.record-top-item {
|
||||
margin: 40rpx 20rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
}
|
||||
.selectTopItem{
|
||||
border-bottom: solid 4rpx #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.record-mouth-year {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
color: #fff;
|
||||
font-size: 30rpx;
|
||||
margin-top: 20rpx;
|
||||
|
||||
.record-type-left {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
box-sizing: border-box;
|
||||
|
||||
uni-icons {
|
||||
margin-left: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.record-type-right {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
justify-content: flex-start;
|
||||
box-sizing: border-box;
|
||||
font-size: 24rpx;
|
||||
flex: 1;
|
||||
|
||||
.pay_type_item {
|
||||
margin: 0 10rpx;
|
||||
padding: 2rpx 20rpx;
|
||||
border-radius: 30rpx;
|
||||
border: solid 1rpx rgba($color: #000000, $alpha: 0);
|
||||
}
|
||||
.pay_type_item_select{
|
||||
border: solid 1rpx #f7f7f7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.record-title {
|
||||
font-size: 28rpx;
|
||||
color: #fff;
|
||||
padding:0 0 20rpx 0;
|
||||
}
|
||||
|
||||
.record-money {
|
||||
color: #fff;
|
||||
font-size: 60rpx;
|
||||
font-weight: bold;
|
||||
|
||||
span {
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
padding-left: 20rpx;
|
||||
margin-right: 4rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.record-list {
|
||||
padding: 20rpx 30rpx;
|
||||
|
||||
.record-list-item {
|
||||
padding: 20rpx 0;
|
||||
border-bottom: solid 1rpx #f7f7f7;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
justify-content: flex-start;
|
||||
box-sizing: border-box;
|
||||
.record-icon{
|
||||
width: 60rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.record-list-item-top {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
box-sizing: border-box;
|
||||
width: 600rpx;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
width: 600rpx;
|
||||
color: #444;
|
||||
}
|
||||
|
||||
.money {
|
||||
color: #ee4c47;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.record-list-item-date {
|
||||
font-size: 26rpx;
|
||||
color: #a6a6a6;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
125
pages/wallet/guide.vue
Normal file
125
pages/wallet/guide.vue
Normal file
@@ -0,0 +1,125 @@
|
||||
<template>
|
||||
<view>
|
||||
<form>
|
||||
<!-- 副标题 -->
|
||||
<view class="sub-title">输入您的钱包助记词导入</view>
|
||||
<!-- 助记词 -->
|
||||
<view class="word">
|
||||
<textarea placeholder="输入助记词"></textarea>
|
||||
</view>
|
||||
<!-- 设置钱包密码 -->
|
||||
<view class="password">
|
||||
<view class="group">
|
||||
<view class="inputs">
|
||||
<label>钱包名称</label>
|
||||
<input type="text" placeholder="输入钱包名称" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="title">不少于8个字符。建议包含大小写,符号,特殊字符。</view>
|
||||
<view class="group">
|
||||
<view class="inputs">
|
||||
<label>密码</label>
|
||||
<input type="password" placeholder="请设置密码" />
|
||||
</view>
|
||||
<view class="inputs">
|
||||
<label>确认密码</label>
|
||||
<input type="password" placeholder="请确认密码" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 按钮 -->
|
||||
<view class="buttons">
|
||||
<view class="text">什么是助记词?</view>
|
||||
<button type="default" form-type="submit">开始导入</button>
|
||||
</view>
|
||||
</form>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 副标题
|
||||
.sub-title{
|
||||
line-height: 90rpx;
|
||||
color: $text-gray;
|
||||
text-align: center;
|
||||
margin: $margin;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
// 助记词
|
||||
.word{
|
||||
background-color: white;
|
||||
margin: $margin * 2;
|
||||
padding: $padding + 10;
|
||||
border-radius: $radius-m;
|
||||
box-shadow: 0 0 4rpx 4rpx rgba($color: $text-color, $alpha: .02);
|
||||
& textarea{
|
||||
height: 200rpx;
|
||||
}
|
||||
}
|
||||
// 设置密码
|
||||
.password{
|
||||
padding: 0 $padding * 2;
|
||||
.title{
|
||||
margin-top: $margin * 2;
|
||||
font-size: $title-size-m;
|
||||
color: $mian-color;
|
||||
}
|
||||
.group{
|
||||
margin-top: $margin;
|
||||
border-radius: $radius-m;
|
||||
box-shadow: 0 0 4rpx 4rpx rgba($color: $text-color, $alpha: .02);
|
||||
background-color: white;
|
||||
.inputs{
|
||||
padding: $padding $padding + 10;
|
||||
border-bottom: solid 1rpx $border-color;
|
||||
&:last-child{
|
||||
border-bottom: none;
|
||||
}
|
||||
label{
|
||||
color: $text-gray;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
input{
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
font-size: $title-size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 按钮
|
||||
.buttons{
|
||||
padding: $padding * 2;
|
||||
.text{
|
||||
text-align: center;
|
||||
line-height: 90rpx;
|
||||
height: 90rpx;
|
||||
margin-bottom: $margin * 2;
|
||||
font-size: $title-size-lg;
|
||||
color: $mian-color;
|
||||
font-weight: bold;
|
||||
}
|
||||
button{
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
background-color: $mian-color;
|
||||
border-radius: $radius-lg;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
font-size: $title-size;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
144
pages/wallet/index.vue
Normal file
144
pages/wallet/index.vue
Normal file
@@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<view class="animate__animated animate__fadeInRight">
|
||||
<!-- 数字资产 -->
|
||||
<view class="property">
|
||||
<view class="title">总资产(元)</view>
|
||||
<view class="number">0.00</view>
|
||||
</view>
|
||||
<!-- 资产列表 -->
|
||||
<view class="lists">
|
||||
<view class="lists-header">
|
||||
资产列表
|
||||
<uni-icons type="plus" size="24" color="#aa55ff"></uni-icons>
|
||||
</view>
|
||||
<view class="item" v-for="(item, index) in 2" :key="index" @click="propertyInfo(item)">
|
||||
<view class="cost">
|
||||
<image class="logo" src="" mode="" />
|
||||
<view class="title ellipsis">OC COIN</view>
|
||||
<view class="text ellipsis">≈¥0.21</view>
|
||||
</view>
|
||||
<view class="balance">
|
||||
<view class="title ellipsis">120,330.00</view>
|
||||
<view class="text ellipsis">¥25269.3000</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
propertyInfo(e){
|
||||
console.log(e)
|
||||
uni.navigateTo({
|
||||
url: './property'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 数字资产
|
||||
.property{
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
margin-top: $margin;
|
||||
margin-left: $margin + ($margin / 2);
|
||||
background-color: $mian-color;
|
||||
border-radius: $radius 0 0 $radius;
|
||||
padding: ($padding * 3) ($padding * 3) ($padding * 3) ($padding * 2);
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
&::before,&::after{
|
||||
background-color: rgba($color: $red-color, $alpha: .03);
|
||||
border-radius: 50%;
|
||||
content: " ";
|
||||
position: absolute;
|
||||
}
|
||||
&::before{
|
||||
top: -300rpx;
|
||||
left: 40%;
|
||||
height: 400rpx;
|
||||
width: 400rpx;
|
||||
}
|
||||
&::after{
|
||||
bottom: -200rpx;
|
||||
left: -100rpx;
|
||||
height: 300rpx;
|
||||
width: 300rpx;
|
||||
}
|
||||
.title{
|
||||
font-size: $title-size;
|
||||
}
|
||||
.number{
|
||||
font-size: $title-size + 18;
|
||||
}
|
||||
}
|
||||
// 资产列表
|
||||
.lists{
|
||||
padding: $margin + ($margin / 2);
|
||||
.lists-header{
|
||||
display: flex;
|
||||
font-size: $title-size + 2;
|
||||
color: $text-color;
|
||||
font-weight: bold;
|
||||
padding: $padding 0 ($padding/2) 0;
|
||||
justify-content: space-between;
|
||||
justify-items: center;
|
||||
align-items: center;
|
||||
}
|
||||
.item{
|
||||
background-color: white;
|
||||
border-radius: $radius;
|
||||
box-shadow: 0 0 4rpx 4rpx rgba($color: #000000, $alpha: .02);
|
||||
margin-top: $margin;
|
||||
padding: $padding * 2;
|
||||
display: flex;
|
||||
&:first-child{
|
||||
margin-top: 0;
|
||||
}
|
||||
.cost{
|
||||
position: relative;
|
||||
margin-right: $margin;
|
||||
padding-left: 108rpx;
|
||||
width: 50%;
|
||||
box-sizing: border-box;
|
||||
.logo{
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
border-radius: 50%;
|
||||
background-color: $border-color;
|
||||
margin-right: $margin;
|
||||
}
|
||||
}
|
||||
.balance{
|
||||
padding-left: $padding;
|
||||
width: 50%;
|
||||
text-align: right;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.title{
|
||||
font-weight: bold;
|
||||
font-size: $title-size;
|
||||
}
|
||||
.text{
|
||||
font-size: $title-size-m;
|
||||
color: $text-gray;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
108
pages/wallet/mnemonic.vue
Normal file
108
pages/wallet/mnemonic.vue
Normal file
@@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 提示信息 -->
|
||||
<view class="prompt">
|
||||
请按照顺序记录并确保正确备份助记词
|
||||
</view>
|
||||
<!-- 助记词 -->
|
||||
<ul class="mnemonic">
|
||||
<li v-for="(item, index) in mnemonic" :key="index">{{item}}</li>
|
||||
</ul>
|
||||
<!-- 按钮 -->
|
||||
<view class="buttons">
|
||||
<view class="text">注:助记词是用户账户的唯一标识,不能分享给他人,掌握该助记词即可控制该账户与钱包</view>
|
||||
<button type="default" @click="goto('/pages/wallet/validation')">验证助记词</button>
|
||||
</view>
|
||||
<!-- <view class="skip">暂时不验证?<navigator url="/pages/index/index" open-type="switchTab">点此跳过</navigator></view> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { seed } from "../../apis/interfaces/wallet"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
mnemonic: [], // 助记词
|
||||
sign : '' // 校验签名
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
seed().then(res => {
|
||||
this.mnemonic = res.seed.split(' ')
|
||||
this.sign = res.sign
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: err.message
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
goto(url){
|
||||
uni.redirectTo({
|
||||
url: url + '?seed=' + this.mnemonic + '&sign=' + this.sign
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 提示信息
|
||||
.prompt{
|
||||
color: $text-gray;
|
||||
text-align: center;
|
||||
line-height: 90rpx;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
// 跳过
|
||||
.skip{
|
||||
padding: $padding * 2;
|
||||
text-align: center;
|
||||
color: $text-gray;
|
||||
navigator{
|
||||
color: $mian-color;
|
||||
margin-left: $margin/2;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
// 助记词
|
||||
.mnemonic{
|
||||
margin: $margin $margin * 2;
|
||||
border-radius: $radius-m;
|
||||
box-shadow: 0 0 4rpx 4rpx rgba($color: $text-color, $alpha: .02);
|
||||
background-color: white;
|
||||
padding: $padding;
|
||||
list-style: none;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
li{
|
||||
text-align: center;
|
||||
height: 58rpx;
|
||||
line-height: 58rpx;
|
||||
width: 58rpx;
|
||||
margin: $margin / 2;
|
||||
color: $text-color;
|
||||
background: rgba($color: $border-color, $alpha: .4);
|
||||
}
|
||||
}
|
||||
// 按钮
|
||||
.buttons{
|
||||
padding: $padding $padding * 2;
|
||||
.text{
|
||||
text-align: center;
|
||||
margin-bottom: $margin * 2;
|
||||
font-size: $title-size-lg;
|
||||
color: $red-color;
|
||||
}
|
||||
button{
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
background-color: $mian-color;
|
||||
border-radius: $radius-lg;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
font-size: $title-size;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
108
pages/wallet/privatekey.vue
Normal file
108
pages/wallet/privatekey.vue
Normal file
@@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 私钥 -->
|
||||
<view class="keys">
|
||||
<view class="title">您已接收OC Chain托管</view>
|
||||
<view class="key">{{key || '-'}}</view>
|
||||
<view class="copykey" @click="copykey">复制我的私钥</view>
|
||||
</view>
|
||||
<!-- 疑问 -->
|
||||
<view class="doubt" v-if="rules.length > 0">
|
||||
<view class="doubt-item" v-for="(item, index) in rules" :key="index">
|
||||
<view class="title">{{item.title || '-'}}</view>
|
||||
<view class="content">{{item.description || '-'}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 免责说明 -->
|
||||
<view class="liability">
|
||||
<navigator url="/pages/wallet/cmsWithDraw">免责条款</navigator>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { privatekey, keyrules } from '@/apis/interfaces/wallet'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
key: "",
|
||||
rules: []
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
Promise.all([privatekey(this.$Route.query.password), keyrules()]).then(res => {
|
||||
let privatekey = res[0],
|
||||
keyrules = res[1]
|
||||
this.key = privatekey.private_key
|
||||
this.rules = keyrules
|
||||
})
|
||||
},
|
||||
methods:{
|
||||
copykey(){
|
||||
uni.setClipboardData({
|
||||
data: this.key
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.keys{
|
||||
margin: $margin * 2;
|
||||
background: white;
|
||||
padding: $padding * 2;
|
||||
box-shadow: 0 0 4rpx 4rpx rgba($color: #000000, $alpha: .02);
|
||||
border-radius: $radius;
|
||||
.title{
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
font-size: $title-size + 4;
|
||||
color: $text-color;
|
||||
}
|
||||
.key{
|
||||
padding: $padding * 2 0;
|
||||
text-align: center;
|
||||
color: $mian-color;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.copykey{
|
||||
background-color: $mian-color;
|
||||
color: white;
|
||||
height: 95rpx;
|
||||
line-height: 95rpx;
|
||||
text-align: center;
|
||||
font-size: $title-size;
|
||||
border-radius: $radius-m;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
.doubt{
|
||||
margin: $margin $margin * 2;
|
||||
.doubt-item{
|
||||
padding: $padding 0;
|
||||
.title{
|
||||
font-weight: bold;
|
||||
color: $text-color;
|
||||
line-height: 50rpx;
|
||||
font-size: $title-size + 2;
|
||||
}
|
||||
.content{
|
||||
color: $text-gray-lg;
|
||||
font-size: $title-size-m;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.liability{
|
||||
text-align: center;
|
||||
color: $text-gray;
|
||||
@extend .ios-bottom;
|
||||
navigator{
|
||||
font-size: $title-size-sm;
|
||||
display: inline-block;
|
||||
line-height: 90rpx;
|
||||
padding: 0 ($padding * 2);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
357
pages/wallet/property.vue
Normal file
357
pages/wallet/property.vue
Normal file
@@ -0,0 +1,357 @@
|
||||
<template>
|
||||
<view class="propertyIndex">
|
||||
<view class="propery">
|
||||
<image src="/static/imgs/account-bg.png" mode="aspectFill" class="record-bg" />
|
||||
<view class="propery-content">
|
||||
<view class="currency">能量球 (≈ {{ price || '0' }} CNY)</view>
|
||||
<view class="balance">{{ balance.balance || '0' }}</view>
|
||||
<view class="frozen">{{ balance.frozen || '0' }} 冻结中</view>
|
||||
<view class="balance-flex">
|
||||
<view class="balance-flex-item" @click="showAddress">区块链地址</view>
|
||||
<!-- <view class="balance-flex-item" @click="showPrivatekey('privatekey')">我的私钥</view> -->
|
||||
<view class="balance-flex-item" @click="$Router.push({name: 'Extract'})">能量球提现</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 账户记录 -->
|
||||
<view class="record">
|
||||
<view class="record-tabs">
|
||||
<view class="tabs-item" :class="logsType === 0 ? 'show': ''" @click="onLogsType(0)">全部</view>
|
||||
<view class="tabs-item" :class="logsType === 2 ? 'show': ''" @click="onLogsType(2)">收入</view>
|
||||
<view class="tabs-item" :class="logsType === 1 ? 'show': ''" @click="onLogsType(1)">支出</view>
|
||||
</view>
|
||||
<record :list="logs" :logsType="logsType" />
|
||||
<!-- ios安全距离 -->
|
||||
<view class="ios-bottom"></view>
|
||||
</view>
|
||||
<!-- 支付密码 -->
|
||||
<uni-popup ref="showPassword">
|
||||
<view class="validationPassword">
|
||||
<view class="from">
|
||||
<view class="title">验证密码</view>
|
||||
<input class="input" v-model="password" password placeholder="请验证安全密码"/>
|
||||
</view>
|
||||
<view class="buttons">
|
||||
<view class="button cancel" @click="payPassword('cancel', passwordPages)">取消</view>
|
||||
<view class="button confirm" @click="payPassword('confirm', passwordPages)">验证</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
<!-- 原密码弹窗 -->
|
||||
<!-- <number-jpan :length="6" @closeChange="closeChange($event)" ref="numberPad"></number-jpan> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import record from '@/components/property/record'
|
||||
import {
|
||||
sum,
|
||||
price,
|
||||
logs,
|
||||
code,
|
||||
securityCheck // 输入旧密码是否正确
|
||||
} from '@/apis/interfaces/wallet'
|
||||
import numberJpan from "@/components/numberJpan/numberJpan.vue";
|
||||
export default {
|
||||
components: {
|
||||
record
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
balance: {},
|
||||
price: '0.00',
|
||||
logs: [],
|
||||
logsType: 0,
|
||||
password: '',
|
||||
passwordPages: ''
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
Promise.all([
|
||||
sum(),
|
||||
price(),
|
||||
logs()
|
||||
]).then(res => {
|
||||
this.balance = res[0]
|
||||
this.price = res[1]
|
||||
this.logs = res[2]
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: err.message
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 弹出私钥
|
||||
showPrivatekey(pages){
|
||||
this.passwordPages = pages
|
||||
this.$refs.showPassword.open('center')
|
||||
},
|
||||
// 验证私钥
|
||||
payPassword(type){
|
||||
if(type === 'confirm'){
|
||||
if(this.password === '') {
|
||||
uni.showToast({
|
||||
title: '请输入安全密码',
|
||||
icon : 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
securityCheck(this.password).then(res => {
|
||||
this.$refs.showPassword.close()
|
||||
switch (this.passwordPages){
|
||||
case 'privatekey':
|
||||
this.$Router.push({name:'Privatekey', params: {password: this.password}})
|
||||
break;
|
||||
case 'resetPassword':
|
||||
this.$Router.push({name:'ResetPassword', params: {password: this.password}})
|
||||
break;
|
||||
}
|
||||
this.password = ''
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: 'none',
|
||||
})
|
||||
})
|
||||
return
|
||||
}
|
||||
this.$refs.showPassword.close()
|
||||
},
|
||||
// 交易记录
|
||||
onLogsType(index) {
|
||||
if (this.logsType === index) return
|
||||
this.logsType = index
|
||||
this.logs = []
|
||||
logs({
|
||||
flag: this.logsType
|
||||
}).then(res => {
|
||||
this.logs = res
|
||||
})
|
||||
},
|
||||
// 区块地址
|
||||
showAddress() {
|
||||
uni.showModal({
|
||||
title: '我的区块链地址',
|
||||
content: '\n地址可以理解为银行卡卡号,与他人转账时是区块链上的两个地址间的交易行为\n\n' + this.balance.address,
|
||||
cancelText: '复制',
|
||||
cancelColor: '#b11eff',
|
||||
success: (res) => {
|
||||
if (res.cancel) {
|
||||
uni.setClipboardData({
|
||||
data: this.balance.address
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
onNavigationBarButtonTap(e) {
|
||||
if (e.index === 0) {
|
||||
uni.showActionSheet({
|
||||
// itemList: ['转账', '收款', '提币', '修改密码'],
|
||||
itemList: ['提现', '修改密码'],
|
||||
success: (res) => {
|
||||
switch (res.tapIndex) {
|
||||
case 0:
|
||||
console.log('提现了,')
|
||||
this.$Router.push({
|
||||
name: 'Extract'
|
||||
})
|
||||
break;
|
||||
case 1:
|
||||
this.showPrivatekey('resetPassword')
|
||||
break;
|
||||
}
|
||||
uni.hideLoading()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.propertyIndex{
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
// 验证密码弹出层
|
||||
.validationPassword{
|
||||
background-color: white;
|
||||
border-radius: $radius-m;
|
||||
width: 70vw;
|
||||
.from{
|
||||
padding: $padding*2;
|
||||
.title{
|
||||
text-align: center;
|
||||
font-size: $title-size;
|
||||
padding-bottom: $padding*2;
|
||||
font-weight: bold;
|
||||
color: $text-price;
|
||||
}
|
||||
.input{
|
||||
text-align: center;
|
||||
height: 90rpx;
|
||||
font-size: $title-size;
|
||||
border-radius: $radius-m;
|
||||
background: $border-color-lg;
|
||||
padding: 0 ($padding*2);
|
||||
}
|
||||
}
|
||||
.buttons{
|
||||
display: flex;
|
||||
border-top: solid 1rpx $border-color;
|
||||
.button{
|
||||
width: 50%;
|
||||
font-size: $title-size;
|
||||
line-height: 90rpx;
|
||||
height: 90rpx;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
&.cancel{
|
||||
border-right: solid 1rpx $border-color;
|
||||
color: $text-gray;
|
||||
}
|
||||
&.confirm{
|
||||
color: $text-price;
|
||||
}
|
||||
}
|
||||
}
|
||||
// .button{
|
||||
// background-color: $text-price;
|
||||
// color: white;
|
||||
// border-radius: $radius-m;
|
||||
// border: none;
|
||||
// margin-top: $margin*2;
|
||||
// font-size: $title-size;
|
||||
// height: 90rpx;
|
||||
// line-height: 90rpx;
|
||||
// }
|
||||
// .close{
|
||||
// @extend .button;
|
||||
// text-align: center;
|
||||
// color: $text-gray;
|
||||
// margin-top: $margin;
|
||||
// background-color: transparent;
|
||||
// }
|
||||
}
|
||||
// 账户
|
||||
.propery {
|
||||
position: relative;
|
||||
padding-top: var(--status-bar-height);
|
||||
background-image: linear-gradient(to right, #7c52fc, #976dff);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
.record-bg {
|
||||
position: absolute;
|
||||
width: 120%;
|
||||
height: 300rpx;
|
||||
bottom: -10rpx;
|
||||
right: -20rpx;
|
||||
z-index: 1;
|
||||
opacity: .5;
|
||||
transform:rotate(-7deg);
|
||||
}
|
||||
// &::before {
|
||||
// position: absolute;
|
||||
// left: 0;
|
||||
// top: 0;
|
||||
// width: 100%;
|
||||
// height: 100%;
|
||||
// content: " ";
|
||||
// background-image: url(@/static/imgs/account-bg.png);
|
||||
// background-size: 100%;
|
||||
// background-repeat: no-repeat;
|
||||
// opacity: .5;
|
||||
// transform:rotate(0deg);
|
||||
// }
|
||||
|
||||
.propery-content {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
padding: $padding *3 $padding *1.4;
|
||||
text-align: center;
|
||||
|
||||
.currency {
|
||||
font-size: $title-size-m;
|
||||
color: rgba($color: white, $alpha: .8);
|
||||
}
|
||||
|
||||
.balance {
|
||||
font-size: $title-size * 2.5;
|
||||
padding: $padding 0;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.frozen {
|
||||
background: rgba($color: #000000, $alpha: .1);
|
||||
color: rgba($color: white, $alpha: .7);
|
||||
display: inline-block;
|
||||
font-size: 24rpx;
|
||||
padding: 6rpx $padding;
|
||||
border-radius: $radius-m;
|
||||
border: solid 1rpx rgba($color: white, $alpha: .4)
|
||||
|
||||
}
|
||||
|
||||
.balance-flex {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: $margin * 2;
|
||||
|
||||
.balance-flex-item {
|
||||
background-color: white;
|
||||
width: 200rpx;
|
||||
height: 75rpx;
|
||||
line-height: 75rpx;
|
||||
color: $text-price;
|
||||
margin: 0 $margin;
|
||||
border-radius: $radius-m;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 记录
|
||||
.record {
|
||||
background-color: white;
|
||||
border-radius: $radius $radius 0 0;
|
||||
padding: $padding ($padding * 2);
|
||||
margin-top: -$margin;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
|
||||
.record-tabs {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
font-weight: bold;
|
||||
font-size: $title-size;
|
||||
color: $text-gray;
|
||||
line-height: 70rpx;
|
||||
margin-bottom: $margin;
|
||||
|
||||
.tabs-item {
|
||||
position: relative;
|
||||
padding: 0 $padding;
|
||||
|
||||
&.show {
|
||||
color: $text-price;
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: $padding;
|
||||
right: $padding;
|
||||
height: 4rpx;
|
||||
content: " ";
|
||||
background-color: $text-price;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
150
pages/wallet/resetPassword.vue
Normal file
150
pages/wallet/resetPassword.vue
Normal file
@@ -0,0 +1,150 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 设置钱包密码 -->
|
||||
<view class="password">
|
||||
<view class="prompt">请设置6位数字密码。建议不要使用连续的数字。</view>
|
||||
<view class="group">
|
||||
<view class="inputs">
|
||||
<label>密码</label>
|
||||
<input type="digit" v-model="password" maxlength="6" password placeholder="请设置新密码" />
|
||||
</view>
|
||||
<view class="inputs">
|
||||
<label>确认密码</label>
|
||||
<input type="digit" v-model="verify" maxlength="6" password placeholder="请确认新密码" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 按钮 -->
|
||||
<view class="buttons">
|
||||
<button type="default" form-type="submit" @click="createWallet">确认</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
securityReset
|
||||
} from '@/apis/interfaces/wallet'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
password: '',
|
||||
verify: '',
|
||||
oldPassword: ''
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.oldPassword = this.$Route.query.password
|
||||
},
|
||||
methods: {
|
||||
// 激活钱包
|
||||
createWallet() {
|
||||
if (this.password === '' || this.verify === '') {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请设置密码'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.password !== this.verify) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '两次输入密码不一致'
|
||||
})
|
||||
return
|
||||
}
|
||||
securityReset({
|
||||
new_code: this.password,
|
||||
old_code: this.oldPassword
|
||||
}).then(res => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '密码已重置',
|
||||
showCancel:false,
|
||||
success: res=> {
|
||||
uni.navigateBack()
|
||||
}
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: err.message
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 副标题
|
||||
.sub-title {
|
||||
color: $text-gray;
|
||||
text-align: center;
|
||||
margin: $margin * 2 $margin;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
|
||||
// 设置密码
|
||||
.password {
|
||||
padding: 0 $padding * 2;
|
||||
|
||||
.prompt {
|
||||
margin-top: $margin * 2;
|
||||
font-size: $title-size-m;
|
||||
color: $mian-color;
|
||||
}
|
||||
|
||||
.group {
|
||||
margin-top: $margin;
|
||||
border-radius: $radius-m;
|
||||
box-shadow: 0 0 4rpx 4rpx rgba($color: $text-color, $alpha: .02);
|
||||
background-color: white;
|
||||
|
||||
.inputs {
|
||||
padding: $padding $padding + 10;
|
||||
border-bottom: solid 1rpx $border-color;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
label {
|
||||
color: $text-gray;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
|
||||
input {
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
font-size: $title-size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 按钮
|
||||
.buttons {
|
||||
padding: $padding * 2;
|
||||
|
||||
.text {
|
||||
text-align: center;
|
||||
line-height: 90rpx;
|
||||
height: 90rpx;
|
||||
margin-bottom: $margin * 2;
|
||||
font-size: $title-size-lg;
|
||||
color: $mian-color;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
button {
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
background-color: $mian-color;
|
||||
border-radius: $radius-lg;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
font-size: $title-size;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
77
pages/wallet/results.vue
Normal file
77
pages/wallet/results.vue
Normal file
@@ -0,0 +1,77 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="webkit-box results">
|
||||
<uni-icons type="checkbox-filled" size="88" color="#009b69"></uni-icons>
|
||||
<view class="title">交易已提交</view>
|
||||
<view class="sub-title">预计10秒内到账,可在交易记录中查询,以实际到账时间为准</view>
|
||||
<view class="hash">
|
||||
<view class="hash-title">交易哈希</view>
|
||||
<view class="hash-text">{{hash}}</view>
|
||||
</view>
|
||||
<button class="results-button" type="default" @click="navBack">返回</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
hash: ''
|
||||
};
|
||||
},
|
||||
onLoad(e){
|
||||
this.hash = e.hash
|
||||
},
|
||||
methods:{
|
||||
navBack(){
|
||||
uni.navigateBack()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.results{
|
||||
height: 100vh;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
padding-left: $padding * 3;
|
||||
padding-right: $padding * 3;
|
||||
padding-bottom: 20vh;
|
||||
.title{
|
||||
font-size: $title-size + 8;
|
||||
color: $text-color;
|
||||
font-weight: bold;
|
||||
line-height: 80rpx;
|
||||
padding: $padding 0;
|
||||
}
|
||||
.sub-title{
|
||||
color: $text-gray;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
.hash{
|
||||
background-color: white;
|
||||
padding: $padding * 2;
|
||||
border-radius: $radius-lg;
|
||||
margin-top: $margin * 2;
|
||||
font-size: $title-size;
|
||||
color: $text-color;
|
||||
.hash-title{
|
||||
padding-bottom: $padding;
|
||||
}
|
||||
.hash-text{
|
||||
word-break:break-all;
|
||||
}
|
||||
}
|
||||
.results-button{
|
||||
margin-top: $margin * 3;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
background-color: $mian-color;
|
||||
color: white;
|
||||
font-size: $title-size;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
216
pages/wallet/transfer.vue
Normal file
216
pages/wallet/transfer.vue
Normal file
@@ -0,0 +1,216 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 账户余额 -->
|
||||
<view class="transfer-block">
|
||||
<view class="unit">OCC</view>
|
||||
<view class="transfer-flex">
|
||||
<view class="item ellipsis">
|
||||
<label>数量</label>{{balance.balance || '0.00'}}
|
||||
</view>
|
||||
<view class="item ellipsis">
|
||||
<label>估值(CNY)</label>≈{{cny || '0.00'}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="sub-title">
|
||||
<text>请认真确认地址及数量,地址错误无法找回</text>
|
||||
</view>
|
||||
<!-- 转账信息 -->
|
||||
<view class="password">
|
||||
<view class="group">
|
||||
<view class="inputs input-scan">
|
||||
<label>接收地址</label>
|
||||
<input type="text" placeholder="请输入接收地址" v-model="address" />
|
||||
<view class="input-scan-icon" @click="scanCode">
|
||||
<uni-icons type="scan" size="22" color="#009b69"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="inputs">
|
||||
<label>转账数量</label>
|
||||
<input type="number" placeholder="请输入转账数量" v-model="number" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="group">
|
||||
<view class="inputs">
|
||||
<label>交易密码</label>
|
||||
<input type="password" placeholder="请输入安全密码" v-model="password" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 按钮 -->
|
||||
<view class="buttons">
|
||||
<button type="default" @click="submitTransfer">转账</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { sum, price, transfer } from '@/apis/interfaces/wallet'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
balance: {},
|
||||
cny: '0.00',
|
||||
address: '',
|
||||
number: '',
|
||||
password: ''
|
||||
}
|
||||
},
|
||||
onLoad(e){
|
||||
if(e.hashAddress) this.address = e.hashAddress
|
||||
},
|
||||
mounted() {
|
||||
Promise.all([
|
||||
sum(),
|
||||
price()
|
||||
]).then(res => {
|
||||
this.balance = res[0]
|
||||
if (res[0].balance > 0) this.cny = (res[1] * res[0].balance).toFixed(2)
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: err.message
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 转账
|
||||
submitTransfer(){
|
||||
if(this.address === '' || this.number === '' || this.password === ''){
|
||||
let messageText
|
||||
if(this.address === '') messageText = '请输入接收地址'
|
||||
else if(this.number === '') messageText = '请输入转账数量'
|
||||
else if(this.password === '') messageText = '请输入安全密码'
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: messageText
|
||||
})
|
||||
return
|
||||
}
|
||||
// 提交转账信息
|
||||
transfer({
|
||||
to: this.address,
|
||||
amount: this.number,
|
||||
security_code: this.password
|
||||
}).then(res => {
|
||||
uni.redirectTo({
|
||||
url: './results?hash=' + res.txHash + '&number=' + this.number
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: err.message
|
||||
})
|
||||
})
|
||||
},
|
||||
// 扫码
|
||||
scanCode(){
|
||||
uni.scanCode({
|
||||
scanType: ['qrCode'],
|
||||
success: res=> {
|
||||
this.address = res.result
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 账户余额
|
||||
.transfer-block{
|
||||
background-color: white;
|
||||
margin: $margin * 2;
|
||||
border-radius: $radius-m;
|
||||
box-shadow: 0 0 4rpx 4rpx rgba($color: $text-color, $alpha: .02);
|
||||
background-color: white;
|
||||
padding: $padding $padding + 10;
|
||||
.unit{
|
||||
font-weight: bold;
|
||||
font-size: $title-size + 10;
|
||||
line-height: 90rpx;
|
||||
color: $text-color;
|
||||
}
|
||||
.transfer-flex{
|
||||
display: flex;
|
||||
padding: $padding 0;
|
||||
border-top: solid 1rpx $border-color;
|
||||
.item{
|
||||
width: 50%;
|
||||
font-size: $title-size-m;
|
||||
& > label{
|
||||
color: $text-gray;
|
||||
padding-right: $padding/2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 提示信息
|
||||
.sub-title{
|
||||
color: $text-gray;
|
||||
text-align: center;
|
||||
margin: $margin * 2 $margin;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
// 转账信息
|
||||
.password{
|
||||
padding: 0 $padding * 2;
|
||||
.group{
|
||||
margin-top: $margin;
|
||||
border-radius: $radius-m;
|
||||
box-shadow: 0 0 4rpx 4rpx rgba($color: $text-color, $alpha: .02);
|
||||
background-color: white;
|
||||
.inputs{
|
||||
padding: $padding $padding + 10;
|
||||
border-bottom: solid 1rpx $border-color;
|
||||
&:last-child{
|
||||
border-bottom: none;
|
||||
}
|
||||
label{
|
||||
color: $text-gray;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
input{
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
font-size: $title-size;
|
||||
}
|
||||
}
|
||||
.input-scan{
|
||||
position: relative;
|
||||
padding-right: ($padding*2) + 70;
|
||||
.input-scan-icon{
|
||||
position: absolute;
|
||||
bottom: $padding;
|
||||
right: $padding;
|
||||
height: 70rpx;
|
||||
width: 70rpx;
|
||||
line-height: 70rpx;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 按钮
|
||||
.buttons{
|
||||
padding: $padding * 2;
|
||||
.text{
|
||||
text-align: center;
|
||||
line-height: 90rpx;
|
||||
height: 90rpx;
|
||||
margin-bottom: $margin * 2;
|
||||
font-size: $title-size-lg;
|
||||
color: $mian-color;
|
||||
font-weight: bold;
|
||||
}
|
||||
button{
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
background-color: $mian-color;
|
||||
border-radius: $radius-lg;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
font-size: $title-size;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
169
pages/wallet/validation.vue
Normal file
169
pages/wallet/validation.vue
Normal file
@@ -0,0 +1,169 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 提示信息 -->
|
||||
<view class="prompt">
|
||||
验证您的钱包助记词
|
||||
</view>
|
||||
<!-- 助记词 -->
|
||||
<view class="mnemonic">
|
||||
<view
|
||||
class="item"
|
||||
v-for="(item, index) in validation"
|
||||
:key="index"
|
||||
:class="item === null ? 'hide': ''"
|
||||
@click="onKeys('removeKey', index)"
|
||||
>{{ item }}</view>
|
||||
</view>
|
||||
<!-- 选择助记词 -->
|
||||
<block v-if="mnemonic.length > 0">
|
||||
<view class="mnemonic-title">
|
||||
按顺序填写助记词
|
||||
</view>
|
||||
<view class="mnemonic-select">
|
||||
<view class="item" v-for="(item, index) in mnemonic" :key="index" @click="onKeys('addKey', index)">{{ item }}</view>
|
||||
</view>
|
||||
</block>
|
||||
<!-- 按钮 -->
|
||||
<view class="buttons">
|
||||
<button type="default" @click="verifyMnemonic">验证</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { hash } from "../../apis/interfaces/wallet"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
validation : new Array(15).fill(null), // 验证key
|
||||
mnemonic : [], // 助记词key
|
||||
sign : '', // 助记词校验签名
|
||||
seedString : '', // 助记词原词
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
let seed = e.seed.split(',')
|
||||
seed.sort(() => {
|
||||
return Math.random() - .5
|
||||
});
|
||||
this.mnemonic = seed
|
||||
this.sign = e.sign
|
||||
this.seedString = e.seed
|
||||
},
|
||||
methods: {
|
||||
// 填写助记词
|
||||
onKeys(type, index){
|
||||
if(type === 'addKey') {
|
||||
this.$set(this.validation, this.validation.findIndex(val => val === null), this.mnemonic[index])
|
||||
this.$delete(this.mnemonic, index)
|
||||
return
|
||||
}
|
||||
if(type === 'removeKey' && this.validation[index] !== null) {
|
||||
this.mnemonic.push(this.validation[index])
|
||||
this.$delete(this.validation, index)
|
||||
this.validation.push(null)
|
||||
}
|
||||
},
|
||||
// 验证助记词
|
||||
verifyMnemonic(){
|
||||
if(this.validation.findIndex(val => val === null) > -1){
|
||||
uni.showToast({
|
||||
title: '请完整填写助记词',
|
||||
icon : 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
let seed = this.validation.toString().replace(/,/g, ',')
|
||||
if (this.seedString !== seed) {
|
||||
uni.showToast({
|
||||
title: '验证失败,请确认您的助记词',
|
||||
icon : 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.redirectTo({
|
||||
url: './create'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 提示信息
|
||||
.prompt{
|
||||
color: $text-gray;
|
||||
text-align: center;
|
||||
line-height: 90rpx;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
// 选择助记词
|
||||
.mnemonic-title{
|
||||
padding-top: $padding * 2;
|
||||
margin: 0 $margin * 2;
|
||||
font-size: $title-size-m;
|
||||
color: $mian-color;
|
||||
}
|
||||
.mnemonic-select{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: $padding $padding + $padding / 2;
|
||||
.item{
|
||||
background-color: white;
|
||||
line-height: 68rpx;
|
||||
height: 68rpx;
|
||||
width: 68rpx;
|
||||
text-align: center;
|
||||
margin: $margin / 2;
|
||||
border-radius: $radius-m;
|
||||
box-shadow: 0 0 4rpx 4rpx rgba($color: $text-color, $alpha: .02);
|
||||
}
|
||||
}
|
||||
// 助记词
|
||||
.mnemonic{
|
||||
margin: $margin ($margin * 2);
|
||||
border-radius: $radius-m;
|
||||
box-shadow: 0 0 4rpx 4rpx rgba($color: $text-color, $alpha: .02);
|
||||
background-color: white;
|
||||
padding: $padding;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
.item{
|
||||
background: rgba($color: $border-color, $alpha: .4);
|
||||
width: 58rpx;
|
||||
height: 58rpx;
|
||||
line-height: 58rpx;
|
||||
text-align: center;
|
||||
color: $text-color;
|
||||
margin: $margin / 2;
|
||||
&.hide{
|
||||
border:dashed 1px $border-color;
|
||||
box-sizing: border-box;
|
||||
background-color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 按钮
|
||||
.buttons{
|
||||
padding: $padding $padding * 2;
|
||||
.text{
|
||||
text-align: center;
|
||||
margin-bottom: $margin * 2;
|
||||
font-size: $title-size-lg;
|
||||
color: $red-color;
|
||||
}
|
||||
button{
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
background-color: $mian-color;
|
||||
border-radius: $radius-lg;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
font-size: $title-size;
|
||||
&[disabled]{
|
||||
background: rgba($color: $mian-color, $alpha: .8);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user