初始化

This commit is contained in:
魏啾
2024-03-21 15:38:10 +08:00
parent e2f200ae7a
commit 81321b648f
479 changed files with 60060 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,273 @@
<template>
<view class="container">
<view class="page-body">
<view class='wrapper'>
<view class='toolbar' @tap="format">
<view :class="formats.bold ? 'ql-active' : ''" class="iconfont icon-zitijiacu" data-name="bold">
</view>
<view :class="formats.italic ? 'ql-active' : ''" class="iconfont icon-zitixieti" data-name="italic">
</view>
<view :class="formats.underline ? 'ql-active' : ''" class="iconfont icon-zitixiahuaxian"
data-name="underline"></view>
<view :class="formats.strike ? 'ql-active' : ''" class="iconfont icon-zitishanchuxian"
data-name="strike"></view>
<!-- #ifndef MP-BAIDU -->
<view :class="formats.align === 'left' ? 'ql-active' : ''" class="iconfont icon-zuoduiqi"
data-name="align" data-value="left"></view>
<!-- #endif -->
<view :class="formats.align === 'center' ? 'ql-active' : ''" class="iconfont icon-juzhongduiqi"
data-name="align" data-value="center"></view>
<view :class="formats.align === 'right' ? 'ql-active' : ''" class="iconfont icon-youduiqi"
data-name="align" data-value="right"></view>
<view :class="formats.align === 'justify' ? 'ql-active' : ''" class="iconfont icon-zuoyouduiqi"
data-name="align" data-value="justify"></view>
<!-- #ifndef MP-BAIDU -->
<view :class="formats.lineHeight ? 'ql-active' : ''" class="iconfont icon-line-height"
data-name="lineHeight" data-value="2"></view>
<view :class="formats.letterSpacing ? 'ql-active' : ''" class="iconfont icon-Character-Spacing"
data-name="letterSpacing" data-value="2em"></view>
<view :class="formats.marginTop ? 'ql-active' : ''" class="iconfont icon-722bianjiqi_duanqianju"
data-name="marginTop" data-value="20px"></view>
<view :class="formats.marginBottom ? 'ql-active' : ''" class="iconfont icon-723bianjiqi_duanhouju"
data-name="marginBottom" data-value="20px"></view>
<!-- #endif -->
<view class="iconfont icon-clearedformat" @tap="removeFormat"></view>
<!-- #ifndef MP-BAIDU -->
<view :class="formats.fontFamily ? 'ql-active' : ''" class="iconfont icon-font"
data-name="fontFamily" data-value="Pacifico"></view>
<view :class="formats.fontSize === '24px' ? 'ql-active' : ''" class="iconfont icon-fontsize"
data-name="fontSize" data-value="24px"></view>
<!-- #endif -->
<view :class="formats.color === '#0000ff' ? 'ql-active' : ''" class="iconfont icon-text_color"
data-name="color" data-value="#0000ff"></view>
<view :class="formats.backgroundColor === '#00ff00' ? 'ql-active' : ''"
class="iconfont icon-fontbgcolor" data-name="backgroundColor" data-value="#00ff00"></view>
<view class="iconfont icon-date" @tap="insertDate"></view>
<view class="iconfont icon--checklist" data-name="list" data-value="check"></view>
<view :class="formats.list === 'ordered' ? 'ql-active' : ''" class="iconfont icon-youxupailie"
data-name="list" data-value="ordered"></view>
<view :class="formats.list === 'bullet' ? 'ql-active' : ''" class="iconfont icon-wuxupailie"
data-name="list" data-value="bullet"></view>
<view class="iconfont icon-undo" @tap="undo"></view>
<view class="iconfont icon-redo" @tap="redo"></view>
<view class="iconfont icon-outdent" data-name="indent" data-value="-1"></view>
<view class="iconfont icon-indent" data-name="indent" data-value="+1"></view>
<view class="iconfont icon-fengexian" @tap="insertDivider"></view>
<view class="iconfont icon-charutupian" @tap="insertImage"></view>
<view :class="formats.header === 1 ? 'ql-active' : ''" class="iconfont icon-format-header-1"
data-name="header" :data-value="1"></view>
<view :class="formats.script === 'sub' ? 'ql-active' : ''" class="iconfont icon-zitixiabiao"
data-name="script" data-value="sub"></view>
<view :class="formats.script === 'super' ? 'ql-active' : ''" class="iconfont icon-zitishangbiao"
data-name="script" data-value="super"></view>
<view class="iconfont icon-shanchu" @tap="clear"></view>
<view :class="formats.direction === 'rtl' ? 'ql-active' : ''" class="iconfont icon-direction-rtl"
data-name="direction" data-value="rtl"></view>
</view>
<view class="editor-wrapper">
<editor id="editor" class="ql-container" placeholder="开始输入..." show-img-size show-img-toolbar
show-img-resize @statuschange="onStatusChange" @input="getText" :read-only="readOnly"
@ready="onEditorReady">
</editor>
</view>
<view
style="display:block; width: 80%; padding: 18rpx 0; text-align: center; margin:20rpx auto 0 auto; color: #fff; background:#6699ff;border-radius:16rpx;"
@click="determine">
确定</view>
</view>
</view>
</view>
</template>
<script>
import uploadImage from "@/js_sdk/yushijie-ossutil/ossutil/uploadFile.js";
export default {
data() {
return {
readOnly: false,
formats: {},
context: {}
}
},
async onLoad(e) {
try {
if (e.id) {
let res = await this.api.serviceseccarddesc({
id: e.id
})
if (res.code = 1) {
var thisdatadescribe = res.data.notice
this.context = res.data.notice
uni.createSelectorQuery().select('#editor').context((res) => {
if (!res) return
res.context.setContents({
html: thisdatadescribe
})
}).exec()
}
}
} catch (e) {
//TODO handle the exception
}
// #ifndef MP-BAIDU
uni.loadFontFace({
family: 'Pacifico',
source: 'url("https://sungd.github.io/Pacifico.ttf")'
})
// #endif
},
methods: {
getText(e) {
this.context = e.detail.html
console.log(e.detail.html, this.context); //输出相应内容的html代码
},
readOnlyChange() {
this.readOnly = !this.readOnly
},
onEditorReady() {
// #ifdef MP-BAIDU
this.editorCtx = requireDynamicLib('editorLib').createEditorContext('editor');
// #endif
// #ifdef APP-PLUS || MP-WEIXIN || H5
uni.createSelectorQuery().select('#editor').context((res) => {
this.editorCtx = res.context
}).exec()
// #endif
},
determine() {
this.$bus.$emit('showeditors', this.context)
uni.navigateBack()
},
undo() {
this.editorCtx.undo()
},
redo() {
this.editorCtx.redo()
},
format(e) {
let {
name,
value
} = e.target.dataset
if (!name) return
// console.log('format', name, value)
this.editorCtx.format(name, value)
},
onStatusChange(e) {
const formats = e.detail
this.formats = formats
},
insertDivider() {
this.editorCtx.insertDivider({
success: function() {
console.log('insert divider success')
}
})
},
clear() {
uni.showModal({
title: '清空编辑器',
content: '确定清空编辑器全部内容?',
success: res => {
if (res.confirm) {
this.editorCtx.clear({
success: function(res) {
console.log("clear success")
}
})
}
}
})
},
removeFormat() {
this.editorCtx.removeFormat()
},
insertDate() {
const date = new Date()
const formatDate = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`
this.editorCtx.insertText({
text: formatDate
})
},
insertImage() {
uni.showLoading({
title: '上传中',
mask: true
})
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: (res) => {
let file = res.tempFilePaths[0];
uploadImage(file, 'wechat/shopeditor/',
result => {
this.editorCtx.insertImage({
src: result,
alt: '图像',
})
uni.hideLoading()
}, result => {
console.log(result)
uni.hideLoading()
})
},
fail: (res) => {
uni.hideLoading()
}
});
}
}
}
</script>
<style>
@import "./editor-icon.css";
.wrapper {
height: 100%;
}
.editor-wrapper {
background: #fff;
}
.iconfont {
display: inline-block;
padding: 8px 8px;
width: 24px;
height: 24px;
cursor: pointer;
font-size: 20px;
}
.toolbar {
box-sizing: border-box;
border-bottom: 0;
}
.ql-container {
box-sizing: border-box;
padding: 12px 15px;
width: 100%;
min-height: 30vh;
height: 100%;
font-size: 16px;
line-height: 1.5;
}
.ql-active {
color: #06c;
}
</style>

Binary file not shown.

201
pages/shop/index.vue Normal file
View File

@@ -0,0 +1,201 @@
<template>
<view class="index">
<view class="indexone_item flex-between" @click="clickJump(5)">
<view class="indexone_itemone flex-start">
<image class="indexone_itemoneimage" :src="form.avatar" mode=""></image>
<view class="flex-colum-start">
<text class="flex-colum-start_one">{{form.title}}</text>
<text class="flex-colum-start_tow">{{form.label || ''}}</text>
</view>
</view>
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
</view>
<view class="indexone_item flex-between" @click="clickJump(3)">
<view class="indexone_itemone flex-start">
<image src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/icon/shop2.png" mode=""></image>
<text>创建会员卡</text>
</view>
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
</view>
<view class="indexone_item flex-between" @click="clickJump(5)">
<view class="indexone_itemone flex-start">
<image src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/icon/shop3.png" mode=""></image>
<text>门店设置</text>
</view>
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
</view>
<view class="indexone_item flex-between" @click="clickJump(6)">
<view class="indexone_itemone flex-start">
<image src="@/static/shop/shop4.png" mode=""></image>
<text>推广二维码</text>
</view>
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
</view>
<view class="indexone_item flex-between" @click="clickJump(8)">
<view class="indexone_itemone flex-start">
<image src="@/static/shop/shop5.png" mode=""></image>
<text>商城订单</text>
</view>
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
</view>
<view class="indexone_item flex-between" @click="clickJump(9)">
<view class="indexone_itemone flex-start">
<image src="@/static/shop/shop6.png" mode=""></image>
<text>商城管理</text>
</view>
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
</view>
<view class="indexone_items" style="background: #6699FF;color: #FFFFFF;" @click="clickJump(7)">
切换账号
</view>
<view class="indexone_items" @click="clickJump(4)">
退出登录
</view>
</view>
</template>
<script>
export default {
data() {
return {
form: {}
}
},
async onShow() {
this.userstoredetail()
},
methods: {
async userstoredetail() {
let res = await this.api.userstoredetail()
this.form = res.data
this.lnglat = res.data.lat + '-' + res.data.lng
},
clickJump(e) {
switch (e) {
case 0:
uni.pro.navigateTo('shop/create')
break;
case 1:
uni.pro.navigateTo('shop/createcap')
break;
case 2:
uni.pro.navigateTo('shop/upload')
break;
case 3:
uni.pro.navigateTo('shop/member')
break;
case 4:
this.userlogout()
break;
case 5:
uni.pro.navigateTo('shop/store')
break;
case 6:
uni.pro.navigateTo('shop/promotion')
break;
case 7:
uni.pro.navigateTo('shop/indexes')
break;
case 8:
uni.pro.navigateTo('mall/index')
break;
case 9:
uni.pro.navigateTo('mailproject/index')
break;
}
},
async userlogout() { //退出登录
uni.showModal({
title: '注意',
content: '确定要退出登录吗?',
success: async (res) => {
console.log(111)
if (res.confirm) {
try {
let data = await this.api.userlogout();
console.log(data)
if (data.code == 1) {
uni.cache.clear();
uni.reLaunch({
url: '/pages/login/login'
});
}
} catch (e) {
//TODO handle the exception
}
}
}
});
},
}
}
</script>
<style lang="scss">
page {
background: #FBFBFA;
}
.index {
.indexone_items {
width: 80%;
padding: 16rpx 0;
margin: 40rpx auto;
text-align: center;
background: #E0E0E0;
border-radius: 16rpx;
font-size: 32rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
.indexone_item {
padding: 24rpx 32rpx;
border-bottom: 2rpx solid #E5E5E5;
.indexone_itemone {
image {
width: 38rpx;
height: 38rpx;
}
.indexone_itemoneimage {
width: 112rpx;
height: 112rpx;
}
.flex-colum-start {
.flex-colum-start_one {
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
font-size: 32rpx;
font-family: SourceHanSansCN-Medium, SourceHanSansCN;
font-weight: 500;
color: #333333;
}
.flex-colum-start_tow {
overflow: hidden;
margin-top: 16rpx;
font-size: 32rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
text {
margin-left: 32rpx;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #333333;
}
}
}
}
</style>

171
pages/shop/indexes.vue Normal file
View File

@@ -0,0 +1,171 @@
<template>
<view class="index flex-colum">
<view class="index_text">
点击头像切换店铺账号
</view>
<view class="index_box">
<view class="index_item flex-between" v-for="(item,index) in list" :key="index" @click="clickes(item)">
<view class="index_itemone flex-start">
<image class="index_itemoneimage" :src="item.avatar" mode=""></image>
<view class="flex-colum-start">
<view class="index_itemone_one">
{{item.title}}
</view>
<view class="index_itemone_tow">
{{item.class}}
</view>
</view>
</view>
<view class="index_itemonetext" v-if="item.store_id==storeid">
当前使用
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
screenheight: '',
list: [],
storeid: uni.cache.get('user').store_id
}
},
onLoad() {
this.useraccountlist()
uni.getSystemInfo({
success: (e) => {
let screenHeight = 0
console.log(e)
screenHeight = e.windowHeight
this.screenheight = {
'height': screenHeight + 'px'
}
}
})
},
methods: {
async useraccountlist() {
let res = await this.api.useraccountlist()
if (res.code = 1) {
this.list = res.data
}
},
async clickes(e) {
if (e.store_id != this.storeid) {
uni.login({
provider: 'weixin',
success: async (data) => {
let res = await this.api.userautollogin({
code: data.code,
type: e.type,
syb_m_id: e.syb_m_id,
mobile: e.mobile,
sign: uni.utils.md5('wgpdZW1YEqNlUuvJfrB2nkjRVOHIeC' + e.type + e
.syb_m_id + e.mobile)
})
try {
if (res.code == 1) {
uni.cache.set('user', res.data.userinfo);
uni.cache.set("token", res.data.userinfo.token);
if (res.data.userinfo.group_id == 2) {
uni.pro.switchTab('order/index')
} else {
setTimeout(res => {
uni.reLaunch({
url: '/pages/login/login'
})
}, 2000)
}
} else {
setTimeout(res => {
uni.reLaunch({
url: '/pages/login/login'
})
}, 2000)
}
} catch (e) {
setTimeout(res => {
uni.reLaunch({
url: '/pages/login/login'
})
}, 2000)
}
}
});
}
}
}
}
</script>
<style lang="scss">
page {
background: #EDEDED;
}
.index {
height: 100%;
.index_text {
font-size: 52rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #333333;
margin-top: 220rpx;
}
.index_box {
padding: 0 48rpx;
width: 100%;
.index_item {
margin-top: 56rpx;
width: 100%;
padding: 40rpx 45rpx;
background: #FFFFFF;
border-radius: 44rpx;
.index_itemone {
.index_itemoneimage {
width: 114rpx;
height: 114rpx;
}
.flex-colum-start {
margin-left: 32rpx;
.index_itemone_one {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
width: 240rpx;
font-size: 32rpx;
font-family: SourceHanSansCN-Bold, SourceHanSansCN;
font-weight: bold;
color: #333333;
}
.index_itemone_tow {
margin-top: 10rpx;
font-size: 32rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
.index_itemonetext {
font-size: 32rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #2F87FD;
}
}
}
}
</style>

285
pages/shop/member.vue Normal file
View File

@@ -0,0 +1,285 @@
<template>
<view class="index">
<view class="indextext">
基本信息
</view>
<view class="content_item flex-between" @click="showsheetone = true">
<view class="content_itemone">
选择会员卡类型
</view>
<view class="content_itemtow flex-start">
<!-- <view class="content_itemtow flex-start"> -->
<text class="content_itemtow_text">{{showname}}</text>
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
</view>
</view>
<view class="content_itemecharge" v-if="showtypes ==1">
<view class=" flex-start" v-for="(item,index) in recharge_amount" :key="index" style="margin-top: 10rpx;">
<text>充值金额</text>
<input type="number" v-model="recharge_amount[index].amount" :min='0' style="margin-left: 10rpx;">
<text style="margin-left: 10rpx;"></text>
<input :min='0' type="number" v-model="recharge_amount[index].deliver" style="margin-left: 10rpx;">
<text style="margin-left: 10rpx;color: #fff; padding:5rpx; border-radius: 10rpx; background: red;"
@click="reducetext(index)">删除</text>
</view>
<!-- <view class="content_itemeabsolute" @click="add">
<u-icon name="plus-circle" color="#2979ff" size="20"></u-icon>
</view> -->
</view>
<view class="content_item flex-between" v-if="showtypes ==1">
<view class="content_itemone">
会员卡有效期
</view>
<view class="content_itemtow flex-start" v-if="showtypes ==1">
<text class="content_itemtow_text">不限</text>
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
</view>
</view>
<view class="indextext" style="color: #666666;" v-if="showtypes ==1">
<u--textarea v-model="show" placeholder="简单描述"></u--textarea>
</view>
<view class="baocun" @click="servicecreatevipbalabce" v-if="showtypes ==1">
保存
</view>
<view class="content_item flex-between" v-if="showtypes ==2" v-for="(item,index) in listorder" :key="index"
@click="content_itemonesitem(item)">
<view class="content_itemones">
{{item.title}}
</view>
<view class="content_itemtow flex-start">
<text class="content_itemtow_text" style="color: red;">{{item.show}}</text>
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
</view>
</view>
<view class="contentfixed" @click="add" v-if="showtypes ==1">
+
</view>
<view class="contentfixed" @click="content_itemonesitem" v-if="showtypes ==2">
+
</view>
<u-action-sheet :actions="oneactionslist" :show="showsheetone" @select="selectClick"></u-action-sheet>
</view>
</template>
<script>
export default {
data() {
return {
show: '',
showtypes: 1,
showname: '充值卡',
showsheetone: false,
listorder: [],
oneactionslist: [{
name: '次卡',
},
{
name: '充值卡', //开启后文字不显示
}
],
recharge_amount: [{
"amount": 100,
"deliver": 10
}]
}
},
async onLoad() {
try {
this.serviceseccardlist()
let res = await this.api.servicebalabceinfo()
this.recharge_amount = res.data.recharge_amount
this.show = res.data.show
} catch (e) {
//TODO handle the exception
}
},
onShow() {
this.serviceseccardlist()
},
methods: {
selectClick(e) {
console.log(e)
if (e.name == '充值卡') {
this.showtypes = 1
} else {
this.showtypes = 2
}
this.showname = e.name
this.showsheetone = false
},
content_itemonesitem(e) {
uni.pro.navigateTo('shop/secondarycard', {
id: e.id
})
},
reducetext(e) {
if (this.recharge_amount.length < 2) {
uni.showToast({
title: '充值列表不能为空',
icon: 'none'
});
return false
}
this.recharge_amount.splice(e, 1)
},
add() {
if (this.recharge_amount.length > 19) {
uni.showToast({
title: '充值列表不能大于20条',
icon: 'none'
});
return false
}
this.recharge_amount.push({
"amount": 100,
"deliver": 10
})
},
async serviceseccardlist() {
let res = await this.api.serviceseccardlist();
this.listorder = res.data
console.log(res.data)
},
async servicecreatevipbalabce(e) {
if (this.recharge_amount == null || this.recharge_amount == '') {
uni.showToast({
title: '充值不能有空白',
icon: 'none'
});
return false;
}
if (this.recharge_amount == null || this.recharge_amount == '') {
uni.showToast({
title: '请填写联系人',
icon: 'none'
});
return false;
}
let res = await this.api.servicecreatevipbalabce({
recharge_amount: this.recharge_amount,
show: this.show
});
if (res.code == 1) {
uni.showToast({
title: '保存成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
},
}
}
</script>
<style lang="scss">
page {}
.index {
.indextext {
padding: 12rpx 24rpx;
font-size: 28rpx;
font-family: SourceHanSansCN-Bold, SourceHanSansCN;
font-weight: bold;
color: #6699FF;
}
.baocun {
margin: 40rpx auto;
width: 90%;
padding: 18rpx 0;
background: #6699FF;
text-align: center;
border-radius: 16rpx;
font-size: 32rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #FFFFFF;
}
.content_itemecharge {
width: 100%;
position: relative;
padding: 16rpx 46rpx;
background: #F9F9F9;
.content_itemeabsolute {
position: absolute;
top: 0;
right: 20rpx;
}
.flex-start {
text {
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
input {
width: 162rpx;
height: 48rpx;
background: #FFFFFF;
border: 2rpx solid #D0CFCF;
}
}
}
.contentfixed {
position: fixed;
background: #2F87FD;
bottom: 16%;
right: 5%;
font-size: 52rpx;
color: #FFFFFF;
width: 100rpx;
height: 100rpx;
line-height: 100rpx;
text-align: center;
border-radius: 50%;
}
.content_item {
width: 100%;
padding: 16rpx 24rpx;
border-bottom: 2rpx solid #E5E5E5;
.content_itemone::before {
margin-left: 10px;
content: '*';
display: inline-block;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #EE1717;
}
.content_itemones {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 500;
color: #333333;
}
.content_itemone {
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #333333;
}
.content_itemtow {
font-size: 28rpx;
.content_itemtow_text {
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #333333;
}
}
}
}
</style>

208
pages/shop/promotion.vue Normal file
View File

@@ -0,0 +1,208 @@
<template>
<view class="index">
<view class="indextextbackground">
<view class="indextext flex-colum">
<view class="indextextone">
分享到微信 提升店铺影响力
</view>
<image class="indextexttowimage" :src="src" @longpress="openimg" mode=""></image>
<view class="indextextbox flex-center yks-sub1" @click="saveImg">
<u-icon name="weixin-fill" color="#42ae3e" size="28"></u-icon>
<text class="indextextboxtext">分享到微信</text>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
src: ''
}
},
async onLoad() {
let res = await this.api.usercreateminicode()
this.src = res.data
console.log(res.data)
},
onShow() {},
methods: {
openimg(e) {
uni.previewImage({
// 需要预览的图片链接列表
urls:[this.src],
// 为当前显示图片的链接/索引值
current:[this.src],
// 图片指示器样式
indicator: 'default',
// 是否可循环预览
loop: false,
// 长按图片显示操作菜单,如不填默认为保存相册
// longPressActions:{
// itemList:[this.l('发送给朋友'),this.l]
// },
success: res => {
console.log('res', res);
},
fail: err => {
console.log('err', err);
}
});
},
saveImg() {
var this_ = this;
//用户需要授权
wx.getSetting({
success: (res) => {
if (!res.authSetting['scope.writePhotosAlbum']) {
wx.authorize({
scope: 'scope.writePhotosAlbum',
success: () => { // 同意授权
this.saveImg1();
},
fail: (res) => {
//authorize:fail auth deny" 用户首次点拒绝
//authorize:fail 系统错误,错误码:-12006,auth deny 用户点了拒绝后除非清缓存(用户删小程序),否则会默认这个选项
//上述两个都要弹出引导说要授权相册
var string = res.errMsg;
if (string.indexOf("auth deny") >
0
) { //用户点了拒绝后,以后都会出现这个错误
//c.handleSetting(c);
wx.showModal({
title: '提示',
content: '保存图片失败,请点击下方去授权按钮开启相册访问权限再点击保存',
showCancel: false,
success(res) {
if (res.confirm) {
this_.setData({
is_shouquan: 0
})
}
}
})
}
}
})
} else {
this_.saveImg1();
}
},
fail: (res) => {
wx.showToast({
title: res,
icon: 'none',
duration: 2000,
})
console.log(res);
}
})
},
saveImg1() {
uni.downloadFile({
url: this.src,
success: (data) => {
console.log(data)
wx.showShareImageMenu({
path: data.tempFilePath,
success: (res) => {
wx.showToast({
title: '已成功!',
icon: 'none',
duration: 3000,
});
},
})
},
fail: (res) => {
console.log(res)
if (res.errMsg.indexOf('deny') != -1 || res.errMsg.indexOf('denied') != -1) {
wx.showToast({
title: '保存相册失败,请设置权限!',
icon: 'none',
duration: 2000,
})
} else {
wx.showToast({
title: '保存相册失败,请重试!',
icon: 'none',
duration: 2000,
});
}
}
});
// uni.getimageinfo({
// src: this.src,
// success:(data)=>{
// console.log(data)
// wx.showShareImageMenu({
// path: data.path
// })
// },
// })
},
}
}
</script>
<style lang="scss">
page {
background: #f5f5f5;
}
.index {
.indextextbackground {
position: relative;
width: 100%;
height: 250rpx;
padding: 28rpx 32rpx;
border-bottom-left-radius: 35%;
border-bottom-right-radius: 35%;
background: #fec24d;
.indextext {
width: 100%;
margin-top: 40rpx;
padding: 28rpx 0;
justify-content: flex-start;
border-radius: 20rpx;
background: #fff;
}
.indextexttowimage {
width: 400rpx;
height: 400rpx;
}
.indextextone {
font-size: 28rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #000;
}
.indextextbox {
margin-top: 20rpx;
border-radius: 50rpx;
padding: 16rpx 0;
text-align: center;
width: 70%;
background: linear-gradient(115deg, #ffe873 0%, #fec44f 100%);
.indextextboxtext {
margin-left: 20rpx;
font-size: 28rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: 400;
color: #000;
}
}
}
}
</style>

View File

@@ -0,0 +1,404 @@
<template>
<view class="index">
<view class="indextext">
基本信息
</view>
<view class="onecontent">
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
标题
</view>
<view class="onecontent_itemright flex-start">
<input class="onecontent_itemright_text" v-model="form.title" type="text" placeholder="请输入标题" />
</view>
</view>
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
说明
</view>
<view class="onecontent_itemright flex-start">
<input class="onecontent_itemright_text" v-model="form.show" type="text" placeholder="请输入说明" />
</view>
</view>
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
价格
</view>
<view class="onecontent_itemright flex-start">
<input class="onecontent_itemright_text" v-model="form.price" @input="checkNum(1,$event)"
type="text" placeholder="请输入价格" />
</view>
</view>
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
次数
</view>
<u-number-box integer v-model="form.frequ"></u-number-box>
</view>
<view @click="showsheetone = true" class="onecontent_item flex-between">
<view class="onecontent_itemleft">
会员卡有效期
</view>
<text>{{form.duration_str}}</text>
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
</view>
<view @click="demos" class="onecontent_item flex-between">
<view class="onecontent_itemleft">
购买须知
</view>
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
</view>
</view>
<view class="baocun" @click="servicecreateseccard">
保存
</view>
<u-action-sheet :actions="oneactionslist" :show="showsheetone" @select="selectClick"></u-action-sheet>
</view>
</template>
<script>
import editor from '@/components/editor/editor.vue';
export default {
components: {
//引入项目组件
editor
},
data() {
return {
showsheetone: false,
oneactionslist: [{
id: 1,
name: '一个月',
},
{
id: 2,
name: '半年', //开启后文字不显示
}, {
id: 3,
name: '一年', //开启后文字不显示
}
],
form: {
frequ: 1
},
}
},
async onLoad(e) {
let ress = await this.api.staffgetvipduratio();
this.oneactionslist = ress.data
if (e.id) {
uni.setNavigationBarTitle({
title: '修改次卡'
})
let res = await this.api.serviceseccarddesc({
id: e.id
});
this.form = res.data
} else {
uni.setNavigationBarTitle({
title: '添加次卡'
})
}
},
mounted() {
this.$bus.$on('showeditors', this.demo)
},
methods: {
selectClick(e) {
this.form.duration = e.id
this.form.duration_str = e.name
this.showsheetone = false
},
demo(data) {
console.log(data)
this.form.notice = data
},
demos() {
uni.pro.navigateTo('shop/editor/editor', {
id: this.form.id
})
},
// 方法
checkNum(a, e) {
let val = e.target.value.replace(/(^\s*)|(\s*$)/g, "")
console.log(val);
if (!val) {
this.form.price = '';
return
}
var reg = /[^\d.]/g
// 只能是数字和小数点,不能是其他输入
val = val.replace(reg, "")
// // 保证第一位只能是数字,不能是点
val = val.replace(/^\./g, "");
// // 小数只能出现1位
val = val.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
// // 小数点后面保留2位
val = val.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3');
console.log(val);
this.$nextTick(() => {
this.form.price = val;
})
},
async servicecreateseccard() {
if (this.form.title == null || this.form.title == '') {
uni.showToast({
title: '标题不能为空',
icon: 'none'
});
return false;
}
if (this.form.show == null || this.form.show == '') {
uni.showToast({
title: '说明不能为空',
icon: 'none'
});
return false;
}
if (this.form.price == null || this.form.price == '') {
uni.showToast({
title: '价格不能为空',
icon: 'none'
});
return false;
}
if (this.form.frequ == null || this.form.frequ == '') {
uni.showToast({
title: '次数不能为空',
icon: 'none'
});
return false;
}
if (this.form.notice == null || this.form.notice == '') {
uni.showToast({
title: '购买须知不能为空',
icon: 'none'
});
return false;
}
let res = await this.api.servicecreateseccard({
title: this.form.title,
show: this.form.show,
price: this.form.price,
frequ: this.form.frequ,
notice: this.form.notice,
id: this.form.id,
duration:this.form.duration
});
if (res.code == 1) {
uni.showToast({
title: '保存成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
},
}
}
</script>
<style lang="scss">
page {}
.index {
.indextext {
padding: 12rpx 24rpx;
font-size: 28rpx;
font-family: SourceHanSansCN-Bold, SourceHanSansCN;
font-weight: bold;
color: #6699FF;
}
.baocun {
margin: 40rpx auto;
width: 90%;
padding: 18rpx 0;
background: #6699FF;
text-align: center;
border-radius: 16rpx;
font-size: 32rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #FFFFFF;
}
.content_item {
width: 100%;
padding: 16rpx 24rpx;
border-bottom: 2rpx solid #E5E5E5;
.content_itemone::before {
margin-left: 10px;
content: '*';
display: inline-block;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #EE1717;
}
.content_itemone {
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #333333;
}
.content_itemtow {
font-size: 28rpx;
.content_itemtow_text {
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #333333;
}
}
}
.onecontent {
background: #ffffff;
.onecontent_item {
width: 100%;
padding: 16rpx 46rpx;
border-bottom: 2rpx solid #E5E5E5;
.onecontent_itemleft {
flex: 1;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
.onecontent_itemright {
flex: 3;
.onecontent_itemrighttext {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
.onecontent_itemrightimges {
width: 112rpx;
height: 112rpx;
background: #F5F5F5;
border-radius: 10rpx;
font-size: 40rpx;
color: #878787;
image {
width: 112rpx;
height: 112rpx;
}
}
.onecontent_itemright_text {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
.flex-start {
.fourcontent {
.fourcontent_item {
position: relative;
margin-top: 16rpx;
margin-left: 20rpx;
width: 112rpx;
height: 112rpx;
border-radius: 16rpx;
image {
width: 112rpx;
height: 112rpx;
border-radius: 16rpx;
}
.fourcontent_itemtext {
position: absolute;
top: 0rpx;
right: 0rpx;
}
}
}
}
}
.onecontent {
background: #ffffff;
padding-bottom: 20rpx;
.onecontentscrolls {
width: 564rpx;
height: 190rpx;
margin: 0 auto;
border-radius: 10rpx;
background: #f5f5f5;
.onecontentscrollsimage {
width: 564rpx;
height: 190rpx;
}
}
.onecontentone {
width: 694rpx;
text-align: center;
margin: 20rpx auto;
background: #6699FF;
border-radius: 16rpx;
padding: 18rpx 0;
font-size: 32rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #FFFFFF;
}
.onecontentscrolllang {
padding: 28rpx 20rpx;
.onecontentscroll_item {
background: #f5f5f5;
border-radius: 10rpx;
width: 140rpx;
height: 140rpx;
}
}
.onecontentscroll {
padding: 28rpx 20rpx;
.onecontentscroll_item {
position: relative;
.onecontentscroll_itemimage {
border-radius: 10rpx;
width: 140rpx;
height: 140rpx;
}
.onecontentscrollicon {
position: absolute;
top: -10rpx;
right: -10rpx;
}
}
}
}
}
}
</style>

562
pages/shop/store.vue Normal file
View File

@@ -0,0 +1,562 @@
<template>
<view class="index">
<view class="title_text">
基本信息
</view>
<view class="onecontent">
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
门店logo
</view>
<view class="onecontent_itemright flex-start">
<view class="onecontent_itemrightimges flex-colum" v-if="!form.avatar" @click="chooseImagelist()">
+
</view>
<view v-else class="onecontent_itemrightimges flex-colum" @click="chooseImagelist()">
<image :src="form.avatar"></image>
</view>
</view>
</view>
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
门店名称
</view>
<view class="onecontent_itemright flex-start">
<input class="onecontent_itemright_text" v-model="form.title" type="text" placeholder="请输入门店名称">
</view>
</view>
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
门店ID
</view>
<view class="onecontent_itemright flex-start">
<input disabled class="onecontent_itemright_text" v-model="form.id" type="text" placeholder="001">
</view>
</view>
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
营业时间
</view>
<view class="onecontent_itemright flex-start" @click="showpicker = true">
<text class="onecontent_itemright_text">{{form.b_hours || '请选择营业时间'}}</text>
</view>
</view>
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
联系人
</view>
<view class="onecontent_itemright flex-start">
<input class="onecontent_itemright_text" v-model="form.contacts" type="text" placeholder="请输入联系人">
</view>
</view>
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
门店电话
</view>
<view class="onecontent_itemright flex-start">
<input class="onecontent_itemright_text" v-model="form.mobile" type="text" placeholder="请输入门店电话">
</view>
</view>
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
详细地址
</view>
<view class="onecontent_itemright flex-start">
<input class="onecontent_itemright_text" v-model="form.address" type="text" placeholder="请输入详细地址">
</view>
</view>
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
我的背景
</view>
<view class="onecontent_itemright flex-start">
<view class="onecontent_itemrightimges flex-colum" v-if="!form.my_background"
@click="chooseImagelists()">
+
</view>
<view v-else class="onecontent_itemrightimges flex-colum" @click="chooseImagelists()">
<image :src="form.my_background"></image>
</view>
</view>
</view>
<view class="title_text">
上传图片
</view>
<view class="onecontent" style="margin-left: 26rpx;">
<u-scroll-list :indicator="false">
<view v-for="(item, index) in form.bananer" :key="index" class="onecontentscroll">
<view class="onecontentscroll_item">
<image class="onecontentscroll_itemimage" :src="item"></image>
<view class="onecontentscrollicon" @click="remove(index)">
<u-icon name="close-circle-fill" color="#333" size="20"></u-icon>
</view>
</view>
</view>
<view class="onecontentscrolllang" v-if="form.bananer.length<10" @click="add()">
<view class="onecontentscroll_item flex-colum">
<u-icon name="plus" color="#333" size="20"></u-icon>
</view>
</view>
</u-scroll-list>
</view>
<!-- <view class="onecontent_item flex-between" @click="chooseLocation">
<view class="onecontent_itemleft">
门店经纬度
</view>
<view class="onecontent_itemright flex-start">
<input disabled class="onecontent_itemright_text" v-model="lnglat" type="text" placeholder="门店经纬度">
</view>
</view> -->
</view>
<view class="baocun" @click="userstoreset">
保存
</view>
<u-picker :show="showpicker" @cancel='showpicker = false' ref="uPicker" :columns="columnspicker"
@confirm="confirm"></u-picker>
</view>
</template>
<script>
import uploadImage from "@/js_sdk/yushijie-ossutil/ossutil/uploadFile.js";
export default {
data() {
return {
sheetshow: false,
placeholder: '开始输入文章内容...',
editorCtx: '',
lnglat: '',
showpicker: false,
columnspicker: [
['00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00',
'11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00',
'21:00', '22:00', '23:00', '24:00'
],
['00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00',
'11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00',
'21:00', '22:00', '23:00', '24:00'
],
],
form: {
title: '',
details: '',
avatar: '',
my_background: '',
b_hours: '',
bananer: ''
}
}
},
async onLoad() {
try {
let res = await this.api.userstoredetail()
this.form = res.data
this.lnglat = res.data.lat + '-' + res.data.lng
} catch (e) {
//TODO handle the exception
}
},
onShow() {
},
mounted() {
this.$bus.$on('editors', this.demo)
},
methods: {
confirm(e) {
if (e.indexs[0] == e.indexs[1]) {
uni.showToast({
title: '选择时间不能相同'
})
} else {
console.log(e)
this.form.b_hours = e.value[0] + '-' + e.value[1]
this.showpicker = false
}
},
remove(e) {
console.log(e)
this.form.bananer.splice(e, 1)
},
add() {
uni.showLoading({
title: '上传中',
mask: true
})
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: (res) => {
let file = res.tempFilePaths[0];
uploadImage(file, 'wechat/indexbananer/',
result => {
this.form.bananer.push(result)
uni.hideLoading()
}, result => {
uni.hideLoading()
})
},
fail: (res) => {
uni.hideLoading()
}
});
},
chooseLocation() {
uni.chooseLocation({
success: (res) => {
this.form.address = res.address
this.form.lat = res.latitude
this.form.lng = res.longitude
this.lnglat = res.latitude + '-' + res.longitude
console.log('位置名称:' + res.name);
console.log('详细地址:' + res.address);
console.log('纬度:' + res.latitude);
console.log('经度:' + res.longitude);
},
fail: (res) => {
console.log(res)
}
});
},
demo(data) {
this.form.details = data
},
demos() {
uni.pro.navigateTo('project/editor/editor', {
id: this.form.service_id
})
},
async userstoreset() {
console.log(this.form)
if (this.form.title == null || this.form.title == '') {
uni.showToast({
title: '商户名称不能为空',
icon: 'none'
});
return false;
}
if (this.form.contacts == null || this.form.contacts == '') {
uni.showToast({
title: '请填写联系人',
icon: 'none'
});
return false;
}
if (this.form.mobile == null || this.form.mobile == '') {
uni.showToast({
title: '手机号不能为空',
icon: 'none'
});
return false;
}
if (this.form.address == null || this.form.address == '') {
uni.showToast({
title: '地址不能为空',
icon: 'none'
});
return false;
}
if (this.form.avatar == null || this.form.avatar == '') {
uni.showToast({
title: '图片不能为空',
icon: 'none'
});
return false;
}
let res = await this.api.userstoreset({
title: this.form.title,
contacts: this.form.contacts,
mobile: this.form.mobile,
address: this.form.address,
lng: this.form.lng,
lat: this.form.lat,
avatar: this.form.avatar,
background: this.form.my_background,
bananer: this.form.bananer.toString(),
b_hours: this.form.b_hours
});
if (res.code == 1) {
uni.showToast({
title: '保存成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
},
async servicedelservice() {
var this_ = this
console.log(this.form.service_id)
uni.showModal({
title: '提示',
content: '确认删除该商品吗?',
success: async (res) => {
if (res.confirm) {
let data = await this.api.servicedelservice({
service_id: this.form.service_id
});
if (data.code == 1) {
uni.showToast({
title: '删除成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
// 上传
chooseImagelist() {
uni.showLoading({
title: '上传中',
mask: true
})
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: (res) => {
let file = res.tempFilePaths[0];
uploadImage(file, 'wechat/store/',
result => {
this.form.avatar = ''
this.form.avatar = result
uni.hideLoading()
}, result => {
uni.hideLoading()
})
},
fail: (res) => {
uni.hideLoading()
}
});
},
// 上传
chooseImagelists() {
uni.showLoading({
title: '上传中',
mask: true
})
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: (res) => {
let file = res.tempFilePaths[0];
uploadImage(file, 'wechat/store/',
result => {
this.form.my_background = ''
this.form.my_background = result
uni.hideLoading()
}, result => {
uni.hideLoading()
})
},
fail: (res) => {
uni.hideLoading()
}
});
},
onEditorReady() {
// #ifdef MP-BAIDU
this.editorCtx = requireDynamicLib('editorLib').createEditorContext('editor');
// #endif
// #ifdef APP-PLUS || H5 ||MP-WEIXIN
uni.createSelectorQuery().select('#editor').context((res) => {
this.editorCtx = res.context
}).exec()
// #endif
},
undo() {
this.editorCtx.undo()
}
}
}
</script>
<style lang="scss">
page {
background: #F6F6F6;
}
.index {
.title_text {
padding: 12rpx 40rpx;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
#editor {
width: 100%;
height: 456rpx;
padding: 12rpx 40rpx;
background: #FFFFFF;
}
.baocun {
margin: 40rpx auto;
width: 90%;
padding: 18rpx 0;
background: #6699FF;
text-align: center;
border-radius: 16rpx;
font-size: 32rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #FFFFFF;
}
.onecontent {
background: #ffffff;
.onecontent_item {
width: 100%;
padding: 16rpx 46rpx;
border-bottom: 2rpx solid #E5E5E5;
.onecontent_itemleft {
flex: 1;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
.onecontent_itemright {
flex: 3;
.onecontent_itemrighttext {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
.onecontent_itemrightimges {
width: 112rpx;
height: 112rpx;
background: #F5F5F5;
border-radius: 10rpx;
font-size: 40rpx;
color: #878787;
image {
width: 112rpx;
height: 112rpx;
}
}
.onecontent_itemright_text {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
.flex-start {
.fourcontent {
.fourcontent_item {
position: relative;
margin-top: 16rpx;
margin-left: 20rpx;
width: 112rpx;
height: 112rpx;
border-radius: 16rpx;
image {
width: 112rpx;
height: 112rpx;
border-radius: 16rpx;
}
.fourcontent_itemtext {
position: absolute;
top: 0rpx;
right: 0rpx;
}
}
}
}
}
.onecontent {
background: #ffffff;
padding-bottom: 20rpx;
.onecontentscrolls {
width: 564rpx;
height: 190rpx;
margin: 0 auto;
border-radius: 10rpx;
background: #f5f5f5;
.onecontentscrollsimage {
width: 564rpx;
height: 190rpx;
}
}
.onecontentone {
width: 694rpx;
text-align: center;
margin: 20rpx auto;
background: #6699FF;
border-radius: 16rpx;
padding: 18rpx 0;
font-size: 32rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #FFFFFF;
}
.onecontentscrolllang {
padding: 28rpx 20rpx;
.onecontentscroll_item {
background: #f5f5f5;
border-radius: 10rpx;
width: 140rpx;
height: 140rpx;
}
}
.onecontentscroll {
padding: 28rpx 20rpx;
.onecontentscroll_item {
position: relative;
.onecontentscroll_itemimage {
border-radius: 10rpx;
width: 140rpx;
height: 140rpx;
}
.onecontentscrollicon {
position: absolute;
top: -10rpx;
right: -10rpx;
}
}
}
}
}
}
</style>

187
pages/shop/upload.vue Normal file
View File

@@ -0,0 +1,187 @@
<template>
<view class="index">
<view class="title_text">
上传图片
</view>
<view class="onecontent">
<u-scroll-list :indicator="false">
<view v-for="(item, index) in list" :key="index" class="onecontentscroll">
<view class="onecontentscroll_item">
<image class="onecontentscroll_itemimage" :src="item"></image>
<view class="onecontentscrollicon" @click="remove(index)">
<u-icon name="close-circle-fill" color="#333" size="20"></u-icon>
</view>
</view>
</view>
<view class="onecontentscrolllang" v-if="list.length<25" @click="add(1)">
<view class="onecontentscroll_item flex-colum">
<u-icon name="plus" color="#333" size="20"></u-icon>
</view>
</view>
</u-scroll-list>
</view>
<view class="title_text">
上传首页背景
</view>
<view class="onecontent" style="padding-top: 20rpx;">
<view class="onecontentscrolls flex-colum">
<image class="onecontentscrollsimage" @click="add(2)" v-if="background" :src="background" mode="">
</image>
<u-icon name="plus" v-else color="#333" size="20"></u-icon>
</view>
<view class="onecontentone" @click="useruploadalbum">
保存
</view>
</view>
</view>
</template>
<script>
import uploadImage from "@/js_sdk/yushijie-ossutil/ossutil/uploadFile.js";
export default {
data() {
return {
background: "https://cdn.uviewui.com/uview/goods/1.jpg",
list: ["https://cdn.uviewui.com/uview/goods/1.jpg", "https://cdn.uviewui.com/uview/goods/2.jpg"]
}
},
async onLoad() {
let res = await this.api.useralbumview()
this.background = res.data.background
this.list = res.data.album
},
onShow() {},
methods: {
remove(e) {
this.list.splice(e, 1)
},
add(elang) {
// 上传
uni.showLoading({
title: '上传中',
mask: true
})
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: (res) => {
let file = res.tempFilePaths[0];
uploadImage(file, 'wechat/upload/',
result => {
if (elang == 1) {
this.list.push(result)
} else {
this.background = result
}
uni.hideLoading()
}, result => {
uni.hideLoading()
})
},
fail: (res) => {
uni.hideLoading()
}
});
},
async useruploadalbum(e) { //上传相册
console.log( this.list)
let res = await this.api.useruploadalbum({
album: this.list,
background: this.background
});
console.log(res)
if (res.code == 1) {
uni.showToast({
title: '保存成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack()
}, 1000);
}
},
}
}
</script>
<style lang="scss">
page {
background: #F6F6F6;
}
.index {
.title_text {
padding: 12rpx 40rpx;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
.onecontent {
background: #ffffff;
padding-bottom: 20rpx;
.onecontentscrolls {
width: 564rpx;
height: 190rpx;
margin: 0 auto;
border-radius: 10rpx;
background: #f5f5f5;
.onecontentscrollsimage {
width: 564rpx;
height: 190rpx;
}
}
.onecontentone {
width: 694rpx;
text-align: center;
margin: 20rpx auto;
background: #6699FF;
border-radius: 16rpx;
padding: 18rpx 0;
font-size: 32rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #FFFFFF;
}
.onecontentscrolllang {
padding: 50rpx 20rpx;
.onecontentscroll_item {
background: #f5f5f5;
border-radius: 10rpx;
width: 140rpx;
height: 140rpx;
}
}
.onecontentscroll {
padding: 50rpx 20rpx;
.onecontentscroll_item {
position: relative;
.onecontentscroll_itemimage {
border-radius: 10rpx;
width: 140rpx;
height: 140rpx;
}
.onecontentscrollicon {
position: absolute;
top: -10rpx;
right: -10rpx;
}
}
}
}
}
</style>