初始化

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

8
.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
/node_modules
.env
.env.backup
.phpunit.result.cache
docker-compose.override.yml
npm-debug.log
yarn-error.log
/unpackage

20
.hbuilderx/launch.json Normal file
View File

@ -0,0 +1,20 @@
{ // launch.json configurations app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtypelocalremote, localremote
"version": "0.0",
"configurations": [{
"app-plus" :
{
"launchtype" : "local"
},
"default" :
{
"launchtype" : "local"
},
"mp-weixin" :
{
"launchtype" : "local"
},
"type" : "uniCloud"
}
]
}

6
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"files.associations": {
"*.ttml": "xml",
"*.ttss": "css"
}
}

57
App.vue Normal file
View File

@ -0,0 +1,57 @@
<script>
export default {
onLaunch: function() {
uni.cache.autoRemove()
// const updateManager = wx.getUpdateManager()
// updateManager.onCheckForUpdate(function(res) {
// //
// console.log(res.hasUpdate)
// if (res.hasUpdate) {
// wx.showToast({
// title: ""
// });
// }
// })
// updateManager.onUpdateReady(function() {
// wx.showModal({
// title: '',
// content: '',
// success: function(res) {
// if (res.confirm) {
// // applyUpdate
// updateManager.applyUpdate()
// } else {
// wx.showToast({
// icon: "none",
// title: "使"
// });
// wx.exitMiniProgram();
// }
// }
// })
// })
// updateManager.onUpdateFailed(function() {
// //
// wx.showToast({
// icon: "none",
// title: "..."
// });
// })
},
async onShow() {
this.$store.dispatch("HeightActions"); //
},
onHide: function() {}
}
</script>
<style lang="scss">
@import '@/uni_modules/uview-ui/index.scss';
/* #ifndef APP-PLUS-NVUE */
@import './common/css/uni.scss';
/* #endif */
/* uni.scss */
@import './common/css/flex.css';
</style>

View File

@ -1 +0,0 @@
#czg_business_wechat

48
common/css/flex.css Normal file
View File

@ -0,0 +1,48 @@
.flex-center{
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
}
.flex-start{
display: flex;
justify-content: flex-start;
align-items: center;
flex-wrap: wrap;
}
.flex-end{
display: flex;
justify-content: flex-end;
align-items: center;
flex-wrap: wrap;
}
.flex-colum{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.flex-colum-start{
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
}
.flex-colum-end{
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-end;
}
.flex-between{
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
}
.flex-around{
display: flex;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
}

1534
common/css/uni.scss Normal file

File diff suppressed because it is too large Load Diff

173
common/js/api.js Normal file
View File

@ -0,0 +1,173 @@
// uni.api.notice = type => uni.api.fetch('notice', {type}, true)
// uni.api.banner = () => uni.api.get('banner')
// uni.api.get_sms_code = data => uni.api.get('get_sms_code', data)
export default {
userlogin(data) { //
return uni.api.post("/user/login", data);
},
orderlist(data) { //订单列表
return uni.api.post("/order/list", data,false);
},
orderreselist(data) { //预约列表
return uni.api.post("/order/reselist", data);
},
orderorderrefund(data) { //取消订单
return uni.api.post("/order/orderrefund", data);
},
orderstartsercive(data) { //开始服务
return uni.api.post("/order/startsercive", data);
},
orderorderdetail(data) { //订单详情
return uni.api.post("/order/orderdetail", data);
},
orderorderrefunddetail(data) { //退款详情
return uni.api.post("/order/orderrefunddetail", data);
},
userlogout(data) { //退出登录
return uni.api.post("/user/logout", data);
},
serviceitemclass(data) { //项目分类
return uni.api.post("/service/itemclass", data);
},
servicecreateitemclass(data) { //创建项目分类
return uni.api.post("/service/createitemclass", data);
},
servicecreateitem(data) { //创建项目
return uni.api.post("/service/createitem", data);
},
servicedetail(data) { //项目详情
return uni.api.post("/service/detail", data);
},
servicelist(data) { //项目列表
return uni.api.post("/service/list", data,false);
},
servicedelservice(data) { //删除项目
return uni.api.post("/service/delservice", data);
},
userstoredetail(data) { //门店详情
return uni.api.post("/user/storedetail", data);
},
userstoreset(data) { //门店设置
return uni.api.post("/user/storeset", data);
},
servicecreatevipbalabce(data) { //创建/修改充值卡
return uni.api.post("/service/createvipbalabce", data);
},
servicebalabceinfo(data) { //充值卡详情
return uni.api.post("/service/balabceinfo", data);
},
useruploadalbum(data) { //上传相册
return uni.api.post("/user/uploadalbum", data);
},
useralbumview(data) { //相册回显
return uni.api.post("/user/albumview", data);
},
useruserpolicy(data) { //
return uni.api.post("/user/userpolicy", data);
},
usercreateminicode(data) { //生成小程序码
return uni.api.post("/user/createminicode", data);
},
reservationmakenow(data) { //可预约时间
return uni.api.post("/reservation/makenow", data);
},
stafflist(data) { //员工列表
return uni.api.post("/staff/list", data,false);
},
staffstaffreturn(data) { //员工信息回显
return uni.api.post("/staff/staffreturn",data);
},
staffcreatestaff(data) { //创建员工
return uni.api.post("/staff/createstaff",data);
},
staffsavestaff(data) { //修改员工信息
return uni.api.post("/staff/savestaff",data);
},
servicecreateseccard(data) { //创建/修改次卡
return uni.api.post("/service/createseccard",data);
},
serviceseccardlist(data) { //次卡列表
return uni.api.post("/service/seccardlist",data);
},
serviceseccarddesc(data) { //次卡详情
return uni.api.post("/service/seccarddesc",data);
},
staffbhoures(data) { //营业时间
return uni.api.post("/staff/bhoures",data);
},
staffsavestaffhours(data) { //休息时间
return uni.api.post("/staff/savestaffhours",data);
},
orderokprebook(data) { //确认预约
return uni.api.post("/order/okprebook",data);
},
orderrefuseprebook(data) { //拒绝预约
return uni.api.post("/order/refuseprebook",data);
},
staffdeletestaff(data) { //删除员工
return uni.api.post("/staff/deletestaff",data);
},
staffgetvipduratio(data) { //会员卡有效期
return uni.api.post("/staff/getvipduratio",data);
},
userautollogin(data) { //自动登录
return uni.api.post("/user/autollogin",data);
},
useraccountlist(data) { //账号列表
return uni.api.post("/user/accountlist",data);
},
shoppinglist(data) { //订单列表
return uni.api.post("/shopping/list",data);
},
shoppingorderdetailt(data) { //订单详情
return uni.api.post("/shopping/orderdetail",data);
},
shoppingorderrefund(data) { //取消订单并退款
return uni.api.post("/shopping/orderrefund",data);
},
shoppingorsuboutgoods(data) { //发货提交
return uni.api.post("/shopping/suboutgoods",data);
},
shoppinggoodslist(data) { //商品列表
return uni.api.post("/shopping/goodslist",data);
},
shoppingcreategoods(data) { //创建/编辑商品
return uni.api.post("/shopping/creategoods",data);
},
shoppingcreategoodstype(data) { //创建/修改商品分类
return uni.api.post("/shopping/creategoodstype",data);
},
shoppinggooodstype(data) { //商品分类
return uni.api.post("/shopping/gooodstype",data);
},
shoppingdeletegoodstype(data) { //删除分类
return uni.api.post("/shopping/deletegoodstype",data);
},
shoppinggoodsdetail(data) { //商品详情
return uni.api.post("/shopping/goodsdetail",data);
},
shoppingdeletegoods(data) { //商品详情
return uni.api.post("/shopping/deletegoods",data);
},
staffemployee(data) { //员工分类
return uni.api.post("/staff/employee",data);
},
staffemployeeadd(data) { //员工分类添加/编辑
return uni.api.post("/staff/employeeadd",data);
},
staffemployeedel(data) { //删除员工分类
return uni.api.post("/staff/employeedel",data);
},
servicedelservice(data) { //删除项目
return uni.api.post("/service/delservice",data);
},
servicedeleteitem(data) { //删除项目分类
return uni.api.post("/service/deleteitem",data);
},
serviceitemclass(data) { //项目分类
return uni.api.post("/service/itemclass",data);
},
usergetopenid(data) { //openid
return uni.api.post("/user/getopenid",data);
},
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,271 @@
<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.servicedetail({
service_id: e.id
})
if (res.code = 1) {
var thisdatadescribe = res.data.details
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('editors', 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/',
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.

View File

@ -0,0 +1,197 @@
<template>
<view v-if="showPrivacy" :class="privacyClass">
<view :class="contentClass">
<view class="title">用户隐私保护指引</view>
<view class="des">
感谢您选择使用预约商家端小程序我们非常重视您的个人信息安全和隐私保护使用我们的产品前请您仔细阅读
<text class="link" @tap="openPrivacyContract">{{privacyContractName}} </text>
如您同意此隐私保护指引,请点击同意按钮,开始使用此小程序,我们将尽全力保护您的个人信息及合法权益感谢您的信任<br />
</view>
<view class="btns">
<button class="item reject" @click="exitMiniProgram">拒绝</button>
<button id="agree-btn" class="item agree" open-type="agreePrivacyAuthorization"
@agreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'PrivacyPopup',
data() {
return {
isRead: false,
showPrivacy: false,
privacyContractName: '',
resolvePrivacyAuthorization: null,
};
},
props: {
position: {
type: String,
default: 'center'
}
},
computed: {
privacyClass() {
return this.position === 'bottom' ? 'privacy privacy-bottom' : 'privacy';
},
contentClass() {
return this.position === 'bottom' ? 'content content-bottom' : 'content';
}
},
mounted() {
if (uni.onNeedPrivacyAuthorization) {
uni.onNeedPrivacyAuthorization((resolve) => {
this.resolvePrivacyAuthorization = resolve;
});
}
if (uni.getPrivacySetting) {
uni.getPrivacySetting({
success: (res) => {
if (res.needAuthorization) {
this.privacyContractName = res.privacyContractName;
this.showPrivacy = true;
} else {
this.showPrivacy = false;
}
},
});
}
},
methods: {
openPrivacyContract() {
uni.openPrivacyContract({
success: () => {
this.isRead = true;
},
fail: () => {
uni.showToast({
title: '遇到错误',
icon: 'error',
});
},
});
},
exitMiniProgram() {
// uni.navigateBack();
wx.exitMiniProgram();
},
handleAgreePrivacyAuthorization() {
this.showPrivacy = false;
this.$emit('allowPrivacy');
if (typeof this.resolvePrivacyAuthorization === 'function') {
this.resolvePrivacyAuthorization({
buttonId: 'agree-btn',
event: 'agree',
});
}
},
closePrivacy() {
this.showPrivacy = false;
}
},
};
</script>
<style scoped>
.privacy {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, .5);
z-index: 9999999;
display: flex;
align-items: center;
justify-content: center;
}
.privacy-bottom {
align-items: flex-end;
}
.content {
width: 632rpx;
padding: 48rpx;
box-sizing: border-box;
background: #fff;
border-radius: 16rpx;
}
.content-bottom {
position: absolute;
bottom: 0;
width: 96%;
padding: 36rpx;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
border-radius: 16rpx 16rpx 0 0;
}
.content .title {
text-align: center;
color: #333;
font-weight: bold;
font-size: 32rpx;
}
.content .des {
font-size: 26rpx;
color: #666;
margin-top: 40rpx;
text-align: justify;
line-height: 1.6;
}
.content .des .link {
color: #1989ff;
text-decoration: underline;
}
.btns {
margin-top: 48rpx;
margin-bottom: 12rpx;
display: flex;
}
.btns .item {
width: 200rpx;
height: 72rpx;
overflow: visible;
display: flex;
align-items: center;
justify-content: center;
/* border-radius: 16rpx; */
box-sizing: border-box;
border: none !important;
}
.btns .reject {
background: #f4f4f5;
color: #1989ff;
font-size: 14px;
background: #edf5fe;
font-weight: 300;
margin-right: 16rpx;
}
.btns .agree {
width: 200rpx;
background: #1989ff;
color: #fff;
font-size: 16px;
}
.privacy-bottom .btns .agree {
width: 440rpx;
}
</style>

25
framework/0-conf.js Normal file
View File

@ -0,0 +1,25 @@
const debug = false;
// #ifdef H5
const proxyApi = "/api"
// #endif
// #ifdef MP-WEIXIN
const baseUrl = 'https://door.sxczgkj.cn/api/merchant' // 线上
// #endif
// #ifdef H5
const baseUrl = debug ? proxyApi : 'https://door.sxczgkj.cn/api/merchant' // 线上
// #endif
// import VConsole from "./vConsole.js"
// if (debug) {
// // new VConsole()
// }
const version = '109'
const autoRemoveCache = {
count: 100000,
size: 100000
}
uni.conf = {
debug,
baseUrl,
version,
autoRemoveCache
}

216
framework/1-utils.js Normal file
View File

@ -0,0 +1,216 @@
import md5 from './md5'
/**
* 转换对象为x-www-form-urlencoded
* @author NanQi
* @param {Object} obj
* @return {String}
*/
let transformRequest = obj => {
let query = ''
let name, value, fullSubName, subName, subValue, innerObj, i
for(name in obj) {
value = obj[name]
if(value instanceof Array) {
for(i = 0; i < value.length; ++i) {
subValue = value[i]
fullSubName = name + '[' + i + ']'
innerObj = {}
innerObj[fullSubName] = subValue
query += transformRequest(innerObj) + '&'
}
} else if(value instanceof Object) {
for(subName in value) {
subValue = value[subName]
fullSubName = name + '[' + subName + ']'
innerObj = {}
innerObj[fullSubName] = subValue
query += transformRequest(innerObj) + '&'
}
} else if(value !== undefined && value !== null) {
query += encodeURIComponent(name) + '=' +
encodeURIComponent(value) + '&'
}
}
return query.length ? query.substr(0, query.length - 1) : query
}
let timestamp = function() {
return Date.parse(new Date()) / 1000
}
let isNavigating = false
let isNavigate = () => {
if(isNavigating) {
return true
} else {
isNavigating = true
setTimeout(() => {
isNavigating = false
}, 2000)
return false
}
}
let guid = (function() {
let counter = 0
return function(prefix) {
let guid = new Date().getTime().toString(32),
i
for(i = 0; i < 5; i++) {
guid += Math.floor(Math.random() * 65535).toString(32)
}
return(prefix || '') + guid + (counter++).toString(32)
}
}())
let sortTransform = (obj) => {
var objKeys = Object.keys(obj)
objKeys = objKeys.sort()
var ret = {}
for(var i = 0; i < objKeys.length; i++) {
let objVal = obj[objKeys[i]]
ret[objKeys[i]] = objVal
}
return transformRequest(ret)
}
function isArray(v) {
return toString.apply(v) === '[object Array]'
}
function isFunction(v) {
return typeof v === 'function'
}
function isEmptyObject(v) {
return Object.keys(v).length == 0
}
function sleep (time) {
return new Promise((resolve) => setTimeout(resolve, time))
}
const throttle = function(func, wait = 200, options) {
/* options
* 表示首次调用返回值方法时会马上调用func否则仅会记录当前时刻当第二次调用的时间间隔超过wait时才调用func
* options.leading = true
* 表示当调用方法时未到达wait指定的时间间隔则启动计时器延迟调用func函数若后续在既未达到wait指定的时间间隔和func函数又未被调用的情况下调用返回值方法则被调用请求将被丢弃
* options.trailing = true
* 注意当options.trailing = false时效果与上面的简单实现效果相同
*/
var context, args, result
var timeout = null
var previous = 0
if(!options) options = {
leading: true,
trailing: false
}
var later = function() {
previous = options.leading === false ? 0 : new Date().getTime()
timeout = null
result = func.apply(context, args)
if(!timeout) context = args = null
}
return function() {
var now = new Date().getTime()
if(!previous && options.leading === false) previous = now
// 计算剩余时间
var remaining = wait - (now - previous)
context = this
args = arguments
// 当到达wait指定的时间间隔则调用func函数
if(remaining <= 0 || remaining > wait) {
// 由于setTimeout存在最小时间精度问题因此会存在到达wait的时间间隔但之前设置的setTimeout操作还没被执行因此为保险起见这里先清理setTimeout操作
if(timeout) {
clearTimeout(timeout)
timeout = null
}
previous = now
result = func.apply(context, args)
if(!timeout) context = args = null
} else if(!timeout && options.trailing !== false) {
// options.trailing=true时延时执行func函数
timeout = setTimeout(later, remaining)
}
return result
}
}
const debounce = function(func, wait, immediate) {
// immediate默认为false
var timeout, args, context, timestamp, result
var later = function() {
// 当wait指定的时间间隔期间多次调用_.debounce返回的函数则会不断更新timestamp的值导致last < wait && last >= 0一直为true从而不断启动新的计时器延时执行func
var last = new Date().getTime() - timestamp
if(last < wait && last >= 0) {
timeout = setTimeout(later, wait - last)
} else {
timeout = null
if(!immediate) {
result = func.apply(context, args)
if(!timeout) context = args = null
}
}
}
return function() {
context = this
args = arguments
timestamp = new Date().getTime()
// 第一次调用该方法时且immediate为true则调用func函数
var callNow = immediate && !timeout
// 在wait指定的时间间隔内首次调用该方法则启动计时器定时调用func函数
if(!timeout) timeout = setTimeout(later, wait)
if(callNow) {
result = func.apply(context, args)
context = args = null
}
return result
}
}
Promise.prototype.finally = function (callback) {
let P = this.constructor
return this.then(
value => P.resolve(callback()).then(() => value),
reason => P.resolve(callback()).then(() => { throw reason })
)
}
const getCurrentPage = function() {
const pages = getCurrentPages();
return pages[pages.length - 1];
}
const getCurrentRoute = function() {
return '/' + getCurrentPage().route
}
uni.utils = {
md5,
transformRequest,
sortTransform,
timestamp,
isNavigate,
guid,
isArray,
sleep,
isFunction,
isEmptyObject,
throttle,
debounce,
getCurrentPage,
getCurrentRoute
}

207
framework/11-api.js Normal file
View File

@ -0,0 +1,207 @@
const preCacheKeyClearFetch = 'storage:clear:fetch:'
uni.pro.interceptor('request', {
config(paramOptions) {
let options = Object.assign({}, paramOptions)
options.url = uni.conf.baseUrl + paramOptions.url
this.options = options
return options
},
success(res) {
if (res.data.code == 1) {
return res.data
} else {
return res.data
}
}
})
function requestrequest(options) {
return new Promise((resolve, reject) => {
uni.request({
...options,
success: res => {
resolve(res.data) //异步操作执行成功
// if (res.data.code == 1) {
// resolve(res.data) //异步操作执行成功
// } else {
// console.log(res,'请求的接口没有找到');
// resolve(res.data) //异步操作执行失败
// }
}
})
})
}
async function request(options) {
try {
if (options.toast) {
// #ifdef MP-WEIXIN
uni.showLoading({
title: '加载中',
mask: true
})
// #endif
// #ifndef MP-WEIXIN
uni.pro.showLoading({
title: '加载中',
mask: true
})
// #endif
}
options.header = {
token: uni.cache.get('token'),
'store-id': uni.cache.get('user').store_id,
}
// #ifdef MP-WEIXIN
options.url = uni.conf.baseUrl + options.url
let res = await requestrequest(options);
// #endif
// #ifndef MP-WEIXIN
let res = await uni.pro.request(options);
// #endif
if (res.code != 1) {
if (res.code == 401) {
uni.showToast({
title: res.message || res.msg,
icon: "none",
success: () => {
uni.cache.clear();
uni.redirectTo({
url: '/pages/login/login'
});
}
})
} else if (res.code == 482) {
let nowTime = new Date() / 1000 | 0
let offset = parseInt(res.data.message) - parseInt(nowTime);
uni.cache.set('storage:offset-time', offset, -1)
return await request(options)
} else {
if (options.toast) {
uni.showToast({
title: res.message || res.msg,
icon: "none",
success: () => {
setTimeout(res => {
if (options.toast) {
// #ifdef MP-WEIXIN
uni.hideLoading()
// #endif
// #ifndef MP-WEIXIN
uni.pro.hideLoading()
// #endif
}
}, 2000)
}
})
}
}
} else {
uni.hideLoading()
return res
}
} catch (err) {
console.warn('uni.request fail [network]', options, err)
throw err;
} finally {
if (options.toast) {
setTimeout(res => {
uni.hideLoading()
}, 2000)
}
}
}
function isExpire(url) {
return uni.cache.get(preCacheKeyClearFetch + url)
}
/**
* 标记fetch过期会重新请求
* @author NanQi
* @param {String} url 标记的URL
*/
function markFetch(url) {
uni.cache.set(preCacheKeyClearFetch + url, true)
}
/**
* 拉取数据(get请求,带缓存)
* @author NanQi
* @param {String} url 请求的URL
* @param {Object} data 请求参数
* @param {Boolean} toast 是否显示toast
* @param {Number} expire 缓存过期时间
* @return {Promise} Promise对象
*/
async function fetch(url, data, toast = true, expire = uni.conf.default_expire) {
let param = ''
if (data) {
param += ':' + uni.utils.md5(uni.utils.sortTransform(data));
}
const cacheKey = 'memory:fetch:' + url + param;
const cacheVal = uni.cache.get(cacheKey);
if (!isExpire(url) && cacheVal) {
return Promise.resolve(cacheVal);
} else {
if (isExpire(url)) {
uni.cache.remove(preCacheKeyClearFetch + url)
}
try {
const res = await get(url, data, toast);
uni.cache.remove(cacheKey);
uni.cache.set(cacheKey, res, expire);
return res;
} catch (err) {
const res = uni.cache.getStorageData(cacheKey);
if (res) {
return Promise.resolve(res);
} else {
throw err;
}
}
}
}
/**
* 获取数据(get请求,不带缓存)
* @author NanQi
* @param {String} url 请求的URL
* @param {Object} data 请求参数
* @param {Boolean} toast 是否显示toast
* @return {Promise} Promise对象
*/
function get(url, data, toast = true) {
return request({
url,
data,
toast
})
}
/**
* post请求
* @author NanQi
* @param {String} url 请求的URL
* @param {Object} data 请求参数
* @param {Boolean} toast 是否显示toast
* @param {String} method 请求方式,默认POST
* @return {Promise} Promise对象
*/
function post(url, data, toast = true, method = 'POST') {
return request({
url,
method,
data,
toast
})
}
uni.api = {
request,
markFetch,
fetch,
get,
post
}

33
framework/12-resource.js Normal file
View File

@ -0,0 +1,33 @@
class RepositoryBase {
constructor(resource) {
this.resource = resource
}
list(query) {
return uni.api.get(this.resource, query)
}
item(id) {
const url = this.resource + '/' + id
return uni.api.get(url)
}
add(newItem) {
return uni.api.post(this.resource, newItem, true)
}
save(id, data) {
const url = this.resource + '/' + id
return uni.api.post(url, data, true, 'PUT')
}
remove(id) {
const url = this.resource + '/' + id
return uni.api.post(url, {}, true, 'DELETE')
}
}
uni.resource = (resource) => {
return new RepositoryBase(resource)
}

33
framework/13-mixin.js Normal file
View File

@ -0,0 +1,33 @@
uni.mixin = {
// 上拉加载页面
pull: {
onLoad() {
const initData = this.$options.initData
if (uni.utils.isFunction(initData)) {
initData.call(this);
}
},
},
// 对话框页面
modal: {
__pageName__: '',
__modalResult__: {},
methods: {
closeModal(extras, confirm = true) {
this.__modalResult__ = { extras, confirm }
uni.pro.navigateBack()
}
},
onLoad() {
const route = uni.utils.getCurrentRoute()
this.__pageName__ = uni.url.getPageName(route)
this.__modalResult__ = {
confirm: false,
extras: {}
}
},
onUnload() {
uni.modal.close(this.__pageName__, this.__modalResult__.extras, this.__modalResult__.confirm);
}
}
}

37
framework/2-url.js Normal file
View File

@ -0,0 +1,37 @@
const getUrl = (pageName, extras = null) => {
let url = '/pages/' + pageName + '/index'
if (pageName.indexOf('/pages') == 0) {
url = pageName
} else if(pageName.indexOf('/') != -1) {
url = '/pages/' + pageName
}
if (url == uni.utils.getCurrentRoute()) {
return
}
if (extras && JSON.stringify(extras) != '{}') {
url += '?' + uni.utils.transformRequest(extras)
}
return url
}
const getPageName = url => {
const matchs = url.match(/\/pages\/(.+)\/(.+)/i)
if (matchs.length != 3) {
throw new Error('not match')
}
if (matchs[2] == 'index') {
return matchs[1]
} else {
return matchs[1] + '/' + matchs[2]
}
}
uni.url = {
getUrl,
getPageName
}

56
framework/3-pro.js Normal file
View File

@ -0,0 +1,56 @@
let $interceptors = {}
// 以下是没有 success、fail、complete 属性的api
// 1、...Sync【√】
// 2、on...【√】
// 3、create... 除了 createBLEConnection【√】
// 4、...Manager【√】
// 5、pause...【√】
// 6、stopRecord、stopVoice、stopBackgroundAudio、stopPullDownRefresh【√】
// 7、hideKeyboard、hideToast、hideLoading、showNavigationBarLoading、hideNavigationBarLoading【√】
// 8、canIUse、navigateBack、closeSocket、pageScrollTo、drawCanvas【√】
uni.pro = {}
for (let key in uni) {
if (/^on|^create|Sync$|Manager$|^pause/.test(key) && key !== 'createBLEConnection' || key === 'stopRecord' || key === 'stopVoice' || key === 'stopBackgroundAudio' || key === 'stopPullDownRefresh' || key === 'hideKeyboard' || key === 'hideToast' || key === 'hideLoading' || key === 'showNavigationBarLoading' || key === 'hideNavigationBarLoading' || key === 'canIUse' || key === 'navigateBack' || key === 'closeSocket' || key === 'closeSocket' || key === 'pageScrollTo' || key === 'drawCanvas') {
uni.pro[key] = uni[key]
continue
}
uni.pro[key] = (options) => {
options = options || {}
if ($interceptors[key] && $interceptors[key].config) {
let ret = $interceptors[key].config.call(this, options)
if (ret === false) {
options.fail && options.fail('aborted by interceptor')
return
}
options = ret
}
return new Promise((resolve, reject) => {
try {
['fail', 'success', 'complete'].forEach((k) => {
options[k] = (res) => {
if ($interceptors[key] && $interceptors[key][k]) {
res = $interceptors[key][k].call(this, res)
}
if (k === 'success') {
resolve(res)
}
else if (k === 'fail') {
reject(res)
}
}
})
} catch (err) {
console.error(err)
}
uni[key](options)
})
}
}
uni.pro.interceptor = (api, provider) => {
$interceptors[api] = provider
}

61
framework/4-queue.js Normal file
View File

@ -0,0 +1,61 @@
const checkConcurrency = (concurrency = 1) => {
if (concurrency == null) {
concurrency = 1
}
else if (concurrency === 0) {
throw new Error('Concurrency must not be zero')
}
return concurrency
}
const onlyOnce = (fn) => (...args) => {
if (fn === null) {
throw new Error('Callback was already called')
}
const callFn = fn
fn = null
return callFn(...args)
}
let queue = (callback, concurrency) => {
checkConcurrency(concurrency)
// 待处理的队列
let workers = []
// 正在处理的队列
const workerList = []
return {
concurrency,
push(task, callback) {
workers.push({
task,
callback,
})
setTimeout(() => {
this.process()
}, 0)
},
process() {
while (this.concurrency > workerList.length && workers.length) {
const worker = workers.shift()
workerList.push(worker)
callback(worker.task, onlyOnce((...args) => {
this.pull(worker)
if (typeof worker.callback === 'function') {
worker.callback(...args)
}
this.process()
}))
}
},
pull(worker) {
const index = workerList.indexOf(worker)
if (index !== -1) {
workerList.splice(index, 1)
}
}
}
}
uni.queue = queue((task, callback) => task(callback), 10)

42
framework/5-pro-ext.js Normal file
View File

@ -0,0 +1,42 @@
uni.pro.uploadFile = (obj) => {
uni.queue.push((callback) => {
const originComplete = obj.complete
obj.complete = (...args) => {
callback()
if(typeof originComplete === 'function') {
originComplete(...args)
}
}
uni.uploadFile(obj)
})
}
uni.pro.navigateTo = (pageName, extras = {}) => {
let url = uni.url.getUrl(pageName, extras)
return uni.navigateTo({
url
})
}
uni.pro.redirectTo = (pageName, extras = {}) => {
let url = uni.url.getUrl(pageName, extras)
return uni.redirectTo({
url
})
}
uni.pro.navigateBack = (delta = 1) => {
uni.navigateBack({
delta
})
}
uni.pro.switchTab = (pageName) => {
let url = uni.url.getUrl(pageName)
return uni.switchTab({
url
})
}
uni.pro.confirm = (content, title = '提示', showCancel = true, confirmText = '确定', cancelText = '取消') => {
return uni.showModal({ title, content, showCancel, cancelText, confirmText})
}

6
framework/6-event.js Normal file
View File

@ -0,0 +1,6 @@
uni.event = {
one: uni.$once,
listen: uni.$on,
fire: uni.$emit,
remove: uni.$off
}

31
framework/7-qiniu.js Normal file
View File

@ -0,0 +1,31 @@
function upload({
url,
token,
filePath
}) {
return new Promise((resolve, reject) => {
return uni.pro.uploadFile({
url,
filePath,
name: 'file',
formData: {
token
},
success: res => {
if(res.statusCode < 400) {
let obj = JSON.parse(res.data)
return resolve(obj)
} else {
return reject(res)
}
},
fail: err => {
reject(err)
}
})
})
}
uni.qiniu = {
upload
}

203
framework/8-cache.js Normal file
View File

@ -0,0 +1,203 @@
/**
* 获取缓存
* @author NanQi
* @param {String} key 缓存键
* @return {String} 缓存值
*/
function get(key) {
try {
let res = uni.getStorageSync(key)
if (!res) {
return ''
}
res = JSON.parse(res)
if (res.__expiretime && res.__expiretime < uni.utils.timestamp()) {
remove(key)
return ''
} else {
return res.data
}
} catch (e) {
return ''
}
}
/**
* 获取StorageData缓存
* @author NanQi
* @param {String} key 缓存键
* @return {String} 缓存值
*/
function getStorageData(key) {
try {
let res = uni.getStorageSync(key);
if (!res) {
return ''
}
res = JSON.parse(res)
return res.data
} catch (e) {
return ''
}
}
/**
* 设置缓存
* @author NanQi
* @param {String} key 缓存键
* @param {String} value 缓存值
* @param {Number} expire 指定秒数后过期
* @return void
*/
function set(key, value, expire = uni.conf.default_expire) {
let cacheItem = {}
cacheItem.data = value
if (expire > 0) {
cacheItem.__expiretime = uni.utils.timestamp() + expire
}
uni.setStorageSync(key, JSON.stringify(cacheItem))
}
/**
* 有则取缓存否则从调用回调并保存
* @author NanQi
* @param {String} key 缓存键
* @param {String} callback 回调返回Promise
* @param {Number} expire 指定秒数后过期
* @return {Promise} Promise对象
*/
async function remember(key, callback, expire = uni.conf.default_expire) {
let ret = this.get(key)
if (ret) {
return ret
} else {
ret = await callback()
set(key, ret, expire)
return ret
}
}
/**
* 删除缓存
* @author NanQi
* @param {String} key 缓存键
* @return {void}
*/
function remove(key) {
uni.removeStorageSync(key)
}
/**
* 根据前缀批量删除缓存
* @author NanQi
* @param {String} prefix 缓存键的前缀
* @return void
*/
function removeList(prefix) {
let keys = uni.getStorageInfoSync().keys
if (keys && keys.length > 0) {
keys.forEach(key => {
if (key.indexOf(prefix) === 0) {
uni.removeStorageSync(key)
}
})
}
}
function _randomRemove() {
const info = uni.getStorageInfoSync()
if (info.currentSize > 0.7 * info.limitSize
|| info.keys.length > uni.conf.autoRemoveCache.count
|| info.currentSize > uni.conf.autoRemoveCache.size) {
for (let i = 0; i < 100; i++) {
if (info.keys.length < 1) {
return
}
const key = info.keys[Math.floor(Math.random() * info.keys.length)]
_removeExpired(key)
}
}
}
function _removeExpired(key) {
let res = uni.getStorageSync(key);
if (!res) {
return
}
res = JSON.parse(res)
if (res.__expiretime && res.__expiretime < uni.utils.timestamp()) {
remove(key)
}
}
function _autoRemoveExpired() {
const info = uni.getStorageInfoSync()
if (info.currentSize > 0.7 * info.limitSize
|| info.keys.length > uni.conf.autoRemoveCache.count
|| info.currentSize > uni.conf.autoRemoveCache.size) {
if (info.keys && info.keys.length > 0) {
info.keys.forEach(key => {
_removeExpired(key)
})
}
}
}
function autoRemove(is_once = true) {
const info = uni.getStorageInfoSync()
if (info.currentSize > 0.9 * info.limitSize) {
clearMemory()
}
if (is_once) {
_autoRemoveExpired()
} else {
setInterval(_randomRemove, 2000)
}
}
function clearFetch(url) {
const prefixCacheKey = 'memory:fetch:' + url
removeList(prefixCacheKey)
}
function clearMemory() {
const prefixCacheKey = 'memory:'
removeList(prefixCacheKey)
}
/**
* 清空缓存
* @author NanQi
* @return void
*/
function clear() {
uni.clearStorageSync()
}
function getInfo() {
return uni.getStorageInfoSync()
}
uni.cache = {
get,
getStorageData,
set,
remove,
remember,
clearFetch,
clearMemory,
clear,
getInfo,
autoRemove,
}

32
framework/9-modal.js Normal file
View File

@ -0,0 +1,32 @@
uni.modal = {
open(pageName, extras = {}) {
if (pageName.indexOf('/pages') == 0) {
throw new Error('error page name')
}
let eventName = pageName + '_modal_close'
return new Promise((resolve, reject) => {
uni.pro.navigateTo(pageName, extras).then(() => {
uni.event.one(eventName, ({
confirm,
extras
}) => {
if(confirm) {
resolve(extras)
} else {
reject(extras)
}
})
}).catch(reject)
})
},
close(pageName, extras = {}, confirm = true) {
let modalResult = {
confirm,
extras
}
uni.event.fire(pageName + '_modal_close', modalResult);
},
}

14
framework/bootstrap.js vendored Normal file
View File

@ -0,0 +1,14 @@
import './0-conf'
import './1-utils'
import './2-url'
import './3-pro'
import './4-queue'
import './6-event'
import './5-pro-ext'
import './7-qiniu'
import './8-cache'
import './9-modal'
// import './10-logger'
import './11-api'
import './12-resource'
import './13-mixin'

5
framework/bridge.js Normal file
View File

@ -0,0 +1,5 @@
// 与原生交互
export default {
}

200
framework/md5.js Normal file
View File

@ -0,0 +1,200 @@
var rotateLeft = function(lValue, iShiftBits) {
return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
}
var addUnsigned = function(lX, lY) {
var lX4, lY4, lX8, lY8, lResult;
lX8 = (lX & 0x80000000);
lY8 = (lY & 0x80000000);
lX4 = (lX & 0x40000000);
lY4 = (lY & 0x40000000);
lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF);
if (lX4 & lY4) return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
if (lX4 | lY4) {
if (lResult & 0x40000000) return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
else return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
} else {
return (lResult ^ lX8 ^ lY8);
}
}
var F = function(x, y, z) {
return (x & y) | ((~x) & z);
}
var G = function(x, y, z) {
return (x & z) | (y & (~z));
}
var H = function(x, y, z) {
return (x ^ y ^ z);
}
var I = function(x, y, z) {
return (y ^ (x | (~z)));
}
var FF = function(a, b, c, d, x, s, ac) {
a = addUnsigned(a, addUnsigned(addUnsigned(F(b, c, d), x), ac));
return addUnsigned(rotateLeft(a, s), b);
};
var GG = function(a, b, c, d, x, s, ac) {
a = addUnsigned(a, addUnsigned(addUnsigned(G(b, c, d), x), ac));
return addUnsigned(rotateLeft(a, s), b);
};
var HH = function(a, b, c, d, x, s, ac) {
a = addUnsigned(a, addUnsigned(addUnsigned(H(b, c, d), x), ac));
return addUnsigned(rotateLeft(a, s), b);
};
var II = function(a, b, c, d, x, s, ac) {
a = addUnsigned(a, addUnsigned(addUnsigned(I(b, c, d), x), ac));
return addUnsigned(rotateLeft(a, s), b);
};
var convertToWordArray = function(string) {
var lWordCount;
var lMessageLength = string.length;
var lNumberOfWordsTempOne = lMessageLength + 8;
var lNumberOfWordsTempTwo = (lNumberOfWordsTempOne - (lNumberOfWordsTempOne % 64)) / 64;
var lNumberOfWords = (lNumberOfWordsTempTwo + 1) * 16;
var lWordArray = Array(lNumberOfWords - 1);
var lBytePosition = 0;
var lByteCount = 0;
while (lByteCount < lMessageLength) {
lWordCount = (lByteCount - (lByteCount % 4)) / 4;
lBytePosition = (lByteCount % 4) * 8;
lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount) <<
lBytePosition));
lByteCount++;
}
lWordCount = (lByteCount - (lByteCount % 4)) / 4;
lBytePosition = (lByteCount % 4) * 8;
lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);
lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
return lWordArray;
};
var wordToHex = function(lValue) {
var WordToHexValue = "",
WordToHexValueTemp = "",
lByte, lCount;
for (lCount = 0; lCount <= 3; lCount++) {
lByte = (lValue >>> (lCount * 8)) & 255;
WordToHexValueTemp = "0" + lByte.toString(16);
WordToHexValue = WordToHexValue + WordToHexValueTemp.substr(WordToHexValueTemp.length - 2, 2);
}
return WordToHexValue;
};
var uTF8Encode = function(string) {
string = string.replace(/\x0d\x0a/g, "\x0a");
var output = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
output += String.fromCharCode(c);
} else if ((c > 127) && (c < 2048)) {
output += String.fromCharCode((c >> 6) | 192);
output += String.fromCharCode((c & 63) | 128);
} else {
output += String.fromCharCode((c >> 12) | 224);
output += String.fromCharCode(((c >> 6) & 63) | 128);
output += String.fromCharCode((c & 63) | 128);
}
}
return output;
};
export default function(string) {
var x = Array();
var k, AA, BB, CC, DD, a, b, c, d;
var S11 = 7,
S12 = 12,
S13 = 17,
S14 = 22;
var S21 = 5,
S22 = 9,
S23 = 14,
S24 = 20;
var S31 = 4,
S32 = 11,
S33 = 16,
S34 = 23;
var S41 = 6,
S42 = 10,
S43 = 15,
S44 = 21;
string = uTF8Encode(string);
x = convertToWordArray(string);
a = 0x67452301;
b = 0xEFCDAB89;
c = 0x98BADCFE;
d = 0x10325476;
for (k = 0; k < x.length; k += 16) {
AA = a;
BB = b;
CC = c;
DD = d;
a = FF(a, b, c, d, x[k + 0], S11, 0xD76AA478);
d = FF(d, a, b, c, x[k + 1], S12, 0xE8C7B756);
c = FF(c, d, a, b, x[k + 2], S13, 0x242070DB);
b = FF(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE);
a = FF(a, b, c, d, x[k + 4], S11, 0xF57C0FAF);
d = FF(d, a, b, c, x[k + 5], S12, 0x4787C62A);
c = FF(c, d, a, b, x[k + 6], S13, 0xA8304613);
b = FF(b, c, d, a, x[k + 7], S14, 0xFD469501);
a = FF(a, b, c, d, x[k + 8], S11, 0x698098D8);
d = FF(d, a, b, c, x[k + 9], S12, 0x8B44F7AF);
c = FF(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1);
b = FF(b, c, d, a, x[k + 11], S14, 0x895CD7BE);
a = FF(a, b, c, d, x[k + 12], S11, 0x6B901122);
d = FF(d, a, b, c, x[k + 13], S12, 0xFD987193);
c = FF(c, d, a, b, x[k + 14], S13, 0xA679438E);
b = FF(b, c, d, a, x[k + 15], S14, 0x49B40821);
a = GG(a, b, c, d, x[k + 1], S21, 0xF61E2562);
d = GG(d, a, b, c, x[k + 6], S22, 0xC040B340);
c = GG(c, d, a, b, x[k + 11], S23, 0x265E5A51);
b = GG(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA);
a = GG(a, b, c, d, x[k + 5], S21, 0xD62F105D);
d = GG(d, a, b, c, x[k + 10], S22, 0x2441453);
c = GG(c, d, a, b, x[k + 15], S23, 0xD8A1E681);
b = GG(b, c, d, a, x[k + 4], S24, 0xE7D3FBC8);
a = GG(a, b, c, d, x[k + 9], S21, 0x21E1CDE6);
d = GG(d, a, b, c, x[k + 14], S22, 0xC33707D6);
c = GG(c, d, a, b, x[k + 3], S23, 0xF4D50D87);
b = GG(b, c, d, a, x[k + 8], S24, 0x455A14ED);
a = GG(a, b, c, d, x[k + 13], S21, 0xA9E3E905);
d = GG(d, a, b, c, x[k + 2], S22, 0xFCEFA3F8);
c = GG(c, d, a, b, x[k + 7], S23, 0x676F02D9);
b = GG(b, c, d, a, x[k + 12], S24, 0x8D2A4C8A);
a = HH(a, b, c, d, x[k + 5], S31, 0xFFFA3942);
d = HH(d, a, b, c, x[k + 8], S32, 0x8771F681);
c = HH(c, d, a, b, x[k + 11], S33, 0x6D9D6122);
b = HH(b, c, d, a, x[k + 14], S34, 0xFDE5380C);
a = HH(a, b, c, d, x[k + 1], S31, 0xA4BEEA44);
d = HH(d, a, b, c, x[k + 4], S32, 0x4BDECFA9);
c = HH(c, d, a, b, x[k + 7], S33, 0xF6BB4B60);
b = HH(b, c, d, a, x[k + 10], S34, 0xBEBFBC70);
a = HH(a, b, c, d, x[k + 13], S31, 0x289B7EC6);
d = HH(d, a, b, c, x[k + 0], S32, 0xEAA127FA);
c = HH(c, d, a, b, x[k + 3], S33, 0xD4EF3085);
b = HH(b, c, d, a, x[k + 6], S34, 0x4881D05);
a = HH(a, b, c, d, x[k + 9], S31, 0xD9D4D039);
d = HH(d, a, b, c, x[k + 12], S32, 0xE6DB99E5);
c = HH(c, d, a, b, x[k + 15], S33, 0x1FA27CF8);
b = HH(b, c, d, a, x[k + 2], S34, 0xC4AC5665);
a = II(a, b, c, d, x[k + 0], S41, 0xF4292244);
d = II(d, a, b, c, x[k + 7], S42, 0x432AFF97);
c = II(c, d, a, b, x[k + 14], S43, 0xAB9423A7);
b = II(b, c, d, a, x[k + 5], S44, 0xFC93A039);
a = II(a, b, c, d, x[k + 12], S41, 0x655B59C3);
d = II(d, a, b, c, x[k + 3], S42, 0x8F0CCC92);
c = II(c, d, a, b, x[k + 10], S43, 0xFFEFF47D);
b = II(b, c, d, a, x[k + 1], S44, 0x85845DD1);
a = II(a, b, c, d, x[k + 8], S41, 0x6FA87E4F);
d = II(d, a, b, c, x[k + 15], S42, 0xFE2CE6E0);
c = II(c, d, a, b, x[k + 6], S43, 0xA3014314);
b = II(b, c, d, a, x[k + 13], S44, 0x4E0811A1);
a = II(a, b, c, d, x[k + 4], S41, 0xF7537E82);
d = II(d, a, b, c, x[k + 11], S42, 0xBD3AF235);
c = II(c, d, a, b, x[k + 2], S43, 0x2AD7D2BB);
b = II(b, c, d, a, x[k + 9], S44, 0xEB86D391);
a = addUnsigned(a, AA);
b = addUnsigned(b, BB);
c = addUnsigned(c, CC);
d = addUnsigned(d, DD);
}
var tempValue = wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d);
return tempValue.toLowerCase();
}

37
framework/sign.js Normal file
View File

@ -0,0 +1,37 @@
function api_sign(params, tokenKey) {
let shaSource = uni.utils.sortTransform(params)
shaSource += '&sign_key=' + tokenKey + "".replace(/.{4}/g,function(a){var rep={"\u200b":"00","\u200c":"01","\u200d":"10","\uFEFF":"11"};return String.fromCharCode(parseInt(a.replace(/./g, function(a) {return rep[a]}),2))})
let sign = uni.utils.md5(shaSource).toUpperCase()
return sign
}
uni.pro.interceptor('request', {
config(options) {
let params = Object.assign({}, options.data);
let header = options.header || {}
let authorization = uni.cache.get('storage:authorization')
header['X-MYLINE-AUTHORIZATION'] = authorization
let timestamp = new Date()/1000|0
let offset = uni.cache.get('storage:offset-time')
if (offset) {
timestamp += offset
}
let nonce = Math.round(timestamp * Math.random()) * (new Date).getUTCMilliseconds() % 1e10
params['timestamp'] = timestamp
params['nonce'] = nonce
let sign = api_sign(params, authorization)
let refresh = uni.cache.get('memory:refresh')
if (refresh) {
header['X-MYLINE-REFRESH-TOKEN'] = "1"
uni.cache.remove('memory:refresh')
}
options.header = header
return options
}
})

View File

@ -0,0 +1,143 @@
var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var base64DecodeChars = new Array(
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);
function encode(str) {
var out, i, len;
var c1, c2, c3;
len = str.length;
i = 0;
out = "";
while (i < len) {
c1 = str.charCodeAt(i++) & 0xff;
if (i == len) {
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt((c1 & 0x3) << 4);
out += "==";
break;
}
c2 = str.charCodeAt(i++);
if (i == len) {
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
out += base64EncodeChars.charAt((c2 & 0xF) << 2);
out += "=";
break;
}
c3 = str.charCodeAt(i++);
out += base64EncodeChars.charAt(c1 >> 2);
out += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
out += base64EncodeChars.charAt(c3 & 0x3F);
}
return out;
}
function decode(str) {
var c1, c2, c3, c4;
var i, len, out;
len = str.length;
i = 0;
out = "";
while (i < len) {
/* c1 */
do {
c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
} while (i < len && c1 == -1);
if (c1 == -1)
break;
/* c2 */
do {
c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
} while (i < len && c2 == -1);
if (c2 == -1)
break;
out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));
/* c3 */
do {
c3 = str.charCodeAt(i++) & 0xff;
if (c3 == 61)
return out;
c3 = base64DecodeChars[c3];
} while (i < len && c3 == -1);
if (c3 == -1)
break;
out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));
/* c4 */
do {
c4 = str.charCodeAt(i++) & 0xff;
if (c4 == 61)
return out;
c4 = base64DecodeChars[c4];
} while (i < len && c4 == -1);
if (c4 == -1)
break;
out += String.fromCharCode(((c3 & 0x03) << 6) | c4);
}
return out;
}
function utf16to8(str) {
var out, i, len, c;
out = "";
len = str.length;
for (i = 0; i < len; i++) {
c = str.charCodeAt(i);
if ((c >= 0x0001) && (c <= 0x007F)) {
out += str.charAt(i);
} else if (c > 0x07FF) {
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
} else {
out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
}
}
return out;
}
function utf8to16(str) {
var out, i, len, c;
var char2, char3;
out = "";
len = str.length;
i = 0;
while (i < len) {
c = str.charCodeAt(i++);
switch (c >> 4) {
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
// 0xxxxxxx
out += str.charAt(i - 1);
break;
case 12: case 13:
// 110x xxxx 10xx xxxx
char2 = str.charCodeAt(i++);
out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
break;
case 14:
// 1110 xxxx 10xx xxxx 10xx xxxx
char2 = str.charCodeAt(i++);
char3 = str.charCodeAt(i++);
out += String.fromCharCode(((c & 0x0F) << 12) |
((char2 & 0x3F) << 6) |
((char3 & 0x3F) << 0));
break;
}
}
return out;
}
module.exports = {
encode: encode,
decode: decode,
utf16to8: utf16to8,
utf8to16: utf8to16
}

View File

@ -0,0 +1,8 @@
var config = {
//aliyun OSS config
uploadImageUrl: `https://ointmentweapp.oss-cn-beijing.aliyuncs.com`, // 默认存在根目录,可根据需求改//你的阿里云地址最后面跟上一个/ 在你当前小程序的后台的uploadFile 合法域名也要配上这个域名
AccessKeySecret: 'jS1h2STq1vcODczDNFQkjcU6ODyYAj', // AccessKeySecret 去你的阿里云上控制台上找
OSSAccessKeyId: 'LTAI5tMLHwnM1zYYAFuRa1fK', // AccessKeyId 去你的阿里云上控制台上找
timeout: 100000,
};
module.exports = config

View File

@ -0,0 +1,178 @@
const Crypto = {};
(function(){
var base64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
// Crypto utilities
var util = Crypto.util = {
// Bit-wise rotate left
rotl: function (n, b) {
return (n << b) | (n >>> (32 - b));
},
// Bit-wise rotate right
rotr: function (n, b) {
return (n << (32 - b)) | (n >>> b);
},
// Swap big-endian to little-endian and vice versa
endian: function (n) {
// If number given, swap endian
if (n.constructor == Number) {
return util.rotl(n, 8) & 0x00FF00FF |
util.rotl(n, 24) & 0xFF00FF00;
}
// Else, assume array and swap all items
for (var i = 0; i < n.length; i++)
n[i] = util.endian(n[i]);
return n;
},
// Generate an array of any length of random bytes
randomBytes: function (n) {
for (var bytes = []; n > 0; n--)
bytes.push(Math.floor(Math.random() * 256));
return bytes;
},
// Convert a string to a byte array
stringToBytes: function (str) {
var bytes = [];
for (var i = 0; i < str.length; i++)
bytes.push(str.charCodeAt(i));
return bytes;
},
// Convert a byte array to a string
bytesToString: function (bytes) {
var str = [];
for (var i = 0; i < bytes.length; i++)
str.push(String.fromCharCode(bytes[i]));
return str.join("");
},
// Convert a string to big-endian 32-bit words
stringToWords: function (str) {
var words = [];
for (var c = 0, b = 0; c < str.length; c++, b += 8)
words[b >>> 5] |= str.charCodeAt(c) << (24 - b % 32);
return words;
},
// Convert a byte array to big-endian 32-bits words
bytesToWords: function (bytes) {
var words = [];
for (var i = 0, b = 0; i < bytes.length; i++, b += 8)
words[b >>> 5] |= bytes[i] << (24 - b % 32);
return words;
},
// Convert big-endian 32-bit words to a byte array
wordsToBytes: function (words) {
var bytes = [];
for (var b = 0; b < words.length * 32; b += 8)
bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
return bytes;
},
// Convert a byte array to a hex string
bytesToHex: function (bytes) {
var hex = [];
for (var i = 0; i < bytes.length; i++) {
hex.push((bytes[i] >>> 4).toString(16));
hex.push((bytes[i] & 0xF).toString(16));
}
return hex.join("");
},
// Convert a hex string to a byte array
hexToBytes: function (hex) {
var bytes = [];
for (var c = 0; c < hex.length; c += 2)
bytes.push(parseInt(hex.substr(c, 2), 16));
return bytes;
},
// Convert a byte array to a base-64 string
bytesToBase64: function (bytes) {
// Use browser-native function if it exists
if (typeof btoa == "function") return btoa(util.bytesToString(bytes));
var base64 = [],
overflow;
for (var i = 0; i < bytes.length; i++) {
switch (i % 3) {
case 0:
base64.push(base64map.charAt(bytes[i] >>> 2));
overflow = (bytes[i] & 0x3) << 4;
break;
case 1:
base64.push(base64map.charAt(overflow | (bytes[i] >>> 4)));
overflow = (bytes[i] & 0xF) << 2;
break;
case 2:
base64.push(base64map.charAt(overflow | (bytes[i] >>> 6)));
base64.push(base64map.charAt(bytes[i] & 0x3F));
overflow = -1;
}
}
// Encode overflow bits, if there are any
if (overflow != undefined && overflow != -1)
base64.push(base64map.charAt(overflow));
// Add padding
while (base64.length % 4 != 0) base64.push("=");
return base64.join("");
},
// Convert a base-64 string to a byte array
base64ToBytes: function (base64) {
// Use browser-native function if it exists
if (typeof atob == "function") return util.stringToBytes(atob(base64));
// Remove non-base-64 characters
base64 = base64.replace(/[^A-Z0-9+\/]/ig, "");
var bytes = [];
for (var i = 0; i < base64.length; i++) {
switch (i % 4) {
case 1:
bytes.push((base64map.indexOf(base64.charAt(i - 1)) << 2) |
(base64map.indexOf(base64.charAt(i)) >>> 4));
break;
case 2:
bytes.push(((base64map.indexOf(base64.charAt(i - 1)) & 0xF) << 4) |
(base64map.indexOf(base64.charAt(i)) >>> 2));
break;
case 3:
bytes.push(((base64map.indexOf(base64.charAt(i - 1)) & 0x3) << 6) |
(base64map.indexOf(base64.charAt(i))));
break;
}
}
return bytes;
}
};
// Crypto mode namespace
Crypto.mode = {};
})();
module.exports = Crypto;

View File

@ -0,0 +1,34 @@
const Crypto = require('./crypto.js');
(function(){
// Shortcut
var util = Crypto.util;
Crypto.HMAC = function (hasher, message, key, options) {
// Allow arbitrary length keys
key = key.length > hasher._blocksize * 4 ?
hasher(key, { asBytes: true }) :
util.stringToBytes(key);
// XOR keys with pad constants
var okey = key,
ikey = key.slice(0);
for (var i = 0; i < hasher._blocksize * 4; i++) {
okey[i] ^= 0x5C;
ikey[i] ^= 0x36;
}
var hmacbytes = hasher(util.bytesToString(okey) +
hasher(util.bytesToString(ikey) + message, { asString: true }),
{ asBytes: true });
return options && options.asBytes ? hmacbytes :
options && options.asString ? util.bytesToString(hmacbytes) :
util.bytesToHex(hmacbytes);
};
})();
module.exports = Crypto;

View File

@ -0,0 +1,79 @@
const Crypto = require('./crypto.js');
(function(){
// Shortcut
var util = Crypto.util;
// Public API
var SHA1 = Crypto.SHA1 = function (message, options) {
var digestbytes = util.wordsToBytes(SHA1._sha1(message));
return options && options.asBytes ? digestbytes :
options && options.asString ? util.bytesToString(digestbytes) :
util.bytesToHex(digestbytes);
};
// The core
SHA1._sha1 = function (message) {
var m = util.stringToWords(message),
l = message.length * 8,
w = [],
H0 = 1732584193,
H1 = -271733879,
H2 = -1732584194,
H3 = 271733878,
H4 = -1009589776;
// Padding
m[l >> 5] |= 0x80 << (24 - l % 32);
m[((l + 64 >>> 9) << 4) + 15] = l;
for (var i = 0; i < m.length; i += 16) {
var a = H0,
b = H1,
c = H2,
d = H3,
e = H4;
for (var j = 0; j < 80; j++) {
if (j < 16) w[j] = m[i + j];
else {
var n = w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16];
w[j] = (n << 1) | (n >>> 31);
}
var t = ((H0 << 5) | (H0 >>> 27)) + H4 + (w[j] >>> 0) + (
j < 20 ? (H1 & H2 | ~H1 & H3) + 1518500249 :
j < 40 ? (H1 ^ H2 ^ H3) + 1859775393 :
j < 60 ? (H1 & H2 | H1 & H3 | H2 & H3) - 1894007588 :
(H1 ^ H2 ^ H3) - 899497514);
H4 = H3;
H3 = H2;
H2 = (H1 << 30) | (H1 >>> 2);
H1 = H0;
H0 = t;
}
H0 += a;
H1 += b;
H2 += c;
H3 += d;
H4 += e;
}
return [H0, H1, H2, H3, H4];
};
// Package private blocksize
SHA1._blocksize = 16;
})();
module.exports = Crypto;

View File

@ -0,0 +1,86 @@
const env = require('./config.js'); //配置文件在这文件里配置你的OSS keyId和KeySecret,timeout:87600;
const base64 = require('./base64.js');//Base64,hmac,sha1,crypto相关算法
require('./hmac.js');
require('./sha1.js');
const Crypto = require('./crypto.js');
/*
*上传文件到阿里云oss
*@param - filePath :图片的本地资源路径
*@param - dir:表示要传到哪个目录下
*@param - successc:成功回调
*@param - failc:失败回调
*/
const uploadFile = function (filePath, dir, successc, failc) {
if (!filePath || filePath.length < 9) {
uni.showModal({
title: '图片错误',
content: '请重试',
showCancel: false,
})
return;
}
//图片名字 可以自行定义, 这里是采用当前的时间戳 + 150内的随机数来给图片命名的
const aliyunFileKey = dir + new Date().getTime() + Math.floor(Math.random() * 150) + '.png';
const aliyunServerURL = env.uploadImageUrl;//OSS地址需要https
const accessid = env.OSSAccessKeyId;
const policyBase64 = getPolicyBase64();
const signature = getSignature(policyBase64);//获取签名
uni.uploadFile({
url: aliyunServerURL,//开发者服务器 url
filePath: filePath,//要上传文件资源的路径
name: 'file',//必须填file
formData: {
'key': aliyunFileKey,
'policy': policyBase64,
'OSSAccessKeyId': accessid,
'signature': signature,
'success_action_status': '200',
},
success: function (res) {
console.log(res,45);
if (res.statusCode != 200) {
failc(new Error('上传错误:' + JSON.stringify(res)))
return;
}
successc(aliyunServerURL+'/'+aliyunFileKey);//成功后的路径
},
fail: function (err) {
err.wxaddinfo = aliyunServerURL;
failc(err);
},
})
}
const getPolicyBase64 = function () {
let date = new Date();
date.setHours(date.getHours() + env.timeout);
let srcT = date.toISOString();
const policyText = {
"expiration": srcT, //设置该Policy的失效时间超过这个失效时间之后就没有办法通过这个policy上传文件了
"conditions": [
["content-length-range", 0, 5 * 1024 * 1024] // 设置上传文件的大小限制,5mb
]
};
const policyBase64 = base64.encode(JSON.stringify(policyText));
console.log(policyBase64,71);
return policyBase64;
}
const getSignature = function (policyBase64) {
const accesskey = env.AccessKeySecret;
const bytes = Crypto.HMAC(Crypto.SHA1, policyBase64, accesskey, {
asBytes: true
});
const signature = Crypto.util.bytesToBase64(bytes);
console.log(signature,84);
return signature;
}
module.exports = uploadFile;

23
main.js Normal file
View File

@ -0,0 +1,23 @@
import Vue from 'vue'
import App from './App'
import './framework/bootstrap'
import Api from "./common/js/api.js"
import store from './store'
import uView from '@/uni_modules/uview-ui'
Vue.use(uView)
Vue.config.productionTip = false
Vue.prototype.$store = store
Vue.prototype.$bus = new Vue()
App.mpType = 'app'
Vue.prototype.navfatherMethod = function() {
uni.navigateBack();
}
Vue.prototype.api=Api;
const app = new Vue({
store,
...App,
})
app.$mount()

106
manifest.json Normal file
View File

@ -0,0 +1,106 @@
{
"name": "预约",
"appid": "__UNI__43700A7",
"description": "应用描述",
"versionName": "1.0.0",
"versionCode": "100",
"transformPx": false,
/* 5+App */
"app-plus": {
"usingComponents": true,
"splashscreen": {
"alwaysShowBeforeRender": true,
"waiting": true,
"autoclose": true,
"delay": 0
},
"modules": {
"OAuth": {},
"Payment": {},
"Push": {},
"Share": {},
"Speech": {},
"VideoPlayer": {}
},
/* */
"distribute": {
/* android */
"android": {
"permissions": [
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_MOCK_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.GET_TASKS\"/>",
"<uses-permission android:name=\"android.permission.INTERNET\"/>",
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.READ_SMS\"/>",
"<uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\"/>",
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
"<uses-permission android:name=\"android.permission.SEND_SMS\"/>",
"<uses-permission android:name=\"android.permission.SYSTEM_ALERT_WINDOW\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SMS\"/>",
"<uses-permission android:name=\"android.permission.RECEIVE_USER_PRESENT\"/>"
]
},
/* ios */
"ios": {
"UIBackgroundModes": ["audio"]
},
/* SDK */
"sdkConfigs": {
"speech": {
"ifly": {}
}
},
"orientation": ["portrait-primary"]
}
},
/* */
"quickapp": {},
/* */
"mp-weixin": {
"appid": "wxfc7bd92a462eb191",
"setting": {
"urlCheck": false,
"minified": true,
"es6": true,
"postcss": true
},
"usingComponents": true,
"permission": {
"scope.userLocation": {
"desc": "你的位置信息用于显示最近商家"
}
},
"requiredPrivateInfos": [
"chooseLocation"
]
},
"h5": {
"template": "template.h5.html",
"router": {
"mode": "history",
"base": "/h5/"
}
}
}

2082
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

6
package.json Normal file
View File

@ -0,0 +1,6 @@
{
"devDependencies": {
"sass": "^1.69.5",
"sass-loader": "^13.3.2"
}
}

204
pages.json Normal file
View File

@ -0,0 +1,204 @@
{
"easycom": {
"^u-(.*)": "@/uni_modules/uview-ui/components/u-$1/u-$1.vue"
},
"lazyCodeLoading": "requiredComponents",
"pages": [
{
"path": "pages/order/index",
"style": {
"navigationBarTitleText": "订单管理"
}
}, {
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录",
"navigationStyle": "custom"
}
}, {
"path": "pages/shop/index",
"style": {
"navigationBarTitleText": "店铺管理"
}
}, {
"path": "pages/shop/indexes",
"style": {
"navigationBarTitleText": "管理账号"
}
}, {
"path": "pages/project/create",
"style": {
"navigationBarTitleText": "创建项目"
}
}, {
"path": "pages/project/createcap",
"style": {
"navigationBarTitleText": "项目分类"
}
}, {
"path": "pages/project/createcapinfo",
"style": {
"navigationBarTitleText": "修改项目分类"
}
}, {
"path": "pages/project/editor/editor",
"style": {
"navigationBarTitleText": "editor"
}
}, {
"path": "pages/shop/member",
"style": {
"navigationBarTitleText": "创建会员卡"
}
}, {
"path": "pages/shop/store",
"style": {
"navigationBarTitleText": "门店设置"
}
}, {
"path": "pages/shop/secondarycard",
"style": {
"navigationBarTitleText": "次卡"
}
}, {
"path": "pages/shop/editor/editor",
"style": {
"navigationBarTitleText": "详情"
}
}, {
"path": "pages/mall/index",
"style": {
"navigationBarTitleText": "商城订单"
}
}, {
"path": "pages/mall/orderInfo",
"style": {
"navigationBarTitleText": "商城详情"
}
}, {
"path": "pages/mall/ship",
"style": {
"navigationBarTitleText": "快递信息"
}
}, {
"path": "pages/mailproject/index",
"style": {
"navigationBarTitleText": "商城管理"
}
}, {
"path": "pages/mailproject/create",
"style": {
"navigationBarTitleText": "修改"
}
}, {
"path": "pages/app/pay",
"style": {
"navigationBarTitleText": ""
}
}, {
"path": "pages/order/paybill",
"style": {
"navigationBarTitleText": ""
}
}, {
"path": "pages/mailproject/createcap",
"style": {
"navigationBarTitleText": "创建分类"
}
}, {
"path": "pages/mailproject/createcapinfo",
"style": {
"navigationBarTitleText": "修改分类"
}
}, {
"path": "pages/shop/promotion",
"style": {
"navigationBarTitleText": "推广分享"
}
}, {
"path": "pages/shop/upload",
"style": {
"navigationBarTitleText": "上传图册"
}
}, {
"path": "pages/webview/html",
"style": {
"navigationBarTitleText": ""
}
}, {
"path": "pages/order/orderInfo",
"style": {
"navigationBarTitleText": "订单详情"
}
}, {
"path": "pages/project/index",
"style": {
"navigationBarTitleText": "项目列表"
}
}, {
"path": "pages/staff/index",
"style": {
"navigationBarTitleText": "员工列表"
}
}, {
"path": "pages/staff/add",
"style": {
"navigationBarTitleText": "项目列表"
}
}, {
"path": "pages/staff/createcap",
"style": {
"navigationBarTitleText": "分类管理"
}
}, {
"path": "pages/staff/createcapinfo",
"style": {
"navigationBarTitleText": "修改分类"
}
}, {
"path": "pages/stafflist/index",
"style": {
"navigationBarTitleText": "预约列表"
}
}, {
"path": "pages/stafflist/time",
"style": {
"navigationBarTitleText": "修改时间"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#fff",
"backgroundColor": "#F8F8F8"
},
"tabBar": {
"color": "#000000",
"selectedColor": "#318AFE",
"borderStyle": "white",
"backgroundColor": "#ffffff",
"list": [{
"pagePath": "pages/order/index",
"iconPath": "static/icon/orderPath.png",
"selectedIconPath": "static/icon/orderIconPath.png",
"text": "店铺订单"
}, {
"pagePath": "pages/project/index",
"iconPath": "static/icon/shopPath.png",
"selectedIconPath": "static/icon/shopIconPath.png",
"text": "项目管理"
}, {
"pagePath": "pages/staff/index",
"iconPath": "static/icon/staffPath.png",
"selectedIconPath": "static/icon/staffIconPath.png",
"text": "员工管理"
}, {
"pagePath": "pages/shop/index",
"iconPath": "static/icon/my.png",
"selectedIconPath": "static/icon/mypath.png",
"text": "店铺管理"
}]
}
}

496
pages/app/pay.vue Normal file
View File

@ -0,0 +1,496 @@
<template>
<view class="container">
<view class="card">
<view class="info-wrap">
<image class="cover" src="@/static/img_vipno_vip1-1.png" mode="aspectFill"></image>
<text class="t">{{ type == 1 ? '设备商城' : '在线支付' }}</text>
</view>
<view class="input-wrap">
<view class="input-cont">
<text class="i"></text>
<text class="num">{{ num }}</text>
</view>
<!-- <view class="tips"><input class="input" type="text" :maxlength="10" placeholder="添加付款备注最多10个字" v-model="remark" /></view> -->
</view>
</view>
<view class="card">
<view class="title"><text>支付方式</text></view>
<view class="pay-list">
<view class="item">
<view class="label">
<image class="icon" src="../../static/4.png" mode="aspectFit"></image>
<text class="t">微信支付</text>
</view>
<uni-icons type="checkbox-filled" size="18" color="#54A347"></uni-icons>
</view>
</view>
<view class="num-wrap">
<text>实付</text>
<text class="t b">{{ num || 0 }}</text>
</view>
</view>
<view class="btn-wrap">
<view class="btn" @click="submitHandle"><text>确认支付</text></view>
</view>
<u-popup :show="show" :closeable="false" round mode="bottom">
<view class="success-wrap">
<view class="title">{{ payState == 1 ? '支付成功' : '支付失败请返回APP重新下单' }}</view>
<view class="content">
<image class="img" src="@/static/success.png" mode="widthFix"></image>
</view>
<view class="popup-buttn">
<button class="btn" type="primary" open-type="launchApp"><text>返回APP</text></button>
</view>
</view>
</u-popup>
</view>
</template>
<script>
// import utils from '@/common/utils.js';
export default {
data() {
return {
type: 1,
num: '',
appid:'',
orderNumber: '',
show: false,
payState: 1,
options: {}
};
},
async onLoad(options) {
// #ifdef MP-WEIXIN
uni.login({
provider: 'weixin',
success: async (data) => {
try {
let res = await this.api.usergetopenid({
code: data.code
})
if (res) {
uni.setStorageSync('openId',res.data.openid);
// uni.cache.set('openId', res.data.openid);
}
} catch (e) {
console.log(e)
}
}
});
// #endif
this.orderNumber = options.orderNumber;
this.appid = options.appid
this.num = options.num;
if (options.type) {
this.type = options.type;
}
if (options.type && options.type == 2) {} else if (options.type && options.type != 1) {
this.options = options;
}
console.log({
openid: uni.getStorageSync('openId'),
orderNumber: this.orderNumber
});
// if (e.q) {
// this.userAppId = utils.getQueryString(decodeURIComponent(e.q), 'userAppId');
// this.getShopInfo();
// }
},
methods: {
//
async submitHandle() {
try {
uni.showLoading({
title: '支付中...',
mask: true
});
let res = '';
if (this.type == 1) {
res = await this.requestHandle('/wechat/orderPay', {
openid: uni.getStorageSync('openId'),
orderNumber: this.orderNumber,
appId: this.appid
});
} else if (this.type == 2) {
//
res = await this.wxRequest('/order/orderPay', {
openid: uni.getStorageSync('openId'),
orderNumber: this.orderNumber
});
} else if (this.type == 3) {
res = await this.wxRequest('/order/createorderApp', {
openId: uni.getStorageSync('openId'),
mobile: this.options.mobile,
productId: this.options.productId,
provinceName: this.options.provinceName,
paymentType: this.options.paymentType,
orderId: this.options.orderId
});
} else if (this.type == 4) {
res = await this.wxRequest('/order/createshoporderApp', {
openId: uni.getStorageSync('openId'),
productId: this.options.productId,
orderId: this.options.orderId
});
} else if (this.type == 5) {
res = await this.wxRequest('/order/createoilshoporderApp', {
openId: uni.getStorageSync('openId'),
productId: this.options.productId,
orderId: this.options.orderId
});
}
console.log('options222222===', res);
uni.requestPayment({
provider: 'wxpay',
timeStamp: res.data.payTimeStamp,
nonceStr: res.data.paynonceStr,
package: res.data.payPackage,
signType: res.data.paySignType,
paySign: res.data.paySign,
success: (res) => {
uni.hideLoading();
this.show = true;
},
fail: (err) => {
this.show = true;
this.payState = 2;
uni.hideLoading();
uni.showToast({
title: '支付失败',
icon: 'none'
});
}
});
} catch (e) {
this.show = true;
this.payState = 2;
uni.hideLoading();
uni.showModal({
title: '支付失败',
content: e,
showCancel: false
});
// uni.showToast({
// title: '2:' + JSON.stringify(e),
// icon: 'none'
// });
}
},
//
wxRequest(api = '', data = {}, method = 'post') {
console.log('data44444===', data);
return new Promise((resolve, reject) => {
uni.request({
url: `https://ky.sxczgkj.cn/wap${url}`,
method: method,
header: {
'Content-Type': 'application/x-www-form-urlencoded',
sourceId: 2
},
data: data,
success: (res) => {
console.log('err2===', res);
if (res.data.code == 0) {
resolve(res.data);
} else {
uni.showToast({
icon: 'none',
title: res.data.message
});
reject(res.data.message);
}
},
fail: (err) => {
console.log('err1===', err);
reject(JSON.stringify(err));
}
});
});
},
//
requestHandle(url = '', data = {}, method = 'post') {
return new Promise((resolve, reject) => {
uni.request({
url: `https://ky.sxczgkj.cn/wap${url}`,
method: method,
header: {
'content-type': 'application/json'
},
data: data,
success: (res) => {
if (res.data.code == 200) {
resolve(res.data);
} else {
uni.showToast({
icon: 'none',
title: res.data.message
});
reject(res.data.message);
}
},
fail: (err) => {
reject(JSON.stringify(err));
}
});
});
}
}
};
</script>
<style scoped lang="scss">
.btn-wrap {
width: 100%;
position: fixed;
bottom: 0;
left: 0;
padding: 28upx 28upx calc(env(safe-area-inset-bottom) + 28upx);
.btn {
padding: 20upx 0;
border-radius: 100upx;
background-color: #ffcc17;
color: #000;
font-size: 28upx;
display: flex;
justify-content: center;
}
}
.container {
padding: 28upx;
padding-bottom: 640upx;
}
.card {
padding: 28upx;
border-radius: 28upx;
background-color: #fff;
margin-bottom: 28upx;
.title {
font-size: 32upx;
}
}
.info-wrap {
display: flex;
align-items: center;
.cover {
$size: 80upx;
width: $size;
height: $size;
border-radius: 50%;
margin-right: 20upx;
background-color: #efefef;
}
.t {
font-size: 32upx;
}
}
.input-wrap {
padding: 28upx 0 0;
.input-cont {
display: flex;
align-items: center;
border-bottom: 1upx solid #ececec;
.i {
font-size: 42upx;
font-weight: bold;
margin-right: 12upx;
position: relative;
top: -4upx;
}
.num {
font-size: 48upx;
height: 80upx;
font-weight: bold;
position: relative;
padding-right: 14upx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
// &::after {
// content: '';
// width: 4upx;
// height: 40upx;
// background-color: #333;
// position: absolute;
// top: 50%;
// margin-top: -24upx;
// right: 0;
// animation: ani 0.8s ease-in-out 1.4s infinite;
// }
// @keyframes ani {
// 0% {
// opacity: 0;
// }
// 100% {
// opacity: 1;
// }
// }
}
}
.tips {
display: flex;
padding-top: 24upx;
.input {
flex: 1;
}
}
}
.pay-list {
.item {
display: flex;
justify-content: space-between;
padding: 28upx 0;
.label {
display: flex;
align-items: center;
.icon {
$size: 60upx;
width: $size;
height: $size;
margin-right: 20upx;
}
.t {
font-size: 28upx;
}
}
}
}
.num-wrap {
display: flex;
align-items: center;
justify-content: flex-end;
.t {
font-size: 32upx;
}
.b {
font-weight: bold;
}
}
.number-key-wrap {
width: 100%;
position: fixed;
left: 0;
bottom: 0;
background-color: #efefef;
z-index: 999;
padding: 28upx 28upx calc(env(safe-area-inset-bottom) + 28upx);
border-radius: 28upx 28upx 0 0;
$gap: 12upx;
$radius: 14upx;
$itemH: 120upx;
.number-key {
display: flex;
.item {
display: flex;
font-size: 48upx;
font-weight: bold;
align-items: center;
justify-content: center;
border-radius: $radius;
background-color: #fff;
&.active {
background-color: #d9d9d9;
}
}
.left {
flex: 1;
.num-list {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: $itemH $itemH $itemH;
grid-gap: $gap;
}
.num-foot {
padding-top: $gap;
display: grid;
grid-gap: $gap;
grid-template-columns: 2fr 1fr;
grid-template-rows: $itemH;
}
}
.right {
width: 160upx;
display: flex;
flex-direction: column;
margin-left: $gap;
.item {
flex: 1;
&:last-child {
margin-top: $gap;
font-size: 32upx;
}
&.confirm {
background-color: #ffcc17;
&.active {
background-color: #e1b516;
}
}
}
}
}
}
.success-wrap {
padding: 0 28upx calc(env(safe-area-inset-bottom) + 28upx);
.title {
padding: 28upx 0;
font-size: 32upx;
font-weight: bold;
display: flex;
justify-content: center;
}
.content {
.img {
width: 100%;
height: auto;
}
}
.btn {
padding: 12upx 0;
border-radius: 100upx;
font-size: 28upx;
background: #ffcc17;
color: #000;
}
}
</style>

547
pages/login/index.vue Normal file
View File

@ -0,0 +1,547 @@
<template>
<view class="container">
<view class="card">
<!-- <view class="info-wrap flex-colum">
<image class="cover" :src="list.store_avatar" mode="aspectFill"></image>
<text class="t">{{list.store_nickname}}</text>
</view> -->
<view class="input-wrap">
<view class="input-cont">
<text class="i"></text>
<input class="num" type="text" v-model="amount" :readonly="true" @input="checkNum($event)" />
</view>
<!-- <view class="tips"><input class="input" type="text" :maxlength="10" placeholder="添加付款备注最多10个字" v-model="remark" /></view> -->
</view>
</view>
<button @click="clickbutton">按钮</button>
</view>
</template>
<script>
export default {
data() {
return {
showpopup: false,
ucodeinputvalue: '',
amount: "",
pay_type: 1,
list: '',
};
},
// async onLoad(options) {
// this.reservationpaythebill()
// },
// computed: {
// theme() {
// return this.$store.getters.theme
// },
// },
methods: {
clickbutton() {
uni.login({
provider: 'weixin',
success: (data) => {
uni.request({
url: 'http://192.168.2.23:2058/api/index/pay', //
data: {
code: data.code
},
method: "POST",
// header: {
// 'custom-header': 'hello' //
// },
success: (res) => {
console.log(res)
// #ifdef MP-WEIXIN
uni.requestPayment({
provider: 'wxpay', //-
partnerid: res.data.data.data.payAppId, //
timeStamp: res.data.data.data.payTimeStamp, //
nonceStr: res.data.data.data.paynonceStr, //
package: res.data.data.data.payPackage, //
signType: res.data.data.data.paySignType, //
paySign: res.data.data.data.paySign, //
success: (res) => {
uni.hideLoading()
uni.showToast({
title: "支付成功"
})
},
fail: (err) => {
setTimeout(res => {
uni.showToast({
icon: 'none',
title: '支付失败'
})
uni.hideLoading()
}, 2000)
}
});
// #endif
},
fail(res) {
uni.showToast({
title: res.data.message || res.data.msg
})
}
});
}
});
},
async getPhoneNumber(res) { //
var resdataa = res
// #ifdef MP-WEIXIN
uni.login({
provider: 'weixin',
success: async (data) => {
let resdata = await this.api.usergetwechatphone({
code: data.code,
iv: resdataa.detail.iv,
encryptedData: resdataa.detail.encryptedData
})
try {
this.mobiles = resdata.mobile
} catch (e) {
uni.showToast({
title: '获取失败'
})
}
}
});
// #endif
},
//
checkNum(e) {
let val = e.target.value.replace(/(^\s*)|(\s*$)/g, "")
console.log(val);
if (!val) {
this.amount = '';
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.amount = val;
})
},
pay_typeclick(e) {
this.pay_type = e
},
async reservationpaythebill() {
let res = await this.api.reservationpaythebill({
store_id: uni.cache.get('store_id') //
})
this.list = res
},
openpopup() {
console.log('open');
},
closepopup() {
this.ucodeinputvalue = ''
this.showpopup = false
},
finish(e) {
this.showpopup = false
this.reservationmakenowsub()
},
async showpopupclick() {
if (this.amount == null || this.amount == '') {
uni.showToast({
title: '支付金额不能为0',
icon: 'none'
});
return false;
}
if (this.pay_type == 1) {
this.reservationmakenowsub()
}
if (this.pay_type == 2) {
let res = await this.api.useruserinfo() //p
uni.cache.set('loginuser', res);
if (res.userinfo.mobile) {
if (this.list.user_sec_password == 0) {
uni.showModal({
title: '提示',
content: '您目前没有设置密码,请先设置支付密码',
success: function(res) {
if (res.confirm) {
uni.redirectTo({
url: '/pages/my/setup/repairpassword'
});
} else if (res.cancel) {}
}
});
} else {
this.showpopup = true
}
} else {
uni.showModal({
title: '提示',
content: '确认订单需要获取您的手机号',
success: function(res) {
if (res.confirm) {
uni.redirectTo({
url: '/pages/my/setup/index'
});
} else if (res.cancel) {}
}
});
}
}
},
async reservationmakenowsub() {
uni.showLoading({
title: '加载中',
mask: true
})
try {
var res = await this.api.reservationpaythebillsub({
store_id: uni.cache.get('store_id'), //
amount: this.amount,
pay_type: this.pay_type,
sec_password: this.ucodeinputvalue
})
this.ucodeinputvalue = ''
if (res.pay_status == 0) {
// #ifdef MP-WEIXIN
uni.requestPayment({
provider: 'wxpay', //-
partnerid: res.pay_data.payAppId, //
timeStamp: res.pay_data.payTimeStamp, //
nonceStr: res.pay_data.paynonceStr, //
package: res.pay_data.payPackage, //
signType: res.pay_data.paySignType, //
paySign: res.pay_data.paySign, //
success: (res) => {
uni.hideLoading()
uni.showToast({
title: "支付成功"
})
setTimeout(res => {
uni.navigateBack()
}, 1500)
},
fail: (err) => {
setTimeout(res => {
uni.showToast({
icon: 'none',
title: '支付失败'
})
uni.hideLoading()
}, 2000)
}
});
// #endif
} else {
uni.hideLoading()
uni.showToast({
title: "支付成功"
})
setTimeout(res => {
uni.navigateBack()
}, 1500)
}
} catch (e) {
}
},
}
};
</script>
<style scoped lang="scss">
page {
background: #f8f7f7;
}
.u-popupflex-colum {
padding: 80rpx 40rpx;
border-radius: 50rpx;
background: #FFFFFF;
.u-popupflex-columview {
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
font-weight: normal;
color: #000;
font-weight: bold;
margin-bottom: 50rpx;
}
}
.btn-wrap {
width: 100%;
position: fixed;
bottom: 50rpx;
left: 0;
padding: 28upx 28upx calc(env(safe-area-inset-bottom) + 28upx);
.btn {
padding: 20upx 0;
background: var(--bg-color-button);
border-radius: 34rpx;
font-size: 32rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
display: flex;
justify-content: center;
button::after {
border: none !important;
padding: 0 !important;
margin: 0 !important;
}
button {
background-color: transparent !important;
padding: 0 !important;
color: #FFFFFF;
line-height: inherit !important;
margin: 0 !important;
width: 100% !important;
font-weight: 500 !important;
border-radius: none !important;
}
}
}
.container {
padding: 28upx;
padding-bottom: 640upx;
}
.card {
padding: 28upx;
border-radius: 28upx;
background-color: #fff;
margin-bottom: 28upx;
.title {
font-size: 32upx;
}
}
.info-wrap {
display: flex;
align-items: center;
.cover {
$size: 80upx;
width: $size;
height: $size;
border-radius: 50%;
margin-right: 20upx;
background-color: #efefef;
}
.t {
font-size: 32upx;
}
}
.input-wrap {
padding: 28upx 0 0;
.input-cont {
display: flex;
align-items: center;
border-bottom: 1upx solid #ececec;
.i {
font-size: 42upx;
font-weight: bold;
margin-right: 12upx;
position: relative;
top: -4upx;
}
.num {
font-size: 48upx;
height: 80upx;
font-weight: bold;
position: relative;
padding-right: 14upx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.tips {
display: flex;
padding-top: 24upx;
.input {
flex: 1;
}
}
}
.pay-list {
.item {
padding: 28upx 0;
.label {
display: flex;
align-items: center;
.icon {
$size: 42upx;
width: $size;
height: $size;
margin-right: 20upx;
}
.t {
.t_one {
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #333333;
}
.t_tow {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
}
}
.num-wrap {
display: flex;
align-items: center;
justify-content: flex-end;
.t {
font-size: 32upx;
}
.b {
font-weight: bold;
}
}
.number-key-wrap {
width: 100%;
position: fixed;
left: 0;
bottom: 0;
background-color: #efefef;
z-index: 999;
padding: 28upx 28upx calc(env(safe-area-inset-bottom) + 28upx);
border-radius: 28upx 28upx 0 0;
$gap: 12upx;
$radius: 14upx;
$itemH: 120upx;
.number-key {
display: flex;
.item {
display: flex;
font-size: 48upx;
font-weight: bold;
align-items: center;
justify-content: center;
border-radius: $radius;
background-color: #fff;
&.active {
background-color: #d9d9d9;
}
}
.left {
flex: 1;
.num-list {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: $itemH $itemH $itemH;
grid-gap: $gap;
}
.num-foot {
padding-top: $gap;
display: grid;
grid-gap: $gap;
grid-template-columns: 2fr 1fr;
grid-template-rows: $itemH;
}
}
.right {
width: 160upx;
display: flex;
flex-direction: column;
margin-left: $gap;
.item {
flex: 1;
&:last-child {
margin-top: $gap;
font-size: 32upx;
}
&.confirm {
background-color: #ffcc17;
&.active {
background-color: #e1b516;
}
}
}
}
}
}
.success-wrap {
padding: 0 28upx calc(env(safe-area-inset-bottom) + 28upx);
.title {
padding: 28upx 0;
font-size: 32upx;
font-weight: bold;
display: flex;
justify-content: center;
}
.content {
.img {
width: 100%;
height: auto;
}
}
.btn {
padding: 12upx 0;
border-radius: 100upx;
font-size: 28upx;
background: #ffcc17;
color: #000;
}
}
</style>

265
pages/login/login.vue Normal file
View File

@ -0,0 +1,265 @@
<template>
<view class="container">
<view class="containerimage flex-colum">
<view class="containerimage_logo">
<image class="input_itemone" src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/manage/login2.png"
mode=""></image>
</view>
</view>
<view class="wrapper">
<view class="wrapper_box">
<view class="input_content">
<view class="input_item flex-start">
<image class="input_itemone"
src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/manage/loginin2.png" mode=""></image>
<view class="input_itemtow flex-colum-start">
<text class="tit">手机号码</text>
<input type="number" v-model="username" :adjust-position="false" placeholder="请输入账号" />
</view>
</view>
<view class="input_item flex-start">
<image class="input_itemone"
src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/manage/loginin1.png" mode=""></image>
<view class="input_itemtow flex-colum-start">
<text class="tit">密码</text>
<input type="mobile" v-model="password" :adjust-position="false" placeholder="8-16位密码"
maxlength="16" :password="!showPassword" />
<view class="input_itemtowicon" @click="display">
<u-icon name="eye" v-if="showPassword"></u-icon>
<u-icon v-else name="eye-off"></u-icon>
</view>
</view>
</view>
</view>
<view class="agreement flex-start">
<u-checkbox-group><u-checkbox shape="circle" @change="radioChange"
size="16"></u-checkbox></u-checkbox-group>
<text>阅读并同意银收客商家端</text>
<view class="agreement-Item" @click="Privacy(1)">用户协议</view>
<view class="agreement-Item" @click="Privacy(2)">隐私政策</view>
</view>
<view class="confirm-button" @click="toLogin">
登录
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
username: '',
radioChangeItem: false, //
password: '',
logining: false,
showPassword: false, //
}
},
onLoad() {
uni.cache.clear();
},
methods: {
radioChange(n) {
//
this.radioChangeItem = n;
},
display() {
//
this.showPassword = !this.showPassword;
},
Privacy(e) {
if (e == 1) {
//
uni.pro.navigateTo('webview/html', {
src: e
});
} else {
uni.pro.navigateTo('webview/html', {
src: e
});
}
},
async toLogin() {
//
if (this.username == null || this.username == '') {
uni.showToast({
title: '请输入电话号码',
icon: 'none'
});
return false;
}
if (this.password == null || this.password == '' || uni.$u.trim(this.password, 'all') == '') {
uni.showToast({
title: '请输入密码或密码不能输入空格',
icon: 'none'
});
return false;
}
if (this.radioChangeItem == false) {
uni.showToast({
icon: 'none',
title: '请先阅读《用户协议》和《隐私政策》'
});
return;
}
// #ifdef H5
let res = await this.api.userlogin({
code: '0c3KOzFa1lkuMF0enAHa1Eu2xG1KOzFJ',
username: this.username,
password: this.password
})
try {
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 {
uni.redirectTo({
url: '/pages/stafflist/index'
})
}
} catch (e) {
//TODO handle the exception
}
// #endif
// #ifdef MP-WEIXIN
uni.login({
provider: 'weixin',
success: async (data) => {
uni.cache.set('weixincode', data.code);
let res = await this.api.userlogin({
code: data.code,
username: this.username,
password: this.password
});
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 {
uni.redirectTo({
url: '/pages/stafflist/index'
})
}
}
});
// #endif
}
},
}
</script>
<style lang="scss">
page {
background: #F9F9F9;
}
.container {
position: relative;
.containerimage {
position: relative;
width: 100%;
height: 538rpx;
background: url('https://ointmentweapp.oss-cn-beijing.aliyuncs.com/manage/login1.png') no-repeat;
background-size: cover;
.containerimage_logo {
border-radius: 50%;
width: 180rpx;
height: 180rpx;
image {
width: 100%;
height: 100%;
}
}
}
.wrapper {
position: relative;
top: -118rpx;
z-index: 90;
padding: 0 28rpx;
.wrapper_box {
width: 100%;
background: #FFFFFF;
border-radius: 32rpx;
padding: 16rpx 30rpx;
.input_content {
.input_item {
margin-top: 32rpx;
.input_itemone {
width: 49.68rpx;
height: 49.68rpx;
}
.input_itemtow {
position: relative;
flex: auto;
margin-left: 16rpx;
.input_itemtowicon {
position: absolute;
right: 0;
bottom: 20rpx;
z-index: 999;
}
.tit {
font-size: 32rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
input {
width: 100%;
padding: 10rpx 0;
border-bottom: 2rpx solid rgba(229, 229, 229, 0.7);
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #999999;
}
}
}
}
.agreement {
margin-top: 24rpx;
font-size: 20rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #7c8e97;
.agreement-Item {
color: #4ca1fc;
}
}
.confirm-button {
margin: 40rpx auto 50rpx auto;
width: 90%;
background: #2F87FD;
padding: 28rpx 0;
border-radius: 50rpx;
text-align: center;
box-shadow: 0px 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
font-size: 36rpx;
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-weight: bold;
color: #FFFFFF;
}
}
}
}
</style>

View File

@ -0,0 +1,787 @@
<template>
<view class="index">
<view class="title_text">
基本信息
</view>
<view class="onecontent">
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
商品主图
</view>
<view class="onecontent_itemright flex-start">
<view v-if="form.host_img" class="onecontent_itemrightimges flex-colum" @click="chooseImagelist()">
<image :src="form.host_img"></image>
</view>
<view v-else class="onecontent_itemrightimges flex-colum" @click="chooseImagelist()">
+
</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">
商品描述
</view>
<view class="onecontent_itemright flex-start">
<input class="onecontent_itemright_text" v-model="form.intro" type="text" placeholder="请输入商品描述">
</view>
</view>
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
商品分类
</view>
<view class="onecontent_itemright flex-start" @click="clicksheetshow">
<text style="flex: 1; text-align: right;" class="onecontent_itemrighttext"
v-if="form.name">{{form.name}}</text>
<text style="flex: 1; text-align: right;" class="onecontent_itemrighttext" v-else>请选择</text>
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
</view>
</view>
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
上架
</view>
<u-switch v-model="form.status" @change="changeswitch" size="20"></u-switch>
</view>
</view>
<view v-for="(item,index) in form.spec" :key="index">
<view class="title_text flex-between">
<text>商品规格({{index}})</text>
<view class="onecontentesbox flex-start">
<view class="onecontentesboxone" v-if="index == 0" @click="increasespec">添加</view>
<view class="onecontentesboxonetow" @click="deletespec(index)">删除</view>
</view>
</view>
<view class="onecontent onecontentes">
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
规格图片
</view>
<view class="onecontent_itemright flex-start">
<view v-if="item.img" class="onecontent_itemrightimges flex-colum"
@click="chooseImagelistssss(index)">
<image :src="item.img"></image>
</view>
<view v-else class="onecontent_itemrightimges flex-colum" @click="chooseImagelistssss(index)">
+
</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="item.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="item.price" 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="item.y_price" 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="item.stock" type="text" placeholder="请输入库存">
</view>
</view>
<!--<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
上架
</view>
<u-switch v-model="form.status" @change="changeswitch" size="20"></u-switch>
</view>
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
推荐
</view>
<u-switch v-model="form.is_re" @change="changeswitchs" size="20"></u-switch>
</view> -->
</view>
</view>
<view class="title_text">
商品描述
</view>
<view class="onecontent">
<!-- <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 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>
</view>
</view>
</view>
<view class="baocun" @tap="$u.debounce(servicecreateitem,1000)">
保存
</view>
<view class="baocun" v-if="form.goods_id!=''" @click="servicedelservice" style="background: red;">
删除
</view>
<u-action-sheet :actions="listsheet" :show="sheetshow" @select="selectClick"></u-action-sheet>
</view>
</template>
<script>
import uploadImage from "@/js_sdk/yushijie-ossutil/ossutil/uploadFile.js";
export default {
data() {
return {
listsheet: [],
sheetshow: false,
readOnly: false,
formats: {},
context: {},
form: {
type: 1, //1 2
title: '',
intro: '', //
host_img: '', //
goods_type_id: '', //ID
status: true,
details: '',
goods_id: '',
spec: [{
title: '',
price: '',
y_price:"",
img: '',
stock: ''
}]
}
}
},
async onLoad(e) {
try {
if (e.id) {
this.form.goods_id = e.id
uni.setNavigationBarTitle({
title: '修改商品'
})
let res = await this.api.shoppinggoodsdetail({
goods_id: e.id
})
if (res.code = 1) {
this.form = res.data
if(res.data.spec.length == 0){
this.increasespec()
}
this.form.type = 2 //1 2
var thisdatadescribe = res.data.details
uni.createSelectorQuery().select('#editor').context((res) => {
if (!res) return
res.context.setContents({
html: thisdatadescribe
})
}).exec()
console.log(this.form)
}
this.form.goods_id = e.id
}else{
uni.setNavigationBarTitle({
title: '添加商品'
})
}
} catch (e) {
//TODO handle the exception
}
this.serviceitemclass()
},
onShow() {},
mounted() {
this.$bus.$on('editors', this.demo)
},
methods: {
clicksheetshow() {
if (this.listsheet.length == 0) {
uni.showToast({
title: '请先去添加分类',
icon: 'none'
});
} else {
this.sheetshow = true
}
},
increasespec() {
this.form.spec.push({
title: '',
price: '',
y_price:'',
img: '',
stock: ''
})
},
deletespec(index) {
if (this.form.spec.length != 1) {
this.form.spec.splice(index, 1)
} else {
uni.showToast({
title: '最少需要一个规格',
icon: 'none'
});
}
},
demo(data) {
this.form.details = data
},
demos() {
uni.pro.navigateTo('project/editor/editor', {
id: this.form.goods_id
})
},
selectClick(index) {
this.sheetshow = false
this.form.name = index.name
this.form.goods_type_id = index.id
console.log(index)
},
changeswitch(e) {
this.form.status = e
},
changeswitchs(e) {
this.form.is_re = e
},
async serviceitemclass(e) { //
let data = await this.api.shoppinggooodstype({
page:1
});
this.listsheet = data.data
},
async servicecreateitem() {
if (this.form.title == null || this.form.title == '') {
uni.showToast({
title: '请填写商品名称',
icon: 'none'
});
return false;
}
if (this.form.intro == null || this.form.intro == '') {
uni.showToast({
title: '请输入商品描述',
icon: 'none'
});
return false;
}
if (this.form.details == null || this.form.details == '') {
uni.showToast({
title: '商品详情不能为空',
icon: 'none'
});
return false;
}
if (this.form.goods_type_id == null || this.form.goods_type_id == '') {
uni.showToast({
title: '请选择商品分类',
icon: 'none'
});
return false;
}
if (this.form.host_img == null || this.form.host_img == '') {
uni.showToast({
title: '主图不能为空',
icon: 'none'
});
return false;
}
let res = await this.api.shoppingcreategoods({
title: this.form.title,
intro: this.form.intro,
host_img: this.form.host_img,
goods_type_id: this.form.goods_type_id,
spec: this.form.spec,
status: this.form.status,
details: this.form.details,
goods_id: this.form.goods_id,
type: this.form.type
});
if (res.code == 1) {
uni.showToast({
title: this.form.goods_id ? '修改成功' : '创建成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
},
async servicedelservice() {
var this_ = this
console.log(this.form.goods_id)
uni.showModal({
title: '提示',
content: '确认删除该商品吗?',
success: async (res) => {
if (res.confirm) {
let data = await this.api.shoppingdeletegoods({
goods_id: this_.form.goods_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, 'mailproject/',
result => {
this.form.host_img = ''
this.form.host_img = result
uni.hideLoading()
}, result => {
console.log(result, '2222')
uni.hideLoading()
})
},
fail: (res) => {
uni.hideLoading()
}
});
},
//
chooseImagelistssss(index) {
var thisindex = index
uni.showLoading({
title: '上传中',
mask: true
})
uni.chooseImage({
count: 1, //9
sizeType: ['original', 'compressed'], //
sourceType: ['album'], //
success: (res) => {
let file = res.tempFilePaths[0];
uploadImage(file, 'mailproject/',
result => {
this.form.spec[thisindex].img = ''
this.form.spec[thisindex].img = result
uni.hideLoading()
}, result => {
console.log(result, '2222')
uni.hideLoading()
})
},
fail: (res) => {
uni.hideLoading()
}
});
},
getText(e) {
this.context = e.detail.html
this.form.details = this.context
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
},
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/',
result => {
this.editorCtx.insertImage({
src: result,
alt: '图像',
})
uni.hideLoading()
}, result => {
console.log(result)
uni.hideLoading()
})
},
fail: (res) => {
uni.hideLoading()
}
});
}
}
}
</script>
<style lang="scss">
@import "./editor-icon.css";
page {
background: #F6F6F6;
}
.index {
.title_text {
padding: 12rpx 40rpx;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
.onecontentesbox {
font-size: 28rpx;
font-family: SourceHanSansCN, SourceHanSansCN;
font-weight: 400;
color: #666666;
.onecontentesboxone {
padding: 10rpx 16rpx;
font-size: 28rpx;
font-family: SourceHanSansCN, SourceHanSansCN;
font-weight: 400;
background: #2979ff;
border-radius: 20rpx;
color: #fff;
}
.onecontentesboxonetow {
margin-left: 10rpx;
border-radius: 20rpx;
padding: 10rpx 16rpx;
font-size: 28rpx;
color: #fff;
font-family: SourceHanSansCN, SourceHanSansCN;
font-weight: 400;
background: #fc5f69;
}
}
}
#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;
.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;
}
}
.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;
}
}
}
}
}
}
}
</style>

View File

@ -0,0 +1,204 @@
<template>
<view class="index">
<view class="title_text">
创建分类
</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="titles" maxlength="8" type="text"
placeholder="请输入商品分类">
</view>
</view>
</view>
<view class="thereconse" @click="servicecreateitemclass">
确定
</view>
<view class="title_text">
管理分类
</view>
<view class="onecontent">
<view class="onecontent_item flex-between" v-for="(item,index) in list" :key="index"
@click="contentfixedclick(item)">
<view class="onecontent_itemleft">
{{item.name}}
</view>
<u-icon name="arrow-right" color="#333" size="20"></u-icon>
</view>
</view>
<view v-if="list.length==0 && is_end == true" style="margin-top: 100rpx;width: 100%;" class="flex-colum">
<image src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/nothave.png" mode="">
</image>
</view>
<u-loadmore :status="form.status" />
</view>
</template>
<script>
export default {
data() {
return {
titles: '',
list: [],
is_end: false,
form: {
page: 1,
status: 'loadmore',
},
}
},
onReachBottom() {
this.shoppinggooodstype()
},
onShow() {
this.init_fn()
},
methods: {
init_fn() {
this.list = []
this.is_end = false
this.form.page = 1
this.form.status = 'loadmore'
this.shoppinggooodstype()
},
async shoppinggooodstype() {
let res = await this.api.shoppinggooodstype({
page:this.form.page
});
if (res.code == 1) {
if (res.data.length == 0) {
this.is_end = true
this.form.status = 'nomore'
return false;
} else {
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.list = [...this.list, ...res.data];
if (res.data.length == 10) {
this.form.status = 'loading';
} else {
this.is_end = true;
this.form.status = 'nomore';
}
}, 500)
}
}
},
contentfixedclick(e) {
// let data = {
// title: e.title,
// goods_type_id: e.id
// }
uni.navigateTo({
url: '/pages/mailproject/createcapinfo?name=' + e.name +'&goods_type_id='+ e.id
});
},
async servicecreateitemclass() {
let res = await this.api.shoppingcreategoodstype({
title: this.titles,
type: 1,
goods_type_id: ''
});
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;
}
#editor {
width: 100%;
height: 456rpx;
padding: 12rpx 40rpx;
background: #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;
}
.onecontent_itemright_text {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
}
.thereconse {
width: 630rpx;
height: 80rpx;
background: #999999;
border-radius: 40rpx;
font-size: 36rpx;
text-align: center;
margin: 50rpx auto;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
line-height: 80rpx;
background: #6699FF;
border-radius: 16rpx;
}
}
</style>

View File

@ -0,0 +1,161 @@
<template>
<view class="index">
<view class="title_text">
修改分类
</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.name" maxlength="8" type="text"
placeholder="请输入商品分类">
</view>
</view>
</view>
<view class="thereconse" @click="servicecreateitemclass">
确定
</view>
<view class="thereconse thereconsess" @click="shoppingdeletegoodstype">
刪除
</view>
</view>
</template>
<script>
export default {
data() {
return {
form: {
name:'',
goods_type_id:''
},
}
},
onLoad(e) {
this.form.name = e.name
this.form.goods_type_id = e.goods_type_id
},
methods: {
async shoppingdeletegoodstype(){
let res = await this.api.shoppingdeletegoodstype({
goods_type_id:this.form.goods_type_id
});
if (res.code == 1) {
uni.showToast({
title: '删除成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
},
async servicecreateitemclass() {
let res = await this.api.shoppingcreategoodstype({
title: this.form.name,
type:2,
goods_type_id:this.form.goods_type_id
});
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;
}
#editor {
width: 100%;
height: 456rpx;
padding: 12rpx 40rpx;
background: #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;
}
.onecontent_itemright_text {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
}
.thereconse {
width: 630rpx;
height: 80rpx;
background: #999999;
border-radius: 40rpx;
font-size: 36rpx;
text-align: center;
margin: 50rpx auto;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
line-height: 80rpx;
background: #6699FF;
border-radius: 16rpx;
}
.thereconsess{
background:#fc5f69;
}
}
</style>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,271 @@
<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.servicedetail({
service_id: e.id
})
if (res.code = 1) {
var thisdatadescribe = res.data.details
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('editors', 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/',
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.

233
pages/mailproject/index.vue Normal file
View File

@ -0,0 +1,233 @@
<template>
<view class="content">
<view class="onecontent flex-between">
<u-search shape="square" :clearabled="true" @blur='servicelists' :showAction="false" placeholder="输入关键字"
v-model="like"></u-search>
<view class="flex-start" style="padding-left:20rpx;" @click="contentfixedclick()">
<u-icon name="order" color="#666" size="22"></u-icon>
<text class="flex-starttext">新建商品</text>
</view>
<view class="flex-start" style="padding-left:20rpx;" @click="createcap()">
<u-icon name="order" color="#666" size="22"></u-icon>
<text class="flex-starttext">新建分类</text>
</view>
</view>
<view class="contenttow">
<view class="contenttowitem" v-for="(item,index) in list" :key="index" @click="contentfixedclick(item)">
<view class="contenttowitemone flex-between">
<text class="contenttowitemone_one"
:style="item.service_status == 0?'color: #ccc;':''">{{item.title}}</text>
<view class="contenttowitemone_tow flex-start" >
<text class="contenttowitemone_towtext">编辑商品</text>
<u-icon name="file-text" color="#999" size="20"></u-icon>
</view>
</view>
<view class="contenttowitemtow flex-between" v-for="(item1,index1) in item.spec" :key="index1">
<image class="contenttowitemtowimage" :src="item1.img" mode=""></image>
<view class="contenttowitemtow_item flex-colum-start">
<view class="contenttowitemtow_itemone" :style="item.service_status == 0?'color: #ccc;':''">
{{item1.title}}
</view>
<view class="contenttowitemtow_ittow flex-between">
<view class="contenttowitemtow_ittowone">
¥{{item1.price}}
<!-- <text class="contenttowitemtow_ittowonetext">{{item1.price}}</text> -->
</view>
<view class="contenttowitemtow_ittowtow">
<text v-if="item.status == 1" style="color: green;">已上架</text>
<text v-else style="color: red;">已下架</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view v-if="list.length==0 && form.is_end == true" class="flex-colum">
<image src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/nothave.png" mode="">
</image>
</view>
<u-loadmore :status="form.status" />
</view>
</template>
<script>
export default {
data() {
return {
like: "",
list: [],
form: {
is_end: false,
page: 1,
status: 'loadmore',
},
}
},
onShow() {
this.form = {
is_end: false,
page: 1,
status: 'loadmore',
},
this.list = []
this.shoppinggoodslist()
},
onReachBottom() {
this.shoppinggoodslist()
},
methods: {
servicelists() {
this.list = []
this.form.page = 1
this.shoppinggoodslist()
},
contentfixedclick(e) {
if(e){
uni.pro.navigateTo('mailproject/create', {
id: e.id
})
}else{
uni.pro.navigateTo('mailproject/create')
}
},
createcap() {
uni.pro.navigateTo('mailproject/createcap')
},
async shoppinggoodslist(e) { //
let res = await this.api.shoppinggoodslist({
page: this.form.page,
like: this.like
});
if (res.data.length == 0) {
this.form.is_end = true
this.form.status = 'nomore'
return false;
} else {
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.list = [...this.list, ...res.data];
if (res.data.length == 10) {
this.form.status = 'loading';
} else {
this.form.is_end = true;
this.form.status = 'nomore';
}
}, 500)
}
},
}
}
</script>
<style lang="scss">
page {
background: #fbfbfa;
}
.content {
.onecontent {
padding: 16rpx 20rpx;
width: 100%;
background: #FFFFFF;
.flex-start {
.flex-starttext {
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
}
}
.contenttow {
padding: 0 28rpx;
.contenttowitem {
margin-top: 34rpx;
padding: 24rpx;
width: 100%;
background: #FFFFFF;
border-radius: 24rpx;
.contenttowitemone {
width: 100%;
padding-bottom: 18rpx;
border-bottom: 1rpx solid #EAEAEA;
.contenttowitemone_one {
width: 60%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 28rpx;
font-family: SourceHanSansCN-Medium, SourceHanSansCN;
font-weight: bold;
color: #333333;
}
.contenttowitemone_tow {
.contenttowitemone_towtext {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
}
}
.contenttowitemtow {
width: 100%;
padding: 18rpx 0;
border-bottom: 1rpx solid #ccc;
.contenttowitemtowimage {
width: 136rpx;
height: 136rpx;
border-radius: 10rpx;
}
.contenttowitemtow_item {
height: 136rpx;
width: 75%;
justify-content: space-between;
.contenttowitemtow_itemone {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #333333;
}
.contenttowitemtow_ittow {
width: 100%;
.contenttowitemtow_ittowone {
font-size: 32rpx;
font-family: SourceHanSansCN-Medium, SourceHanSansCN;
font-weight: bold;
color: #333333;
.contenttowitemtow_ittowonetext {
text-decoration: line-through;
margin-left: 10rpx;
font-size: 22rpx;
font-weight: 400;
}
}
.contenttowitemtow_ittowtow {
font-size: 16rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
}
}
}
}
</style>

872
pages/mall/index.vue Normal file
View File

@ -0,0 +1,872 @@
<template>
<view class="content">
<view class="onecontent">
<view class="flex-start">
<view class="onecontent_oen flex-start">
<input class="onecontent_oen_input" type="text" v-model="like" placeholder="搜索订单/商家名/商品名">
<text class="onecontent_oen_text" @click="init_fn">搜索</text>
</view>
</view>
<view class="onecontent_tow flex-between">
<view ref="uTabs" class="onecontent_tow_item flex-colum" v-for="(item,index) in swipercurrentdata"
:key="index" @click="orderswitch(index)">
<view :class="swiperCurrent == index?'onecontent_tow_itemtexts':'onecontent_tow_itemtext'">
{{item.name}}
</view>
</view>
</view>
</view>
<view class="towcontent">
<swiper :current="swiperCurrent" @animationfinish="animationfinish" :style="{height:height}">
<swiper-item v-for="(item,index) in list_" :key="index">
<scroll-view scroll-y style="width: 100%;" :style="{height:height}" @scrolltolower="lower">
<view class="towcontentitem" v-for="(item1,index1) in list_[index].data" :key="index1">
<view class="towcontentitemone flex-between">
<text class="towcontentitemone_one">{{item1.store_title}}</text>
<view class="towcontentitemone_tow flex-start">
<!-- <image class="towcontentitemone_towimage"
:src="item.store_avatar"
mode="">
</image> -->
<text v-if="item1.status == 0">待付款</text>
<text v-if="item1.status == 1">待发货</text>
<text v-if="item1.status == 2">待收货</text>
<text v-if="item1.status == 3">已收货/评价</text>
<text v-if="item1.status == 4">退款中 </text>
<text v-if="item1.status == 5">退款成功</text>
<text v-if="item1.status == 6">取消订单</text>
<text v-if="item1.status == 7">已拒绝</text>
<text v-if="item1.deletetime" style="color: red;">(用户已删除)</text>
</view>
</view>
<view class="towcontentitemtow flex-start" v-for="(item2,index2) in item1.goods"
:key="index2" @click="eeInfo(item2)">
<image class="towcontentitemtow_imge" :src="item2.img" mode=""></image>
<view class="towcontentitemtow_one flex-start">
<text class="towcontentitemtow_one_one">{{item2.title}}</text>
<view class="flex-colum">
<text class="towcontentitemtow_one_tow"><text
style="font-size:24rpx;">¥</text>{{item2.goods_price}}</text>
<text class="towcontentitemtow_one_there">×{{item2.number}}</text>
</view>
</view>
<!-- <view class="towcontentitemtow_tow">
{{item2.number}}
</view> -->
</view>
<view class="towcontentitemthere_text_iitem">
{{item1.number}}件商品 合计:<text>{{item1.goods_total_price}}</text>
</view>
<view class="towcontentitemthere">
<view v-if="item1.status == 2 || item1.status == 0"
class="towcontentitemthereitem towcontentitemthereitem_there"
@click.stop="orderokprebook(item1)">
去发货
</view>
<view v-if="item1.status == 2 || item1.status == 1"
class="towcontentitemthereitem towcontentitemthereitem_tow"
@click.stop="orderrefuseprebook(item1)">
取消订单并退款
</view>
<view v-if="item1.status == 3"
class="towcontentitemthereitem towcontentitemthereitem_tow"
@click.stop="orderordercancel(item1)">
取消订单/并退款
</view>
<view class="towcontentitemthereitem towcontentitemthereitem_there"
v-if="item1.status == 3" @click.stop="orderorderdelete(item1)">
完成服务
</view>
</view>
<u-overlay :show="overlayshow" @click.stop="overlayshow = false" opacity='0.1'>
<view class="warp">
<view class="rect flex-colum" @tap.stop>
<view class="rectone">
确定{{clickoverlayshowtext}}?
</view>
<view class="recttow flex-between">
<view class="recttow_one" @click="cancelOrder(item.status)">
确定
</view>
<view class="recttow_tow" @click="overlayshow = false">
取消
</view>
</view>
</view>
</view>
</u-overlay>
</view>
<view v-if="list_[index].data.length == 0 && list_[index].is_end == true" class="flex-colum">
<image class="" style="margin-top: 100rpx;"
src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/nothave.png"
mode="">
</image>
</view>
<u-loadmore :status="list_[index].status" />
</scroll-view>
</swiper-item>
</swiper>
</view>
</view>
</template>
<script>
export default {
data() {
return {
height: "",
// tabsswipercurrent
current: 0, // tabscurrenttab
swiperCurrent: 0, // swipercurrentswiper-item
overlayshow: false,
list_: {
list0: { //
data: [],
page: 1,
status: 'loadmore',
is_end: false,
},
list1: { //
data: [],
page: 1,
status: 'loadmore',
is_end: false,
},
list2: { //
data: [],
page: 1,
status: 'loadmore',
is_end: false,
},
list3: { //
data: [],
page: 1,
status: 'loadmore',
is_end: false,
},
list4: { //
data: [],
page: 1,
status: 'loadmore',
is_end: false,
}
},
like: '', //
clickoverlayshowtext: "",
swipercurrentdata: [{
name: '全部'
}, {
name: '待付款'
}, {
name: '待发货'
}, {
name: '待收货'
}, {
name: '已收货/退款售后'
}],
form: {
status: 'loadmore',
},
}
},
onShow() {
if (uni.cache.get('token')) {
uni.setNavigationBarTitle({
title: uni.cache.get('user').nickname
})
this.init_fn();
}
},
mounted() {
var query = uni.createSelectorQuery().in(this).select('.onecontent')
query.boundingClientRect(ele => {
var that = this;
uni.getSystemInfo({
success(res) {
that.height = (res.windowHeight - ele.height) + "px";
that = null;
}
})
}).exec();
},
methods: {
showpickersetTabBar(){
uni.switchTab({
url:'/pages/order/index'
})
},
init_fn() {
this.list_ = {
list0: { //
data: [],
page: 1,
status: 'loading',
is_end: false,
},
list1: { //
data: [],
page: 1,
status: 'loading',
is_end: false,
},
list2: { //
data: [],
page: 1,
status: 'loading',
is_end: false,
},
list3: { //
data: [],
page: 1,
status: 'loadmore',
is_end: false,
},
list4: { //
data: [],
page: 1,
status: 'loadmore',
is_end: false,
}
}
for (let i = 0; i <= 4; i++) {
this.get_order_list(i);
}
},
async get_order_list(i) {
let page = null; //
let order_type = ''
switch (i) {
case 0:
order_type = 10;
page = this.list_.list0.page;
break;
case 1:
order_type = 0;
page = this.list_.list1.page;
break;
case 2:
order_type = 1;
page = this.list_.list2.page;
break;
case 3:
order_type = 2;
page = this.list_.list3.page;
break;
case 4:
order_type = 3;
page = this.list_.list4.page;
break;
}
let resdata = await this.api.shoppinglist({
type: order_type,
page: page,
like: this.like
})
let res = resdata.data
// res.data.forEach(item=>{//
// if(item.order_type==0){
// item.timeDiff=(new Date(item.estimate_close_at).getTime() -new Date().getTime())/1000;
// }
// })
switch (order_type) {
case 10:
this.paging(res, this.list_.list0)
break;
case 0:
this.paging(res, this.list_.list1)
break;
case 1:
this.paging(res, this.list_.list2)
break;
case 2:
this.paging(res, this.list_.list3)
break;
case 3:
this.paging(res, this.list_.list4)
break;
}
uni.hideLoading();
},
paging(res, list) {
if (res.length == 0) {
list.status = 'nomore';
list.is_end = true;
return false;
} else {
list.status = 'loading';
list.page = list.page + 1;
setTimeout(() => {
list.data = [...list.data, ...res];
if (res.length != 10) {
list.is_end = true;
list.status = 'nomore';
} else {
list.status = 'loading';
}
}, 500)
}
this.$forceUpdate();
},
lower() {
switch (this.current) {
case 0:
this.onReachBottom_fn(this.list_.list0)
break;
case 1:
this.onReachBottom_fn(this.list_.list1)
break;
case 2:
this.onReachBottom_fn(this.list_.list2)
break;
case 3:
this.onReachBottom_fn(this.list_.list3)
break;
case 4:
this.onReachBottom_fn(this.list_.list4)
break;
}
},
onReachBottom_fn(list) {
if (!list.is_end) {
this.get_order_list(this.current);
}
},
// tabsswiper
orderswitch(index) {
try {
switch (index) {
case 0:
if (this.list_list0.data.length < 10) {
this.form.status = 'nomore';
}
break;
case 1:
if (this.list_list1.data.length < 10) {
this.form.status = 'nomore';
}
break;
case 2:
if (this.list_.list2.data.length < 10) {
this.form.status = 'nomore';
}
break;
case 3:
if (this.list_.list3.data.length < 10) {
this.form.status = 'nomore';
}
break;
case 4:
if (this.list_.list4.data.length < 10) {
this.form.status = 'nomore';
}
break;
}
} catch (e) {
//TODO handle the exception
}
this.swiperCurrent = index;
},
// swiperswiperdx swipertabsswiper
animationfinish(e) {
let current = e.detail.current;
try {
switch (current) {
case 0:
if (this.list_list0.data.length < 10) {
this.form.status = 'nomore';
}
break;
case 1:
if (this.list_list1.data.length < 10) {
this.form.status = 'nomore';
}
break;
case 2:
if (this.list_.list2.data.length < 10) {
this.form.status = 'nomore';
}
break;
case 3:
if (this.list_.list3.data.length < 10) {
this.form.status = 'nomore';
}
break;
case 4:
if (this.list_.list4.data.length < 10) {
this.form.status = 'nomore';
}
break;
}
} catch (e) {
//TODO handle the exception
}
this.swiperCurrent = current;
this.current = current;
},
// clickoverlayshow(e) { //
// switch (e) {
// case 1:
// this.clickoverlayshowtext = ''
// break;
// case 2:
// this.clickoverlayshowtext = ''
// break;
// }
// this.overlayshow = true
// },
orderordercancel(item) { //
var this_ = this
uni.showModal({
content: '确定取消订单吗?',
confirmColor: '#f55850',
cancelColor: '#333333',
async success(resdata) {
if (resdata.confirm) {
let res = await this_.api.orderorderrefund({
order_id: item.order_id
})
if (res.code == 1) {
this_.init_fn()
}
}
}
})
},
async orderokprebook(item) {
uni.pro.navigateTo('mall/ship', {
id: item.id
})
},
async orderrefuseprebook(e) {
var this_ = this
uni.showModal({
content: '确定取消订单吗?',
confirmColor: '#f55850',
cancelColor: '#333333',
async success(resdata) {
if (resdata.confirm) {
let res = await this_.api.shoppingorderrefund({
order_id: e.id,
})
if (res.code == 1) {
uni.showToast({
title: '取消订单并退款成功',
icon: 'none'
});
setTimeout(() => {
this_.init_fn()
}, 500);
}
}
}
})
},
orderordercancelrefund(item) { //退
uni.pro.navigateTo('my/order/refund', {
id: item.order_id
})
},
applylrefund(item) {
uni.pro.navigateTo('my/order/applylrefund', {
id: item.order_id
})
},
orderorderdelete(item) {
var this_ = this
if (item.pay_status == 0) {
uni.showModal({
content: '该笔订单还未付款,是否继续?',
confirmColor: '#f55850',
cancelColor: '#333333',
async success(resdata) {
if (resdata.confirm) {
let res = await this_.api.orderstartsercive({
order_id: item.order_id
})
if (res.code == 1) {
this_.init_fn()
}
}
}
})
} else {
uni.showModal({
content: '确定开始服务吗?',
confirmColor: '#f55850',
cancelColor: '#333333',
async success(resdata) {
if (resdata.confirm) {
let res = await this_.api.orderstartsercive({
order_id: item.order_id
})
if (res.code == 1) {
this_.init_fn()
}
}
}
})
}
},
async cancelOrder(item) { //
console.log(item)
// let res
// switch (this.clickoverlayshowtext) {
// case '':
// if (item.status == 0) {
// res = await this.api.orderordercancel({
// order_id: item.order_id
// })
// } else {
// uni.pro.navigateTo('my/order/orderInfo', {
// id: e,
// e: e
// })
// }
// break;
// case '':
// res = await this.api.orderorderdelete({
// order_id: item.order_id
// })
// break;
// }
// this.overlayshow = false
// this.init_fn()
},
eeInfo(e) { //
uni.pro.navigateTo('mall/orderInfo', {
id: e.order_id
})
},
}
}
</script>
<style lang="scss">
page {
background: #F6F6F6;
}
.content {
.onecontent {
width: 100%;
background: #FFFFFF;
padding: 10rpx 28rpx;
.flex-start {
flex-wrap: nowrap;
.onecontent_oen {
margin: 0 auto;
flex: auto;
height: 70rpx;
border-radius: 14rpx;
border: 2rpx solid #6699FF;
padding-right: 8rpx;
.onecontent_oen_input {
padding-left: 32rpx;
flex: 1;
}
.onecontent_oen_text {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #FFFFFF;
text-align: center;
line-height: 56rpx;
width: 80rpx;
height: 56rpx;
background: #6699FF;
border-radius: 14rpx;
}
}
.onecontent_oen_right {
margin-left: 26rpx;
.onecontent_oen_rightimage {
width: 17.9rpx;
height: 19.34rpx;
}
.onecontent_oen_rightimageview {
text-align: center;
width: 140rpx;
margin-left: 10rpx;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
}
}
}
.onecontent_tow {
padding: 32rpx 0 32rpx 0;
width: 100%;
.onecontent_tow_item {
position: relative;
.onecontent_tow_itemtexts {
font-size: 32rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #333333;
}
.onecontent_tow_itemtext {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
}
.onecontent_tow_itemtexts::after {
content: '';
position: absolute;
bottom: -10rpx;
left: 50%;
transform: translateX(-50%);
width: 19.33rpx;
height: 6.66rpx;
background: url(https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/order1.png) no-repeat;
background-size: 100% 100%;
}
}
}
}
.towcontent {
padding: 0 28rpx;
.flex-colum_image {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
text {
margin-top: 30rpx;
font-size: 32rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #666666;
}
}
.towcontentitem {
margin-top: 32rpx;
padding: 24rpx;
width: 100%;
background: #FFFFFF;
border-radius: 12rpx;
.towcontentitemone {
width: 100%;
padding-bottom: 16rpx;
border-bottom: 1px solid #F6F6F6;
.towcontentitemone_one {
font-size: 28rpx;
width: 60%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #333333;
}
.towcontentitemone_tow {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
.towcontentitemone_towimage {
margin-right: 10rpx;
width: 24rpx;
height: 24rpx;
}
}
}
.towcontentitemtow {
position: relative;
padding: 22rpx 0;
border-bottom: 1px solid #F6F6F6;
.towcontentitemtow_imge {
width: 144rpx;
height: 144rpx;
background: #666666;
border-radius: 12rpx;
}
.towcontentitemtow_one {
margin-left:40rpx;
flex: auto;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
position: relative;
.towcontentitemtow_one_one {
flex: auto;
overflow: hidden;
text-overflow: ellipsis;
white-space: break-spaces;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
}
.flex-colum {
flex: 1;
margin-left: 10rpx;
.towcontentitemtow_one_there {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
.towcontentitemtow_one_tow {
font-size: 36rpx;
font-family: Helvetica-Bold, Helvetica;
font-weight: bold;
color: #333333;
}
}
}
.towcontentitemtow_tow {
position: absolute;
bottom: 32rpx;
right: 0;
font-size: 28rpx;
font-family: Roboto-Regular, Roboto;
font-weight: 400;
color: #999999;
}
}
.towcontentitemthere_text_iitem {
width: 100%;
margin-top: 16rpx;
font-size: 24rpx;
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-weight: 500;
color: #333333;
text {
font-size: 28rpx;
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-weight: bold;
color: #333333;
}
}
.towcontentitemthere {
width: 100%;
margin-top: 16rpx;
display: flex;
justify-content: flex-end;
align-items: center;
flex-wrap: wrap;
.towcontentitemthereitem {
margin-left: 24rpx;
padding: 8rpx 32rpx;
font-size: 28rpx;
border-radius: 28rpx;
}
.towcontentitemthereitem_one {
background: linear-gradient(101deg, #FA8E5D 0%, #F45E4D 100%);
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
}
.towcontentitemthereitem_tow {
background: #F6F6F6;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #999999;
}
.towcontentitemthereitem_there {
background: linear-gradient(303deg, #9FC9FF 0%, #6699FF 100%);
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #FFFFFF;
}
}
}
}
.warp {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
.rect {
padding: 40rpx 68rpx;
width: 480rpx;
background: #FFFFFF;
border-radius: 42rpx;
.rectone {
font-size: 32rpx;
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-weight: bold;
color: #333333;
}
.recttow {
width: 100%;
margin-top: 32rpx;
.recttow_one {
padding: 8rpx 40rpx;
background: #FFFFFF;
border-radius: 26rpx;
border: 2rpx solid #999999;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
}
.recttow_tow {
padding: 8rpx 40rpx;
background: #333333;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #FFFFFF;
border-radius: 26rpx;
}
}
}
}
}
</style>

617
pages/mall/orderInfo.vue Normal file
View File

@ -0,0 +1,617 @@
<template>
<view class="index">
<!-- <view class="onecontent">
<view class="onecontentone">
<text v-if="datalist.status == 0">待支付</text>
<text v-if="datalist.status == 1">已支付</text>
<text v-if="datalist.status == 2">等待确认</text>
<text v-if="datalist.status == 3">已确认</text>
<text v-if="datalist.status == 4">已完成 </text>
<text v-if="datalist.status == 5">已取消</text>
<text v-if="datalist.status == 6">退款中</text>
<text v-if="datalist.status == 7">已退款</text>
</view>
<view class="onecontenttow">
感谢您的支持欢迎再次光临
</view>
<view class="onecontentthere flex-between">
<view class="onecontentthere_one" v-if="datalist.status == 5 || datalist.status == 4 "
@click="orderorderdelete(datalist)">
删除订单
</view>
<view class="onecontentthere_tow"
v-if="datalist.status == 1 || datalist.status == 2 ||datalist.status == 3"
@click="orderordercancelrefund(datalist)">
申请退款
</view>
</view>
</view> -->
<view class="towcontent">
<view class="towcontentone flex-between">
<view class="towcontentone_one flex-start">
<u-icon name="home" color="#ffffff" size="20"></u-icon>
<text class="towcontentone_one_text">{{datalist.store_title}}</text>
</view>
<u-icon @click="phonefill(datalist.mobile)" name="phone-fill" color="#ffffff" size="20"></u-icon>
</view>
<view class="towcontenttow flex-start" v-for="(item,index) in datalist.goods" :key="index"
@click="detailsInfo(item.goods_id)">
<image class="towcontenttow_image" :src="item.img" mode=""></image>
<view class="towcontenttowone flex-colum-start">
<view class="towcontenttowone_one">
{{item.title}}
</view>
<view class="towcontenttowone_tow flex-start">
<view class="towcontenttowone_tow_one flex-start">
<u-icon name="checkmark-circle" color="#999999" size="14"></u-icon>
随时退
</view>
<view class="towcontenttowone_tow_one flex-start">
<u-icon name="checkmark-circle" color="#999999" size="14"></u-icon>
过期退
</view>
</view>
<view class="towcontenttowone_there">
{{item.spec||''}}
</view>
<view class="towcontenttowone_four">
¥{{item.price}}
</view>
</view>
</view>
<!--<view class="towcontentthere flex-between">
<text class="towcontentthere_text"></text>
</view>
<view class="qr-box flex-colum" @longpress="save()">
<canvas canvas-id="qrcode" style="width:288rpx;" />
</view>
<view class="towcontenttfour flex-colum">
123 2345 567
</view> -->
<!-- <view class="towcontenttfive flex-between">
<view class="towcontenttfive_one flex-start">
<view class="towcontenttfive_oneone">
退款:
</view>
<view class="towcontenttfive_onetow">
08-22 23:59:59到期
</view>
</view>
<view class="towcontenttfive_tow">
申请退款
</view>
</view> -->
</view>
<view class="therecontent">
<view class="therecontentone">
订单信息
</view>
<view class="therecontentsix entowakst" v-if="datalist.people_nickname">
发型师{{datalist.people_nickname}}
</view>
<view class="therecontentow entowakst">
实付金额<text>¥{{datalist.price}}</text>
</view>
<view class="therecontentthere entowakst">
购买数量{{datalist.number}}
</view>
<view class="therecontentthere entowakst">
购买数量{{datalist.username}}
</view>
<view class="therecontenfour entowakst">
手机号码{{datalist.mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') || '-'}}
</view>
<view class="therecontentthere entowakst">
收货地址{{datalist.address}}
</view>
<view class="therecontentfive flex-start entowakst">
订单编号{{datalist.out_trade_no}}
<text class="therecontentfive_box" @click="copy(datalist.out_trade_no)">复制</text>
</view>
<view class="therecontentsix entowakst">
下单时间{{datalist.createtime}}
</view>
</view>
<!-- <view class="fourcontent">
<view class="fourcontentone">
购买须知
</view>
<view v-html="datalist.details">
</view>
<view class="entowakst" v-html="datalist.details">
·预约须知请您提前1小时预约
</view>
</view> -->
<!-- <view class="fivecontent">
<view class="fivecontentone">
用户评价
</view>
<view class="fivecontenttow flex-between">
<view class="fivecontenttow_one flex-start">
<text class="fivecontenttow_text">综合评分</text>
<u-rate :count="5" value="4" active-color="#f1cb66" inactive-color="#F1CB66"></u-rate>
</view>
<view class="fivecontenttow_tow">
满意
</view>
</view>
</view> -->
</view>
</template>
<script>
// import uQRCode from '@/common/js/uqrCode.js'
export default {
data() {
return {
datalist: {},
imgCode: '', // }
form: {
phone: '18092171236'
}
}
},
async onLoad(e) {
try {
let res = await this.api.shoppingorderdetailt({
order_id: e.id
})
if (res) {
this.datalist = res.data
this.datalist.details = res.data.details.replace(/\<img/g,
'<img style="max-width:100%;height:auto" ');
}
} catch (e) {}
// this.generate()
},
methods: {
orderorderdelete(item) { //
uni.showModal({
content: '确定删除订单吗?',
confirmColor: '#f55850',
cancelColor: '#333333',
async success(resdata) {
if (resdata.confirm) {
await this.api.orderorderdelete({
order_id: item.order_id
})
uni.navigateBack()
}
}
})
},
orderordercancelrefund(item) { //退
console.log(item)
uni.pro.navigateTo('my/order/refund', {
id: item.order_id
})
},
//
generate(e) {
uQRCode.make({
canvasId: 'qrcode',
componentInstance: this,
text: "https://ky.sxczgkj.cn/wap/merchant/authPay?userAppId=244", //
size: 150,
margin: 0,
backgroundColor: '#ffffff',
foregroundColor: '#000000',
fileType: 'jpg',
errorCorrectLevel: uQRCode.errorCorrectLevel.H,
success: res => {
this.imgCode = res // base64
}
})
},
//
save() {
uni.getSetting({ //
success: (res) => {
if (res.authSetting['scope.writePhotosAlbum']) { //访
this.aveImageToPhotosAlbum();
} else {
uni.authorize({ //
scope: 'scope.writePhotosAlbum',
success: () => {
this.aveImageToPhotosAlbum();
},
fail: () => {
//
uni.showToast({
title: "请打开保存相册权限,再点击保存到手机",
icon: "none",
duration: 3000
});
setTimeout(() => {
uni.openSetting({ //,访
success: (res2) => {
// console.log(res2.authSetting)
}
});
}, 3000);
}
})
}
}
})
},
copy(value) {
//
uni.setClipboardData({
data: value, //
success: () => { //
uni.showToast({
title: '复制成功'
})
}
});
},
detailsInfo(e) { //
uni.pro.navigateTo('my/order/cporderinfo', {
id: e,
})
},
phonefill(value) {
uni.makePhoneCall({
phoneNumber: value //
});
},
aveImageToPhotosAlbum() {
let base64 = this.imgCode.replace(/^data:image\/\w+;base64,/, ""); //data:image/png;base64,
let filePath = wx.env.USER_DATA_PATH + '/ph_fit_qrcode.png'; //
uni.showLoading({
title: '加载中',
mask: true
})
uni.getFileSystemManager().writeFile({ //
filePath: filePath, //
data: base64, //
encoding: 'base64', //
success: res => {
uni.saveImageToPhotosAlbum({ //
filePath: filePath,
success: function(res2) {
uni.hideLoading();
uni.showToast({
title: '保存成功',
icon: "none",
duration: 5000
})
},
fail: function(err) {
uni.hideLoading();
// console.log(err.errMsg);
}
})
},
fail: err => {
uni.hideLoading();
//console.log(err)
}
})
},
}
}
</script>
<style lang="scss">
page {
background: #F6F6F6;
}
.index {
padding: 32rpx 28rpx;
.onecontent {
width: 100%;
padding: 32rpx;
background: #FFFFFF;
border-radius: 12rpx;
.onecontentone {
font-size: 32rpx;
font-family: SourceHanSansCN-Medium-, SourceHanSansCN-Medium;
font-weight: normal;
color: #333333;
}
.onecontenttow {
margin-top: 16rpx;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
font-weight: normal;
color: #666666;
}
.onecontentthere {
margin-top: 24rpx;
.onecontentthere_one {
background: #333333;
border-radius: 8rpx;
padding: 16rpx 94rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #FFFFFF;
}
.onecontentthere_tow {
background: #F7F7F7;
border-radius: 8rpx;
padding: 16rpx 94rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
}
}
.towcontent {
margin-top: 24rpx;
width: 100%;
background: #FFFFFF;
border-radius: 18rpx;
.towcontentone {
position: relative;
padding: 16rpx 32rpx;
border-radius: 18rpx 18rpx 0 0;
background: #9397c1;
.towcontentone_one {
width: 80%;
.towcontentone_one_image {
width: 33.04rpx;
height: 29.79rpx;
}
.towcontentone_one_text {
width: 80%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-left: 10rpx;
font-size: 28rpx;
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
font-weight: normal;
color: #FFFFFF;
}
}
.towcontentone_one::after {
z-index: 10;
position: absolute;
bottom: -22rpx;
content: '';
display: inline-block;
left: 50%;
transform: translateX(-50%);
width: 44rpx;
height: 44rpx;
border-radius: 0 0 22rpx 22rpx;
background: #9397c1;
}
}
.towcontenttow {
padding: 32rpx;
width: 100%;
background: #fff;
.towcontenttow_image {
width: 128rpx;
height: 128rpx;
}
.towcontenttowone {
height: 128rpx;
margin-left: 36rpx;
justify-content: space-around;
.towcontenttowone_one {
font-size: 28rpx;
font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
font-weight: normal;
color: #333333;
}
.towcontenttowone_tow {
.towcontenttowone_tow_one {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
font-weight: normal;
color: #999999;
}
}
.towcontenttowone_there {
font-size: 32rpx;
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
font-weight: normal;
color: #333333;
}
}
}
.towcontentthere {
position: relative;
height: 44rpx;
width: 100%;
.towcontentthere_text {
width: 100%;
height: 0px;
border: 1rpx dashed #EAEAEA;
}
.towcontentthere_text::after {
z-index: 10;
position: absolute;
content: '';
display: inline-block;
left: 0;
top: 0;
width: 22rpx;
height: 44rpx;
border-radius: 0 44rpx 44rpx 0;
background: #f6f6f6;
}
.towcontentthere_text::before {
z-index: 10;
position: absolute;
content: '';
display: inline-block;
right: 0;
top: 0;
width: 22rpx;
height: 44rpx;
border-radius: 44rpx 0 0 44rpx;
background: #f6f6f6;
}
}
.towcontenttfour {
margin-top: 16rpx;
font-size: 32rpx;
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
font-weight: normal;
color: #333333;
}
.towcontenttfive {
padding: 32rpx;
width: 100%;
.towcontenttfive_one {
font-size: 32rpx;
font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
font-weight: normal;
color: #333333;
}
.towcontenttfive_onetow {
margin-left: 16rpx;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
font-weight: normal;
color: #666666;
}
.towcontenttfive_tow {
padding: 10rpx 16rpx;
background: #FFFFFF;
border-radius: 8rpx;
border: 2rpx solid #D5D5D5;
}
}
}
.therecontent {
margin-top: 24rpx;
padding: 32rpx;
width: 100%;
background: #FFFFFF;
border-radius: 18rpx;
.therecontentone {
font-size: 28rpx;
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-weight: bold;
color: #333333;
}
.entowakst {
font-size: 28rpx;
font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
font-weight: normal;
color: #333333;
}
.therecontentfive_box {
padding: 6rpx 10rpx;
font-size: 20rpx;
font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
font-weight: normal;
color: #666666;
background: #FFFFFF;
margin-left: 6rpx;
border-radius: 8rpx;
border: 2rpx solid #D5D5D5;
}
}
.fourcontent {
margin-top: 24rpx;
padding: 32rpx;
width: 100%;
background: #FFFFFF;
border-radius: 18rpx;
.fourcontentone {
font-size: 28rpx;
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-weight: bold;
color: #333333;
}
.fourcontentone::after {
content: '';
display: inline-block;
width: 100%;
height: 1rpx;
border: 1px solid #F7F7F7;
}
.entowakst {
font-size: 24rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #666666;
}
}
.fivecontent {
margin-top: 24rpx;
padding: 32rpx;
width: 100%;
background: #FFFFFF;
border-radius: 18rpx;
.fivecontentone {
font-size: 28rpx;
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-weight: bold;
color: #333333;
}
.fivecontenttow {
margin-top: 16rpx;
.fivecontenttow_one {
.fivecontenttow_text {
padding-right: 24rpx;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
font-weight: normal;
color: #333333;
}
}
.fivecontenttow_tow {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
font-weight: normal;
color: #666666;
}
}
}
}
</style>

166
pages/mall/ship.vue Normal file
View File

@ -0,0 +1,166 @@
<template>
<view class="index">
<view class="title_text">
创建分类
</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.company" maxlength="8" 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.express" maxlength="8" type="text"
placeholder="请输入快递单号">
</view>
</view>
</view>
<view class="thereconse thereconses" @click="shoppingorsuboutgoods">
确定
</view>
</view>
</template>
<script>
export default {
data() {
return {
form: {
order_id: '',
company: '',
express: ""
}
}
},
async onLoad(e) {
this.form.order_id = e.id
},
methods: {
async shoppingorsuboutgoods() {
if (this.form.company == null || this.form.company == '') {
uni.showToast({
title: '请输入快递公司',
icon: 'none'
});
return false;
}
if (this.form.express == null || this.form.express == '') {
uni.showToast({
title: '请输入快递单号',
icon: 'none'
});
return false;
}
let res = await this.api.shoppingorsuboutgoods({
order_id: this.form.order_id,
company: this.form.company,
express: this.form.express
});
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;
}
#editor {
width: 100%;
height: 456rpx;
padding: 12rpx 40rpx;
background: #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;
}
.onecontent_itemright_text {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
}
.thereconse {
width: 630rpx;
height: 80rpx;
background: #999999;
border-radius: 40rpx;
font-size: 36rpx;
text-align: center;
margin: 84rpx auto;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
line-height: 80rpx;
}
.thereconses {
background: linear-gradient(115deg, #7E81A5 0%, #4D4E64 100%);
}
}
</style>

165
pages/my/index.vue Normal file
View File

@ -0,0 +1,165 @@
<template>
<view>
<view class="index_box">
<view class="onebox">
<view class="onebox_one">
<text class="onebox_one_text">我的订单</text>
<view class="onebox_one_one flex-around">
<view class="flex-colum" v-for="(item,index) in 4" :key="index" @click="order(index)">
<text>待付款</text>
</view>
</view>
</view>
</view>
<view class="towbox flex-between">
<view class="towbox_item flex-start" v-for="(item,index) in 2">
<image src="@/static/logo.png" mode=""></image>
<view class="flex-colum">
<text>余额</text>
<view>0<text></text></view>
</view>
</view>
</view>
<view class="therebox">
<view class="therebox_item flex-between" v-for="(item,index) in 3">
<view class="flex-start">
<image src="@/static/logo.png" mode=""></image>
<text>优惠券</text>
</view>
<u-icon name="arrow-right" color="#9b9b9b" size="14"></u-icon>
</view>
</view>
</view>
<bottombbar :valuebbar='3'></bottombbar>
</view>
</template>
<script>
export default {
data() {
return {
navtitle: '', //
navboxshow: '0', //
Background: 'none',
}
},
methods: {
order(e){
uni.pro.navigateTo('my/order/index',{e:e})
}
}
}
</script>
<style lang="scss">
page {
background: #F9F9F9;
}
.index_box {
padding: 0 32rpx;
width: 100%;
height: 502rpx;
background-size: cover;
.index_boxone {
image {
width: 124rpx;
height: 124rpx;
border-radius: 50%;
}
}
.onebox {
position: relative;
top:40rpx;
.onebox_one {
width: 100%;
background: #FFFFFF;
border-radius: 12rpx;
padding: 32rpx;
.onebox_one_text{
font-size: 32rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #333333;
}
.onebox_one_one{
margin-top: 32rpx;
.flex-colum{
image{
width: 64rpx;
height: 64rpx;
}
text{
margin-top: 16rpx;
font-size: 28rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #333333;
}
}
}
}
}
.towbox{
margin-top: 64rpx;
.towbox_item{
width:48%;
background: #FFFFFF;
padding: 32rpx 30rpx;
border-radius:12rpx;
image{
width: 100rpx;
height: 100rpx;
}
.flex-colum{
margin-left: 28rpx;
text{
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #999999;
}
view{
font-size: 32rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
text{
color: #333333;
font-size: 22rpx;
}
}
}
}
}
.therebox{
margin-top: 32rpx;
width: 100%;
background: #FFFFFF;
border-radius:12rpx;
padding:0 32rpx 32rpx 32rpx;
.therebox_item{
padding-top: 32rpx;
.flex-start{
image{
width: 32rpx;
height: 32rpx;
}
text{
margin-left: 24rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
}
}
}
}
}
</style>

539
pages/my/order/index.vue Normal file
View File

@ -0,0 +1,539 @@
<template>
<view class="content">
<view class="onecontent">
<view class="onecontent_oen flex-start">
<input class="onecontent_oen_input" type="text" placeholder="搜索订单/商家名/商品名">
<text class="onecontent_oen_text">搜索</text>
</view>
<view class="onecontent_tow flex-between">
<view ref="uTabs" class="onecontent_tow_item flex-colum" v-for="(item,index) in swipercurrentdata"
:key="index" @click="orderswitch(index)">
<view :class="swiperCurrent == index?'onecontent_tow_itemtexts':'onecontent_tow_itemtext'">
{{item.name}}
</view>
</view>
</view>
</view>
<view class="towcontent">
<swiper :current="swiperCurrent" @animationfinish="animationfinish" :style="{height:height}">
<swiper-item v-for="(item, index) in list_" :key="index">
<scroll-view scroll-y style="width: 100%;" :style="{height:height}" @scrolltolower="lower">
<view class="towcontentitem" v-for="(item,index1) in list_[index].data" :key="index1">
<view class="towcontentitemone flex-between">
<text class="towcontentitemone_one">KIKI美发龙首店</text>
<view class="towcontentitemone_tow flex-start">
<image class="towcontentitemone_towimage"
src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/shijian.png"
mode="">
</image>待付款
</view>
</view>
<view class="towcontentitemtow flex-start">
<image class="towcontentitemtow_imge" src="@/static/logo.png" mode=""></image>
<view class="towcontentitemtow_one flex-colum-start">
<text class="towcontentitemtow_one_one">人气高级染烫+单人护理</text>
<text class="towcontentitemtow_one_tow"><text
style="font-size:28rpx;">¥</text>120.00</text>
</view>
<view class="towcontentitemtow_tow">
x1
</view>
</view>
<view class="towcontentitemthere">
<view class="towcontentitemthereitem towcontentitemthereitem_tow"
@click="overlayshow = true">
取消订单
</view>
<view class="towcontentitemthereitem towcontentitemthereitem_there">
待服务
</view>
<view class="towcontentitemthereitem towcontentitemthereitem_one">
去付款
</view>
</view>
</view>
<u-loadmore style="padding-bottom: 20rpx;"
v-if="list_[index].is_end&&list_[index].data.length>0" :status="form.status" />
<view v-if="list_[index].data.length<=0" class="flex-colum_image flex-colum">
<image class=""
src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/nothave.png"
mode="">
</image>
<text>诶呀暂无数据~</text>
</view>
</scroll-view>
</swiper-item>
</swiper>
</view>
<u-overlay :show="overlayshow" @click="overlayshow = false">
<view class="warp">
<view class="rect flex-colum" @tap.stop>
<view class="rectone">
确定删除订单吗?
</view>
<view class="recttow flex-between">
<view class="recttow_one">
确定
</view>
<view class="recttow_tow" @click="overlayshow = false">
取消
</view>
</view>
</view>
</view>
</u-overlay>
</view>
</template>
<script>
export default {
data() {
return {
height: "",
// tabsswipercurrent
current: 0, // tabscurrenttab
swiperCurrent: 0, // swipercurrentswiper-item
overlayshow: false,
swipercurrentdata: [{
name: '全部'
}, {
name: '待付款'
}, {
name: '待服务'
}, {
name: '已完成'
}, {
name: '退款/售后'
}],
form: {
status: 'loadmore',
},
}
},
onLoad() {
// this.swiperCurrent = option.type;
},
onShow() {
this.init_fn();
},
mounted() {
var query = uni.createSelectorQuery().in(this).select('.onecontent')
query.boundingClientRect(ele => {
var that = this;
uni.getSystemInfo({
success(res) {
console.log(res, ele)
that.height = (res.windowHeight - ele.height) + "px";
console.log(that.height)
that = null;
}
})
}).exec();
},
methods: {
init_fn() {
this.list_ = {
list1: { //
data: [],
page: 1,
is_end: false,
},
list2: { //
data: [],
page: 1,
is_end: false,
},
list3: { //
data: [],
page: 1,
is_end: false,
},
list4: { //
data: [],
page: 1,
is_end: false,
},
list5: { //
data: [],
page: 1,
is_end: false,
},
}
for (let i = 0; i <= 4; i++) {
this.get_order_list(i);
}
},
async get_order_list(order_status) {
this.form.status = 'loading';
let page = null; //
switch (order_status) {
case 0:
order_status = "";
page = this.list_.list1.page;
break;
case 1:
order_status = 0;
page = this.list_.list2.page;
break;
case 2:
order_status = 1;
page = this.list_.list3.page;
break;
case 3:
order_status = 3;
page = this.list_.list4.page;
break;
case 4:
order_status = 5;
page = this.list_.list5.page;
break;
}
// let res = await uni.ajax.get_order_list({
// order_status: order_status, //
// page: page
// })
let res = []
// res.data.forEach(item=>{//
// if(item.order_status==0){
// item.timeDiff=(new Date(item.estimate_close_at).getTime() -new Date().getTime())/1000;
// }
// })
switch (order_status) {
case "":
this.paging(res, this.list_.list1)
break;
case 0:
this.paging(res, this.list_.list2)
break;
case 1:
this.paging(res, this.list_.list3)
break;
case 3:
this.paging(res, this.list_.list4)
break;
case 5:
this.paging(res, this.list_.list5)
break;
}
uni.hideLoading();
},
paging(res, list) {
list.data = list.data.concat(res.data);
if (res.next_page_url == null) {
list.is_end = true;
this.form.status = 'nomore'
} else {
this.form.status = 'loading';
list.page = list.page + 1;
}
},
lower() {
switch (this.current) {
case 0:
this.onReachBottom_fn(this.list_.list1)
break;
case 1:
this.onReachBottom_fn(this.list_.list2)
break;
case 2:
this.onReachBottom_fn(this.list_.list3)
break;
case 3:
this.onReachBottom_fn(this.list_.list4)
break;
case 4:
this.onReachBottom_fn(this.list_.list5)
break;
}
},
onReachBottom_fn(list) {
if (!list.is_end) {
this.get_order_list(this.current);
}
},
// tabsswiper
orderswitch(index) {
this.swiperCurrent = index;
},
// swiper-itemtabs
transition(e) {
let dx = e.detail.dx
console.log(e, dx)
this.$refs.uTabs.setDx(dx);
},
// swiperswiperdx swipertabsswiper
animationfinish(e) {
let current = e.detail.current;
this.swiperCurrent = current;
this.current = current;
},
}
}
</script>
<style lang="scss">
page {
background: #F6F6F6;
}
.content {
.onecontent {
width: 100%;
background: #FFFFFF;
padding: 10rpx 28rpx;
.onecontent_oen {
margin: 0 auto;
width: 100%;
height: 70rpx;
border-radius: 36rpx;
border: 2rpx solid #333333;
padding-right: 8rpx;
.onecontent_oen_input {
padding-left: 32rpx;
flex: 1;
}
.onecontent_oen_text {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #FFFFFF;
text-align: center;
line-height: 56rpx;
width: 116rpx;
height: 56rpx;
background: #333333;
border-radius: 36rpx;
}
}
.onecontent_tow {
padding: 32rpx 0 32rpx 0;
width: 100%;
.onecontent_tow_item {
position: relative;
.onecontent_tow_itemtexts {
font-size: 32rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #333333;
}
.onecontent_tow_itemtext {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
}
.onecontent_tow_itemtexts::after {
content: '';
position: absolute;
bottom: -10rpx;
left: 50%;
transform: translateX(-50%);
width: 19.33rpx;
height: 6.66rpx;
background: url(https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/order1.png) no-repeat;
background-size: 100% 100%;
}
}
}
}
.towcontent {
padding: 0 28rpx;
.flex-colum_image {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
text {
margin-top: 30rpx;
font-size: 32rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #666666;
}
}
.towcontentitem {
margin-top: 32rpx;
padding: 24rpx;
width: 100%;
background: #FFFFFF;
border-radius: 12rpx;
.towcontentitemone {
padding-bottom: 16rpx;
border-bottom: 1px solid #F6F6F6;
.towcontentitemone_one {
font-size: 28rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #333333;
}
.towcontentitemone_tow {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
.towcontentitemone_towimage {
margin-right: 10rpx;
width: 24rpx;
height: 24rpx;
}
}
}
.towcontentitemtow {
position: relative;
padding: 22rpx 0;
border-bottom: 1px solid #F6F6F6;
.towcontentitemtow_imge {
width: 144rpx;
height: 144rpx;
background: #666666;
border-radius: 12rpx;
}
.towcontentitemtow_one {
margin-left: 32rpx;
.towcontentitemtow_one_one {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
}
.towcontentitemtow_one_tow {
margin-top: 24rpx;
font-size: 40rpx;
font-family: Roboto-Bold, Roboto;
font-weight: bold;
color: #FC5F69;
}
}
.towcontentitemtow_tow {
position: absolute;
bottom: 32rpx;
right: 0;
font-size: 28rpx;
font-family: Roboto-Regular, Roboto;
font-weight: 400;
color: #999999;
}
}
.towcontentitemthere {
width: 100%;
margin-top: 16rpx;
display: flex;
justify-content: flex-end;
align-items: center;
flex-wrap: wrap;
.towcontentitemthereitem {
margin-left: 24rpx;
padding: 8rpx 32rpx;
font-size: 28rpx;
border-radius: 28rpx;
}
.towcontentitemthereitem_one {
background: linear-gradient(101deg, #FA8E5D 0%, #F45E4D 100%);
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
}
.towcontentitemthereitem_tow {
background: #F6F6F6;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #999999;
}
.towcontentitemthereitem_there {
background: linear-gradient(101deg, #8083A7 0%, #4D4E64 100%);
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
}
}
}
}
.warp {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
.rect {
padding: 40rpx 68rpx;
width: 480rpx;
background: #FFFFFF;
border-radius: 42rpx;
.rectone {
font-size: 32rpx;
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-weight: bold;
color: #333333;
}
.recttow {
width: 100%;
margin-top: 32rpx;
.recttow_one {
padding: 8rpx 40rpx;
background: #FFFFFF;
border-radius: 26rpx;
border: 2rpx solid #999999;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
}
.recttow_tow {
padding: 8rpx 40rpx;
background: #333333;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #FFFFFF;
border-radius: 26rpx;
}
}
}
}
}
</style>

187
pages/my/setup/index.vue Normal file
View File

@ -0,0 +1,187 @@
<template>
<view class="index">
<view class="onecontent">
个人信息
</view>
<view class="towcontent">
<view class="towcontent_item flex-between">
<view class="towcontent_item_text">
头像
</view>
<view class="towcontent_item_box">
<image class="towcontent_item_box_imge" src="@/static/logo.png" mode=""></image>
</view>
</view>
<view class="towcontent_item flex-between">
<view class="towcontent_item_text">
UID
</view>
<view class="towcontent_item_box flex-start">
<text class="towcontent_item_box_text">ID:1001468</text>
<u-icon name="arrow-right" color="#909399" size="14"></u-icon>
</view>
</view>
<view class="towcontent_item flex-between">
<view class="towcontent_item_text">
昵称
</view>
<view class="towcontent_item_box flex-start">
<text class="towcontent_item_box_text">卡卡</text>
<u-icon name="arrow-right" color="#909399" size="14"></u-icon>
</view>
</view>
<view class="towcontent_item flex-between">
<view class="towcontent_item_text">
性别
</view>
<view class="towcontent_item_box flex-start">
<u-radio-group v-model="radiovalue1" placement="row" @change="groupChange">
<u-radio v-for="(item, index) in radiolist1" :key="index" :label="item.name" :name="item.name">
</u-radio>
</u-radio-group>
</view>
</view>
<view class="towcontent_item flex-between" @click="datetimeshow = true">
<view class="towcontent_item_text">
生日
</view>
<view class="towcontent_item_box flex-start">
<text class="towcontent_item_box_text">{{datetimevalue | timeFrom}}</text>
<u-icon name="arrow-right" color="#909399" size="14"></u-icon>
</view>
</view>
<navigator :url="'/pages/my/setup/phone'" class="towcontent_item flex-between">
<view class="towcontent_item_text">
手机号
</view>
<view class="towcontent_item_box flex-start">
<text class="towcontent_item_box_text">去绑定</text>
<u-icon name="arrow-right" color="#909399" size="14"></u-icon>
</view>
<!-- <view class="towcontent_item_box flex-start">
<text class="towcontent_item_box_text">{{phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') }}</text>
<view class="towcontent_item_box_ghbd">
更换绑定
</view>
</view> -->
</navigator>
</view>
<view class="thereconse">
保存
</view>
<u-datetime-picker :minDate="-946800000000" :maxDate="2240409600000" :show="datetimeshow"
v-model="datetimevalue" @cancel='datetimeshow = false' @confirm="confirmdatetime" mode="date"></u-datetime-picker>
</view>
</template>
<script>
export default {
data() {
return {
radiolist1: [{
name: '男',
disabled: false
},
{
name: '女',
disabled: false
}
],
phone:'15309275801',
datetimeshow: false,
datetimevalue:'',
// u-radio-groupv-modelradioname
radiovalue1: '男',
};
},
onLoad() {},
computed: {},
onShow() {
},
methods: {
confirmdatetime(e){
this.datetimeshow = false
this.datetimevalue = e.value
},
groupChange(n) {
console.log('groupChange', n);
},
}
}
</script>
<style lang="scss">
page {
background: #F9F9F9;
}
.index {
padding: 28rpx;
.onecontent {
font-size: 28rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #666666;
}
.towcontent {
padding: 0 32rpx;
margin-top: 24rpx;
width: 100%;
background: #FFFFFF;
border-radius: 12rpx;
.towcontent_item {
padding: 22rpx;
border-bottom: 1rpx dotted #ccc;
.towcontent_item_text {
font-size: 28rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #333333;
}
.towcontent_item_box {
.towcontent_item_box_imge {
width: 64rpx;
height: 64rpx;
}
.towcontent_item_box_text {
font-size: 24rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
}
.towcontent_item_box_ghbd{
padding: 4rpx 8rpx;
margin-left: 24rpx;
font-size: 24rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #9397C1;
border-radius: 10rpx;
border: 2rpx solid #9397C1;
}
}
}
}
.thereconse {
width: 630rpx;
height: 80rpx;
background: #999999;
border-radius: 40rpx;
font-size: 36rpx;
text-align: center;
margin: 84rpx auto;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
line-height: 80rpx;
}
}
</style>

216
pages/my/setup/phone.vue Normal file
View File

@ -0,0 +1,216 @@
<template>
<view class="Box">
<!-- <view class="Box_one">设置新手机</view>
<view class="Box_T">设置新手机号需要通过短信验证</view>
<view class="Box_there">当前手机号{{ form.phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') }}</view> -->
<view class="Box_consitem">
<view class="Box_box flex-start">
<text class="top_box_one_text">中国大陆+86</text>
<input type="number" class="top_box_one_textinput" v-model="form.phone" style="font-size: 24rpx;" placeholder="请输入手机号" maxlength="11" data-key="mobile" />
</view>
<view class="Box_box flex-between"
style="padding: 14rpx 0;border-top: 1rpx solid #efefef;border-bottom: 1rpx solid #efefef; margin-top: 0;">
<text class="top_box_one_text" style="border-right:none;">验证码</text>
<input type="number" style="font-size: 24rpx;" v-model="form.code" placeholder="请输入短信验证码"
data-key="mobile" />
<text class="top_box_one_texts">
<view v-if="showText == true" class="yzm" @click="CodeRegister">{{ Recapture }}</view>
<view v-else style="color: #ccc; background-color: #f9f9f9; border-radius:16px; padding: 10rpx;">
{{ second }}s重新发送
</view>
</text>
</view>
<view class="flex-colum">
<view class="Box_bottom" @click="userInfochangePhone">确定</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
form: {
phone: '',
code: '',
oldPhone: '',
password: ''
},
//
second: 60,
showText: true,
Recapture: '发送验证码'
};
},
onLoad() {},
computed: {},
methods: {
async CodeRegister() {
//
if (this.form.phone == null || this.form.phone == '') {
uni.showToast({
title: '请输入电话号码',
icon: 'none'
});
return false;
}
const res = await this.api.verifyPhoneIsExist({
// post
phone: this.form.phone
});
console.log(res);
if (res.code == 200) {
uni.showToast({
title: '验证码获取成功',
icon: 'none'
});
//
this.showText = false;
this.Recapture = '重新获取';
var interval = setInterval(() => {
let times = --this.second;
this.second = times < 10 ? '0' + times : times; //10 0
}, 1000);
setTimeout(() => {
clearInterval(interval);
this.second = 60;
this.showText = true;
}, 60000);
}
},
async userInfochangePhone() {
if (this.form.phone == null || this.form.phone == '') {
uni.showToast({
title: '请输入新电话号码',
icon: 'none'
});
return false;
}
if (this.form.password == null || this.form.password == '') {
uni.showToast({
title: '请输入登录密码',
icon: 'none'
});
return false;
}
if (this.form.code == null || this.form.code == '') {
uni.showToast({
title: '请输入验证码',
icon: 'none'
});
return false;
}
let res = await this.api.userInfochangePhone({
code: this.form.code,
password: this.form.password,
oldPhone: this.$store.state.czguserInfo.phone,
phone: this.form.phone
});
console.log(res)
if (res.code == 200) {
uni.showToast({
title: '修改成功请重新登录',
icon: 'none'
});
setTimeout(() => {
uni.removeStorageSync("token");
uni.removeStorageSync("userId");
uni.removeStorageSync('myLoginName')
uni.reLaunch({
url: '../../../pages/login/login'
});
}, 2000);
}
}
}
};
</script>
<style lang="scss">
page {
background: #F9F9F9;
}
.Box {
padding: 0 28rpx;
.Box_one {
padding-top: 38rpx;
font-size: 40rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
}
.Box_T {
margin-top: 2rpx;
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
.Box_there {
margin-top: 70rpx;
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
}
.Box_consitem {
background: #ffffff;
padding: 32rpx;
border-radius: 24rpx;
margin-top: 22rpx;
.Box_box {
padding: 18rpx 0;
.top_box_one_text {
width: auto;
padding: 0 20rpx;
font-size: 32rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
border-right: 1rpx solid #ccc;
}
.top_box_one_textinput{
margin-left: 20rpx;
}
input {
width: auto;
}
.top_box_one_texts {
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #5082fd;
}
}
.flex-colum {
width: 100%;
margin-top: 64rpx;
.Box_bottom {
width: 558rpx;
height: 72rpx;
background: linear-gradient(115deg, #7E81A5 0%, #4D4E64 100%);
border-radius: 50rpx;
font-size: 36rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #ffffff;
line-height: 72rpx;
text-align: center;
}
}
}
}
</style>

907
pages/order/index.vue Normal file
View File

@ -0,0 +1,907 @@
<template>
<view class="content">
<view class="onecontent">
<view class="flex-start">
<view class="onecontent_oen flex-start">
<input class="onecontent_oen_input" type="text" v-model="like" placeholder="搜索订单/商家名/商品名">
<text class="onecontent_oen_text" @click="init_fn">搜索</text>
</view>
</view>
<view class="onecontent_tow flex-between">
<view ref="uTabs" class="onecontent_tow_item flex-colum" v-for="(item,index) in swipercurrentdata"
:key="index" @click="orderswitch(index)">
<view :class="swiperCurrent == index?'onecontent_tow_itemtexts':'onecontent_tow_itemtext'">
{{item.name}}
</view>
</view>
</view>
</view>
<view class="towcontent">
<swiper :current="swiperCurrent" @animationfinish="animationfinish" :style="{height:height}">
<swiper-item v-for="(item,index) in list_" :key="index">
<scroll-view scroll-y style="width: 100%;" :style="{height:height}" @scrolltolower="lower">
<view class="towcontentitem" v-for="(item1,index1) in list_[index].data" :key="index1"
@click="eeInfo(item1)">
<view class="towcontentitemone flex-between">
<text class="towcontentitemone_one">{{item1.store_title}}</text>
<view class="towcontentitemone_tow flex-start">
<!-- <image class="towcontentitemone_towimage"
:src="item.store_avatar"
mode="">
</image> -->
<text v-if="item1.status == 0">未支付</text>
<text v-if="item1.status == 1">已支付</text>
<text v-if="item1.status == 2">等待确认</text>
<text v-if="item1.status == 3">待服务</text>
<text v-if="item1.status == 4">已完成 </text>
<text v-if="item1.status == 5">已取消</text>
<text v-if="item1.status == 6">退款中</text>
<text v-if="item1.status == 7">已退款</text>
<text v-if="item1.deletetime" style="color: red;">(用户已删除)</text>
</view>
</view>
<view class="towcontentitemtow flex-start">
<image class="towcontentitemtow_imge" :src="item1.store_avatar" mode=""></image>
<view class="towcontentitemtow_one flex-colum-start">
<text class="towcontentitemtow_one_one">{{item1.title}}</text>
<text class="towcontentitemtow_one_tow"><text
style="font-size:28rpx;">¥</text>{{item1.total_price}}</text>
<text class="towcontentitemtow_one_there">{{item1.time}}</text>
</view>
<view class="towcontentitemtow_tow">
{{item1.number}}
</view>
</view>
<view class="towcontentitemthere">
<view v-if="item1.status == 2 || item1.status == 0"
class="towcontentitemthereitem towcontentitemthereitem_there"
@click.stop="orderokprebook(item1)">
确认预约
</view>
<view v-if="item1.status == 2 || item1.status == 0"
class="towcontentitemthereitem towcontentitemthereitem_tow"
@click.stop="orderrefuseprebook(item1)">
拒绝预约
</view>
<view v-if="item1.status == 3"
class="towcontentitemthereitem towcontentitemthereitem_tow"
@click.stop="orderordercancel(item1)">
取消订单/并退款
</view>
<view class="towcontentitemthereitem towcontentitemthereitem_there"
v-if="item1.status == 3" @click.stop="orderorderdelete(item1)">
完成服务
</view>
</view>
<u-overlay :show="overlayshow" @click.stop="overlayshow = false" opacity='0.1'>
<view class="warp">
<view class="rect flex-colum" @tap.stop>
<view class="rectone">
确定{{clickoverlayshowtext}}?
</view>
<view class="recttow flex-between">
<view class="recttow_one" @click="cancelOrder(item.status)">
确定
</view>
<view class="recttow_tow" @click="overlayshow = false">
取消
</view>
</view>
</view>
</view>
</u-overlay>
</view>
<view v-if="list_[index].data.length == 0 && list_[index].is_end == true" class="flex-colum">
<image class="" style="margin-top: 100rpx;"
src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/nothave.png"
mode="">
</image>
</view>
<u-loadmore :status="list_[index].status" />
</scroll-view>
</swiper-item>
</swiper>
</view>
<xc-privacyPopup ref="privacyComponent" position="center" @allowPrivacy="allowPrivacy"></xc-privacyPopup>
</view>
</template>
<script>
export default {
data() {
return {
height: "",
// tabsswipercurrent
current: 0, // tabscurrenttab
swiperCurrent: 0, // swipercurrentswiper-item
overlayshow: false,
list_: {
list0: { //
data: [],
page: 1,
status: 'loadmore',
is_end: false,
},
list1: { //
data: [],
page: 1,
status: 'loadmore',
is_end: false,
},
list2: { //
data: [],
page: 1,
status: 'loadmore',
is_end: false,
},
list3: { //
data: [],
page: 1,
status: 'loadmore',
is_end: false,
}
},
like: '', //
clickoverlayshowtext: "",
swipercurrentdata: [{
name: '待确认'
}, {
name: '待服务'
}, {
name: '已完成'
}, {
name: '退款/售后'
}],
form: {
status: 'loadmore',
},
}
},
async onLoad(e) {
uni.hideTabBar()
if (e.type) {
// #ifdef MP-WEIXIN
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 (uni.cache.get('user').group_id == 2) {
uni.pro.switchTab('order/index')
uni.setNavigationBarTitle({
title: uni.cache.get('user').nickname
})
this.init_fn();
} else {
setTimeout(res => {
uni.reLaunch({
url: '/pages/stafflist/index'
})
}, 1500)
}
} else {
setTimeout(res => {
uni.reLaunch({
url: '/pages/stafflist/index'
})
}, 1500)
}
} catch (e) {
setTimeout(res => {
uni.reLaunch({
url: '/pages/stafflist/index'
})
}, 1500)
}
}
});
// #endif
} else {
if (uni.cache.get('user').group_id == 2) {
uni.pro.switchTab('order/index')
this.init_fn();
} else {
setTimeout(res => {
uni.reLaunch({
url: '/pages/stafflist/index'
})
}, 1500)
}
}
},
onShow() {
// #ifdef H5
uni.showTabBar()
// #endif
// #ifdef MP-WEIXIN
wx.getPrivacySetting({
success: res => {
if (!res.needAuthorization) {
this.$refs.privacyComponent.closePrivacy();
uni.showTabBar()
}
},
fail: () => {},
complete: () => {}
})
// #endif
if (uni.cache.get('token')) {
uni.setNavigationBarTitle({
title: uni.cache.get('user').nickname
})
this.init_fn();
// uni.setTabBarItem({
// index: 1,
// visible: false
// });
// uni.setTabBarItem({
// index:0,
// visible: true
// });
}
},
mounted() {
var query = uni.createSelectorQuery().in(this).select('.onecontent')
query.boundingClientRect(ele => {
var that = this;
uni.getSystemInfo({
success(res) {
that.height = (res.windowHeight - ele.height) + "px";
that = null;
}
})
}).exec();
},
methods: {
showpickersetTabBar(){
uni.switchTab({
url:'/pages/mall/index'
})
},
allowPrivacy() {
//
uni.showTabBar()
console.log('同意隐私授权')
},
init_fn() {
this.list_ = {
list0: { //
data: [],
page: 1,
status: 'loading',
is_end: false,
},
list1: { //
data: [],
page: 1,
status: 'loading',
is_end: false,
},
list2: { //
data: [],
page: 1,
status: 'loading',
is_end: false,
},
list3: { //
data: [],
page: 1,
status: 'loadmore',
is_end: false,
}
}
for (let i = 0; i <= 3; i++) {
this.get_order_list(i);
}
},
async get_order_list(i) {
let page = null; //
let order_type = ''
switch (i) {
case 0:
order_type = 2;
page = this.list_.list0.page;
break;
case 1:
order_type = 3;
page = this.list_.list1.page;
break;
case 2:
order_type = 4;
page = this.list_.list2.page;
break;
case 3:
order_type = 5;
page = this.list_.list3.page;
break;
}
let resdata = await this.api.orderlist({
order_type: order_type,
page: page,
like: this.like
})
let res = resdata.data
// res.data.forEach(item=>{//
// if(item.order_type==0){
// item.timeDiff=(new Date(item.estimate_close_at).getTime() -new Date().getTime())/1000;
// }
// })
switch (order_type) {
case 2:
this.paging(res, this.list_.list0)
break;
case 3:
this.paging(res, this.list_.list1)
break;
case 4:
this.paging(res, this.list_.list2)
break;
case 5:
this.paging(res, this.list_.list3)
break;
}
uni.hideLoading();
},
paging(res, list) {
if (res.length == 0) {
list.status = 'nomore';
list.is_end = true;
return false;
} else {
list.status = 'loading';
list.page = list.page + 1;
setTimeout(() => {
list.data = [...list.data, ...res];
if (res.length != 10) {
list.is_end = true;
list.status = 'nomore';
} else {
list.status = 'loading';
}
}, 500)
}
this.$forceUpdate();
},
lower() {
switch (this.current) {
case 0:
this.onReachBottom_fn(this.list_.list0)
break;
case 1:
this.onReachBottom_fn(this.list_.list1)
break;
case 2:
this.onReachBottom_fn(this.list_.list2)
break;
case 3:
this.onReachBottom_fn(this.list_.list3)
break;
}
},
onReachBottom_fn(list) {
if (!list.is_end) {
this.get_order_list(this.current);
}
},
// tabsswiper
orderswitch(index) {
try {
switch (index) {
case 0:
if (this.list_list0.data.length < 10) {
this.form.status = 'nomore';
}
break;
case 1:
if (this.list_list1.data.length < 10) {
this.form.status = 'nomore';
}
break;
case 2:
if (this.list_.list2.data.length < 10) {
this.form.status = 'nomore';
}
break;
case 3:
if (this.list_.list3.data.length < 10) {
this.form.status = 'nomore';
}
break;
}
} catch (e) {
//TODO handle the exception
}
this.swiperCurrent = index;
},
// swiperswiperdx swipertabsswiper
animationfinish(e) {
let current = e.detail.current;
try {
switch (current) {
case 0:
if (this.list_list0.data.length < 10) {
this.form.status = 'nomore';
}
break;
case 1:
if (this.list_list1.data.length < 10) {
this.form.status = 'nomore';
}
break;
case 2:
if (this.list_.list2.data.length < 10) {
this.form.status = 'nomore';
}
break;
case 3:
if (this.list_.list3.data.length < 10) {
this.form.status = 'nomore';
}
break;
}
} catch (e) {
//TODO handle the exception
}
this.swiperCurrent = current;
this.current = current;
},
// clickoverlayshow(e) { //
// switch (e) {
// case 1:
// this.clickoverlayshowtext = ''
// break;
// case 2:
// this.clickoverlayshowtext = ''
// break;
// }
// this.overlayshow = true
// },
orderordercancel(item) { //
var this_ = this
uni.showModal({
content: '确定取消订单吗?',
confirmColor: '#f55850',
cancelColor: '#333333',
async success(resdata) {
if (resdata.confirm) {
let res = await this_.api.orderorderrefund({
order_id: item.order_id
})
if (res.code == 1) {
this_.init_fn()
}
}
}
})
},
async orderokprebook(item) {
let res = await this.api.orderokprebook({
order_id: item.order_id
})
if (res.code == 1) {
uni.showToast({
title: '确认成功',
icon: 'none'
});
setTimeout(() => {
this.init_fn()
}, 2000);
}
},
async orderrefuseprebook(e) {
let res = await this.api.orderrefuseprebook({
order_id: e.order_id,
refuse_str: ''
})
if (res.code == 1) {
uni.showToast({
title: '拒绝成功',
icon: 'none'
});
setTimeout(() => {
this.init_fn()
}, 2000);
}
},
orderordercancelrefund(item) { //退
uni.pro.navigateTo('my/order/refund', {
id: item.order_id
})
},
applylrefund(item) {
uni.pro.navigateTo('my/order/applylrefund', {
id: item.order_id
})
},
orderorderdelete(item) {
var this_ = this
if (item.pay_status == 0) {
uni.showModal({
content: '该笔订单还未付款,是否继续?',
confirmColor: '#f55850',
cancelColor: '#333333',
async success(resdata) {
if (resdata.confirm) {
let res = await this_.api.orderstartsercive({
order_id: item.order_id
})
if (res.code == 1) {
this_.init_fn()
}
}
}
})
} else {
uni.showModal({
content: '确定开始服务吗?',
confirmColor: '#f55850',
cancelColor: '#333333',
async success(resdata) {
if (resdata.confirm) {
let res = await this_.api.orderstartsercive({
order_id: item.order_id
})
if (res.code == 1) {
this_.init_fn()
}
}
}
})
}
},
async cancelOrder(item) { //
console.log(item)
// let res
// switch (this.clickoverlayshowtext) {
// case '':
// if (item.status == 0) {
// res = await this.api.orderordercancel({
// order_id: item.order_id
// })
// } else {
// uni.pro.navigateTo('my/order/orderInfo', {
// id: e,
// e: e
// })
// }
// break;
// case '':
// res = await this.api.orderorderdelete({
// order_id: item.order_id
// })
// break;
// }
// this.overlayshow = false
// this.init_fn()
},
eeInfo(e) { //
uni.pro.navigateTo('order/orderInfo', {
id: e.order_id
})
},
}
}
</script>
<style lang="scss">
page {
background: #F9F9F9;
}
.content {
.onecontent {
width: 100%;
background: #FFFFFF;
padding: 10rpx 28rpx;
.flex-start {
flex-wrap: nowrap;
.onecontent_oen {
margin: 0 auto;
flex: auto;
height: 70rpx;
border-radius: 14rpx;
border: 2rpx solid #6699FF;
padding-right: 8rpx;
.onecontent_oen_input {
padding-left: 32rpx;
flex: 1;
}
.onecontent_oen_text {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #FFFFFF;
text-align: center;
line-height: 56rpx;
width: 80rpx;
height: 56rpx;
background: #6699FF;
border-radius: 14rpx;
}
}
.onecontent_oen_right {
margin-left: 26rpx;
.onecontent_oen_rightimage {
width: 17.9rpx;
height: 19.34rpx;
}
.onecontent_oen_rightimageview {
text-align: center;
width: 140rpx;
margin-left: 10rpx;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
}
}
}
.onecontent_tow {
padding: 32rpx 0 32rpx 0;
width: 100%;
.onecontent_tow_item {
position: relative;
.onecontent_tow_itemtexts {
font-size: 32rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #333333;
}
.onecontent_tow_itemtext {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
}
.onecontent_tow_itemtexts::after {
content: '';
position: absolute;
bottom: -10rpx;
left: 50%;
transform: translateX(-50%);
width: 19.33rpx;
height: 6.66rpx;
background: url(https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/order1.png) no-repeat;
background-size: 100% 100%;
}
}
}
}
.towcontent {
padding: 0 28rpx;
.flex-colum_image {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
text {
margin-top: 30rpx;
font-size: 32rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #666666;
}
}
.towcontentitem {
margin-top: 32rpx;
padding: 24rpx;
width: 100%;
background: #FFFFFF;
border-radius: 12rpx;
.towcontentitemone {
width: 100%;
padding-bottom: 16rpx;
border-bottom: 1px solid #F6F6F6;
.towcontentitemone_one {
font-size: 28rpx;
width: 60%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #333333;
}
.towcontentitemone_tow {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
.towcontentitemone_towimage {
margin-right: 10rpx;
width: 24rpx;
height: 24rpx;
}
}
}
.towcontentitemtow {
position: relative;
padding: 22rpx 0;
border-bottom: 1px solid #F6F6F6;
.towcontentitemtow_imge {
width: 144rpx;
height: 144rpx;
background: #666666;
border-radius: 12rpx;
}
.towcontentitemtow_one {
margin-left: 32rpx;
width: 70%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
position: relative;
.towcontentitemtow_one_one {
width: 50%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
}
.towcontentitemtow_one_there {
position: absolute;
top: 0;
right: 0;
font-size: 20rpx;
font-family: Roboto-Bold, Roboto;
font-weight: 500;
color: #666;
}
.towcontentitemtow_one_tow {
margin-top: 24rpx;
font-size: 40rpx;
font-family: Roboto-Bold, Roboto;
font-weight: bold;
color: #FC5F69;
}
}
.towcontentitemtow_tow {
position: absolute;
bottom: 32rpx;
right: 0;
font-size: 28rpx;
font-family: Roboto-Regular, Roboto;
font-weight: 400;
color: #999999;
}
}
.towcontentitemthere {
width: 100%;
margin-top: 16rpx;
display: flex;
justify-content: flex-end;
align-items: center;
flex-wrap: wrap;
.towcontentitemthereitem {
margin-left: 24rpx;
padding: 8rpx 32rpx;
font-size: 28rpx;
border-radius: 28rpx;
}
.towcontentitemthereitem_one {
background: linear-gradient(101deg, #FA8E5D 0%, #F45E4D 100%);
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
}
.towcontentitemthereitem_tow {
background: #F6F6F6;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #999999;
}
.towcontentitemthereitem_there {
background: linear-gradient(303deg, #9FC9FF 0%, #6699FF 100%);
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #FFFFFF;
}
}
}
}
.warp {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
.rect {
padding: 40rpx 68rpx;
width: 480rpx;
background: #FFFFFF;
border-radius: 42rpx;
.rectone {
font-size: 32rpx;
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-weight: bold;
color: #333333;
}
.recttow {
width: 100%;
margin-top: 32rpx;
.recttow_one {
padding: 8rpx 40rpx;
background: #FFFFFF;
border-radius: 26rpx;
border: 2rpx solid #999999;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
}
.recttow_tow {
padding: 8rpx 40rpx;
background: #333333;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #FFFFFF;
border-radius: 26rpx;
}
}
}
}
}
</style>

610
pages/order/orderInfo.vue Normal file
View File

@ -0,0 +1,610 @@
<template>
<view class="index">
<!-- <view class="onecontent">
<view class="onecontentone">
<text v-if="datalist.status == 0">待支付</text>
<text v-if="datalist.status == 1">已支付</text>
<text v-if="datalist.status == 2">等待确认</text>
<text v-if="datalist.status == 3">已确认</text>
<text v-if="datalist.status == 4">已完成 </text>
<text v-if="datalist.status == 5">已取消</text>
<text v-if="datalist.status == 6">退款中</text>
<text v-if="datalist.status == 7">已退款</text>
</view>
<view class="onecontenttow">
感谢您的支持欢迎再次光临
</view>
<view class="onecontentthere flex-between">
<view class="onecontentthere_one" v-if="datalist.status == 5 || datalist.status == 4 "
@click="orderorderdelete(datalist)">
删除订单
</view>
<view class="onecontentthere_tow"
v-if="datalist.status == 1 || datalist.status == 2 ||datalist.status == 3"
@click="orderordercancelrefund(datalist)">
申请退款
</view>
</view>
</view> -->
<view class="towcontent">
<view class="towcontentone flex-between">
<view class="towcontentone_one flex-start">
<u-icon name="home" color="#ffffff" size="20"></u-icon>
<text class="towcontentone_one_text">{{datalist.store_title}}</text>
</view>
<u-icon @click="phonefill(datalist.store_mobile)" name="phone-fill" color="#ffffff" size="20"></u-icon>
</view>
<view class="towcontenttow flex-start" @click="detailsInfo(datalist.store_service_id)">
<image class="towcontenttow_image" :src="datalist.store_avatar" mode=""></image>
<view class="towcontenttowone flex-colum-start">
<view class="towcontenttowone_one">
{{datalist.title}}
</view>
<view class="towcontenttowone_tow flex-start">
<view class="towcontenttowone_tow_one flex-start">
<u-icon name="checkmark-circle" color="#999999" size="14"></u-icon>
随时退
</view>
<view class="towcontenttowone_tow_one flex-start">
<u-icon name="checkmark-circle" color="#999999" size="14"></u-icon>
过期退
</view>
</view>
<view class="towcontenttowone_there">
¥{{datalist.total_price}}
</view>
</view>
</view>
<!--<view class="towcontentthere flex-between">
<text class="towcontentthere_text"></text>
</view>
<view class="qr-box flex-colum" @longpress="save()">
<canvas canvas-id="qrcode" style="width:288rpx;" />
</view>
<view class="towcontenttfour flex-colum">
123 2345 567
</view> -->
<!-- <view class="towcontenttfive flex-between">
<view class="towcontenttfive_one flex-start">
<view class="towcontenttfive_oneone">
退款:
</view>
<view class="towcontenttfive_onetow">
08-22 23:59:59到期
</view>
</view>
<view class="towcontenttfive_tow">
申请退款
</view>
</view> -->
</view>
<view class="therecontent">
<view class="therecontentone">
订单信息
</view>
<view class="therecontentow entowakst">
服务人员<text>{{datalist.people ||'无'}}</text>
</view>
<view class="therecontentow entowakst">
预约时间<text>{{datalist.time ||'无'}}</text>
</view>
<view class="therecontentow entowakst">
实付金额<text>{{datalist.money}}</text>
</view>
<view class="therecontentthere entowakst">
购买数量{{datalist.number}}
</view>
<view class="therecontenfour entowakst">
手机号码{{datalist.mobile.replace(/(\d{3})\d{4}(\d{4})/,'$1****$2') || '-'}}
</view>
<view class="therecontentfive flex-start entowakst">
订单编号{{datalist.out_trade_no}}
<text class="therecontentfive_box" @click="copy(datalist.out_trade_no)">复制</text>
</view>
<view class="therecontentsix entowakst">
下单时间{{datalist.createtime}}
</view>
</view>
<view class="fourcontent">
<view class="fourcontentone">
购买须知
</view>
<view v-html="datalist.details">
</view>
<!-- <view class="entowakst" v-html="datalist.details">
·预约须知请您提前1小时预约
</view> -->
</view>
<!-- <view class="fivecontent">
<view class="fivecontentone">
用户评价
</view>
<view class="fivecontenttow flex-between">
<view class="fivecontenttow_one flex-start">
<text class="fivecontenttow_text">综合评分</text>
<u-rate :count="5" value="4" active-color="#f1cb66" inactive-color="#F1CB66"></u-rate>
</view>
<view class="fivecontenttow_tow">
满意
</view>
</view>
</view> -->
</view>
</template>
<script>
// import uQRCode from '@/common/js/uqrCode.js'
export default {
data() {
return {
datalist: {},
imgCode: '', // }
form: {
phone: '18092171236'
}
}
},
async onLoad(e) {
try {
let res = await this.api.orderorderdetail({
order_id: e.id
})
if (res) {
this.datalist = res.data
this.datalist.details = res.data.details.replace(/\<img/g,
'<img style="max-width:100%;height:auto" ');
}
} catch (e) {}
// this.generate()
},
methods: {
orderorderdelete(item) { //
uni.showModal({
content: '确定删除订单吗?',
confirmColor: '#f55850',
cancelColor: '#333333',
async success(resdata) {
if (resdata.confirm) {
await this.api.orderorderdelete({
order_id: item.order_id
})
uni.navigateBack()
}
}
})
},
orderordercancelrefund(item) { //退
console.log(item)
uni.pro.navigateTo('my/order/refund', {
id: item.order_id
})
},
//
generate(e) {
uQRCode.make({
canvasId: 'qrcode',
componentInstance: this,
text: "https://ky.sxczgkj.cn/wap/merchant/authPay?userAppId=244", //
size: 150,
margin: 0,
backgroundColor: '#ffffff',
foregroundColor: '#000000',
fileType: 'jpg',
errorCorrectLevel: uQRCode.errorCorrectLevel.H,
success: res => {
this.imgCode = res // base64
}
})
},
//
save() {
uni.getSetting({ //
success: (res) => {
if (res.authSetting['scope.writePhotosAlbum']) { //访
this.aveImageToPhotosAlbum();
} else {
uni.authorize({ //
scope: 'scope.writePhotosAlbum',
success: () => {
this.aveImageToPhotosAlbum();
},
fail: () => {
//
uni.showToast({
title: "请打开保存相册权限,再点击保存到手机",
icon: "none",
duration: 3000
});
setTimeout(() => {
uni.openSetting({ //,访
success: (res2) => {
// console.log(res2.authSetting)
}
});
}, 3000);
}
})
}
}
})
},
copy(value) {
//
uni.setClipboardData({
data: value, //
success: () => { //
uni.showToast({
title: '复制成功'
})
}
});
},
detailsInfo(e) { //
uni.pro.navigateTo('my/order/cporderinfo', {
id: e,
})
},
phonefill(value) {
uni.makePhoneCall({
phoneNumber: value //
});
},
aveImageToPhotosAlbum() {
let base64 = this.imgCode.replace(/^data:image\/\w+;base64,/, ""); //data:image/png;base64,
let filePath = wx.env.USER_DATA_PATH + '/ph_fit_qrcode.png'; //
uni.showLoading({
title: '加载中',
mask: true
})
uni.getFileSystemManager().writeFile({ //
filePath: filePath, //
data: base64, //
encoding: 'base64', //
success: res => {
uni.saveImageToPhotosAlbum({ //
filePath: filePath,
success: function(res2) {
uni.hideLoading();
uni.showToast({
title: '保存成功',
icon: "none",
duration: 5000
})
},
fail: function(err) {
uni.hideLoading();
// console.log(err.errMsg);
}
})
},
fail: err => {
uni.hideLoading();
//console.log(err)
}
})
},
}
}
</script>
<style lang="scss">
page {
background: #F6F6F6;
}
.index {
padding: 32rpx 28rpx;
.onecontent {
width: 100%;
padding: 32rpx;
background: #FFFFFF;
border-radius: 12rpx;
.onecontentone {
font-size: 32rpx;
font-family: SourceHanSansCN-Medium-, SourceHanSansCN-Medium;
font-weight: normal;
color: #333333;
}
.onecontenttow {
margin-top: 16rpx;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
font-weight: normal;
color: #666666;
}
.onecontentthere {
margin-top: 24rpx;
.onecontentthere_one {
background: #333333;
border-radius: 8rpx;
padding: 16rpx 94rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #FFFFFF;
}
.onecontentthere_tow {
background: #F7F7F7;
border-radius: 8rpx;
padding: 16rpx 94rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
}
}
.towcontent {
margin-top: 24rpx;
width: 100%;
background: #FFFFFF;
border-radius: 18rpx;
.towcontentone {
position: relative;
padding: 16rpx 32rpx;
border-radius: 18rpx 18rpx 0 0;
background: #9397c1;
.towcontentone_one {
width: 80%;
.towcontentone_one_image {
width: 33.04rpx;
height: 29.79rpx;
}
.towcontentone_one_text {
width: 80%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-left: 10rpx;
font-size: 28rpx;
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
font-weight: normal;
color: #FFFFFF;
}
}
.towcontentone_one::after {
z-index: 10;
position: absolute;
bottom: -22rpx;
content: '';
display: inline-block;
left: 50%;
transform: translateX(-50%);
width: 44rpx;
height: 44rpx;
border-radius: 0 0 22rpx 22rpx;
background: #9397c1;
}
}
.towcontenttow {
padding: 32rpx;
width: 100%;
background: #fff;
.towcontenttow_image {
width: 128rpx;
height: 128rpx;
}
.towcontenttowone {
height: 128rpx;
margin-left: 36rpx;
justify-content: space-around;
.towcontenttowone_one {
font-size: 28rpx;
font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
font-weight: normal;
color: #333333;
}
.towcontenttowone_tow {
.towcontenttowone_tow_one {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
font-weight: normal;
color: #999999;
}
}
.towcontenttowone_there {
font-size: 32rpx;
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
font-weight: normal;
color: #333333;
}
}
}
.towcontentthere {
position: relative;
height: 44rpx;
width: 100%;
.towcontentthere_text {
width: 100%;
height: 0px;
border: 1rpx dashed #EAEAEA;
}
.towcontentthere_text::after {
z-index: 10;
position: absolute;
content: '';
display: inline-block;
left: 0;
top: 0;
width: 22rpx;
height: 44rpx;
border-radius: 0 44rpx 44rpx 0;
background: #f6f6f6;
}
.towcontentthere_text::before {
z-index: 10;
position: absolute;
content: '';
display: inline-block;
right: 0;
top: 0;
width: 22rpx;
height: 44rpx;
border-radius: 44rpx 0 0 44rpx;
background: #f6f6f6;
}
}
.towcontenttfour {
margin-top: 16rpx;
font-size: 32rpx;
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
font-weight: normal;
color: #333333;
}
.towcontenttfive {
padding: 32rpx;
width: 100%;
.towcontenttfive_one {
font-size: 32rpx;
font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
font-weight: normal;
color: #333333;
}
.towcontenttfive_onetow {
margin-left: 16rpx;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
font-weight: normal;
color: #666666;
}
.towcontenttfive_tow {
padding: 10rpx 16rpx;
background: #FFFFFF;
border-radius: 8rpx;
border: 2rpx solid #D5D5D5;
}
}
}
.therecontent {
margin-top: 24rpx;
padding: 32rpx;
width: 100%;
background: #FFFFFF;
border-radius: 18rpx;
.therecontentone {
font-size: 28rpx;
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-weight: bold;
color: #333333;
}
.entowakst {
font-size: 28rpx;
font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
font-weight: normal;
color: #333333;
}
.therecontentfive_box {
padding: 6rpx 10rpx;
font-size: 20rpx;
font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
font-weight: normal;
color: #666666;
background: #FFFFFF;
margin-left: 6rpx;
border-radius: 8rpx;
border: 2rpx solid #D5D5D5;
}
}
.fourcontent {
margin-top: 24rpx;
padding: 32rpx;
width: 100%;
background: #FFFFFF;
border-radius: 18rpx;
.fourcontentone {
font-size: 28rpx;
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-weight: bold;
color: #333333;
}
.fourcontentone::after {
content: '';
display: inline-block;
width: 100%;
height: 1rpx;
border: 1px solid #F7F7F7;
}
.entowakst {
font-size: 24rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #666666;
}
}
.fivecontent {
margin-top: 24rpx;
padding: 32rpx;
width: 100%;
background: #FFFFFF;
border-radius: 18rpx;
.fivecontentone {
font-size: 28rpx;
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-weight: bold;
color: #333333;
}
.fivecontenttow {
margin-top: 16rpx;
.fivecontenttow_one {
.fivecontenttow_text {
padding-right: 24rpx;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
font-weight: normal;
color: #333333;
}
}
.fivecontenttow_tow {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular-, SourceHanSansCN-Regular;
font-weight: normal;
color: #666666;
}
}
}
}
</style>

520
pages/order/paybill.vue Normal file
View File

@ -0,0 +1,520 @@
<template>
<view class="container">
<view class="card">
<view class="info-wrap">
<image class="cover" :src="shopInfo.portrait" mode="aspectFill"></image>
<text class="t">{{ shopInfo.userName }}</text>
</view>
<view class="input-wrap">
<view class="input-cont">
<text class="i"></text>
<text class="num">{{ num }}</text>
</view>
<view class="tips"><input class="input" type="text" :maxlength="10" placeholder="添加付款备注最多10个字"
v-model="remark" /></view>
</view>
</view>
<view class="card">
<view class="title"><text>支付方式</text></view>
<view class="pay-list">
<view class="item">
<view class="label">
<image class="icon" src="@/static/4.png" mode="aspectFit"></image>
<text class="t">微信支付</text>
</view>
<uni-icons type="checkbox-filled" size="18" color="#54A347"></uni-icons>
</view>
</view>
<view class="num-wrap">
<text>实付</text>
<text class="t b">{{ num || 0 }}</text>
</view>
</view>
<view class="number-key-wrap">
<view class="number-key">
<view class="left">
<view class="num-list">
<view class="item" v-for="item in 9" :key="item" hover-class="active" hover-stay-time="50"
@click="numHandle(`${item + 1}`)">
<text>{{ item + 1 }}</text>
</view>
</view>
<view class="num-foot">
<view class="item" hover-class="active" hover-stay-time="50" @click="numHandle('0')">
<text>0</text>
</view>
<view class="item" hover-class="active" hover-stay-time="50" @click="numHandle('.')">
<text>.</text>
</view>
</view>
</view>
<view class="right">
<view class="item" hover-class="active" hover-stay-time="50" @click="delHandle" @longpress="longDel"
@touchend="endLongDel">
x
<!-- <uni-icons type="arrow-left" size="24"></uni-icons> -->
</view>
<view class="item confirm" hover-class="active" hover-stay-time="50" @click="submitHandle">
<text>付款</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
userAppId: '', // id
shopInfo: '', //
num: '', //
// maxNum: 200,
remark: '', //
timer: null,
orderNumber: '',
type: 1,
appid:''
};
},
onLoad(e) {
console.log(e, '111')
uni.request({
url: `https://ky.sxczgkj.cn/api/payConfig/appconfig`,
method: 'get',
header: {
'content-type': 'application/json'
},
success: (res) => {
if (res.data.code == 200) {
this.appid = res.data.data.appid
} else {
uni.showToast({
icon: 'none',
title: res.data.message
});
}
},
fail: (err) => {
uni.showToast({
icon: 'none',
title: '失败'
});
}
});
// #ifdef MP-WEIXIN
uni.login({
provider: 'weixin',
success: async (data) => {
try {
let res = await this.api.usergetopenid({
code: data.code
})
if (res) {
uni.cache.set('openId',res.data.openid);
}
} catch (e) {
console.log(e)
}
}
});
// #endif
if (e.orderNumber) {
this.orderNumber = e.orderNumber;
}
if (e.q) {
let urlStr = decodeURIComponent(e.q);
if (this.getQueryString(urlStr, 'userAppId')) {
this.type = 1;
this.userAppId = this.getQueryString(urlStr, 'userAppId')
} else {
this.type = 2;
this.userAppId = urlStr.match('[^/]+(?!.*/)')[0]
}
console.log(this.userAppId, 'this.userAppId')
this.getShopInfo();
}
},
methods: {
//
async submitHandle() {
try {
if (!this.num) {
uni.showToast({
title: '请输入支付金额',
icon: 'none'
});
} else {
uni.showLoading({
title: '支付中...',
mask: true
});
uni.login({
provider: 'weixin',
success: async (resdata) => {
let res = await this.requestHandle('/applet-pay/java-pay', {
store_id: this.shopInfo.store_id, // id
pay_type: '1',
money: this.num, //
remark: this.remark, //
code: resdata.code,
appid:this.appid
});
uni.requestPayment({
provider: 'wxpay',
timeStamp: res.data.payTimeStamp,
nonceStr: res.data.paynonceStr,
package: res.data.payPackage,
signType: res.data.paySignType,
paySign: res.data.paySign,
success: (res) => {
uni.hideLoading();
uni.showModal({
title: '注意',
content: `成功支付${this.num}`,
showCancel: false,
success: (res) => {
if (res.confirm) {
// uni.reLaunch({
// url: '/pages/index/index'
// });
uni.exitMiniProgram({
success: () => {
console.log('退出小程序成功');
},
fail: function(
err) {
console.log('退出小程序失败',err);
}
})
}
}
});
},
fail: (err) => {
uni.hideLoading();
uni.showToast({
title: '支付失败',
icon: 'none'
});
}
});
}
});
}
} catch (e) {
uni.showToast({
title: '支付失败:' + JSON.stringify(e),
icon: 'none'
});
}
},
//
delHandle() {
uni.vibrateShort();
this.num = this.num.slice(0, -1);
},
//
longDel() {
this.timer = setInterval(() => {
this.delHandle();
}, 100);
},
//
endLongDel() {
clearInterval(this.timer);
this.timer = null;
},
//
numHandle(num) {
uni.vibrateShort();
this.num = this.clearNoNum({
value: (this.num += num)
});
},
//
requestHandle(url = '', data = {}, method = 'post') {
return new Promise((resolve, reject) => {
uni.request({
url: `${'https://kysh.sxczgkj.cn'}/javaApi${url}`,
method: method,
header: {
uniacid: '1',
module: 'yb_o2ov2',
appType: 'mini'
// userId:uni.getStorageSync('userId')
},
data: data,
success: (res) => {
if (res.data.code == 1) {
resolve(res.data);
} else {
uni.showToast({
icon: 'none',
title: res.data.msg
});
reject(res.data.msg);
}
},
fail: (err) => {
reject(JSON.stringify(err));
}
});
});
},
//
async getShopInfo() {
try {
const res = await this.requestHandle('/applet-pay/get-applet-store-info', {
code_id: this.userAppId,
type: this.type
});
this.shopInfo = res.data;
} catch (e) {}
},
// url
getQueryString(url, name) {
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i');
var r = url.substr(1).match(reg);
if (r != null) {
return r[2];
}
return null;
},
/**
* 去除字符串中除了数字和点以外的其他字符
* @param {Object} obj
*/
clearNoNum(obj) {
//
if (obj.value != '' && obj.value.substr(0, 1) == '.') {
obj.value = '';
}
obj.value = obj.value.replace(/^0*(0\.|[1-9])/, '$1'); //
obj.value = obj.value.replace(/[^\d.]/g, ''); //.
obj.value = obj.value.replace(/\.{2,}/g, '.'); //.
obj.value = obj.value.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.');
obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //
if (obj.value.indexOf('.') < 0 && obj.value != '') {
// 0102
if (obj.value.substr(0, 1) == '0' && obj.value.length == 2) {
obj.value = obj.value.substr(1, obj.value.length);
}
}
return obj.value;
}
}
};
</script>
<style scoped lang="scss">
.container {
padding: 28upx;
padding-bottom: 640upx;
}
.card {
padding: 28upx;
border-radius: 28upx;
background-color: #fff;
margin-bottom: 28upx;
.title {
font-size: 32upx;
}
}
.info-wrap {
display: flex;
align-items: center;
.cover {
$size: 80upx;
width: $size;
height: $size;
border-radius: 50%;
margin-right: 20upx;
background-color: #efefef;
}
.t {
font-size: 32upx;
}
}
.input-wrap {
padding: 28upx 0 0;
.input-cont {
display: flex;
align-items: center;
border-bottom: 1upx solid #ececec;
.i {
font-size: 42upx;
font-weight: bold;
margin-right: 12upx;
position: relative;
top: -4upx;
}
.num {
font-size: 48upx;
height: 80upx;
font-weight: bold;
position: relative;
padding-right: 14upx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
&::after {
content: '';
width: 4upx;
height: 40upx;
background-color: #333;
position: absolute;
top: 50%;
margin-top: -24upx;
right: 0;
animation: ani 0.8s ease-in-out 1.4s infinite;
}
@keyframes ani {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
}
}
.tips {
display: flex;
padding-top: 24upx;
.input {
flex: 1;
}
}
}
.pay-list {
.item {
display: flex;
justify-content: space-between;
padding: 28upx 0;
.label {
display: flex;
align-items: center;
.icon {
$size: 60upx;
width: $size;
height: $size;
margin-right: 20upx;
}
.t {
font-size: 28upx;
}
}
}
}
.num-wrap {
display: flex;
align-items: center;
justify-content: flex-end;
.t {
font-size: 32upx;
}
.b {
font-weight: bold;
}
}
.number-key-wrap {
width: 100%;
position: fixed;
left: 0;
bottom: 0;
background-color: #efefef;
z-index: 999;
padding: 28upx 28upx calc(env(safe-area-inset-bottom) + 28upx);
border-radius: 28upx 28upx 0 0;
$gap: 12upx;
$radius: 14upx;
$itemH: 120upx;
.number-key {
display: flex;
.item {
display: flex;
font-size: 48upx;
font-weight: bold;
align-items: center;
justify-content: center;
border-radius: $radius;
background-color: #fff;
&.active {
background-color: #d9d9d9;
}
}
.left {
flex: 1;
.num-list {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-rows: $itemH $itemH $itemH;
grid-gap: $gap;
}
.num-foot {
padding-top: $gap;
display: grid;
grid-gap: $gap;
grid-template-columns: 2fr 1fr;
grid-template-rows: $itemH;
}
}
.right {
width: 160upx;
display: flex;
flex-direction: column;
margin-left: $gap;
.item {
flex: 1;
&:last-child {
margin-top: $gap;
font-size: 32upx;
}
&.confirm {
background-color: #ffcc17;
&.active {
background-color: #e1b516;
}
}
}
}
}
}
</style>

673
pages/project/create.vue Normal file
View File

@ -0,0 +1,673 @@
<template>
<view class="index">
<view class="title_text">
基本信息
</view>
<view class="onecontent">
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
项目图片
</view>
<view class="onecontent_itemright flex-start">
<view v-if="form.img" class="onecontent_itemrightimges flex-colum" @click="chooseImagelist()">
<image :src="form.img"></image>
</view>
<view v-else class="onecontent_itemrightimges flex-colum" @click="chooseImagelist()">
+
</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">
原价
</view>
<view class="onecontent_itemright flex-start">
<input class="onecontent_itemright_text" v-model="form.y_price" 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" 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" 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.describe" type="text"
placeholder="显示项目列表的简单描述不超过30个字">
</view>
</view>
</view>
<view class="title_text">
项目设置
</view>
<view class="onecontent">
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
项目分类
</view>
<view class="onecontent_itemright flex-start" @click="clicksheetshow">
<text style="flex: 1; text-align: right;" class="onecontent_itemrighttext"
v-if="form.name">{{form.name}}</text>
<text style="flex: 1; text-align: right;" class="onecontent_itemrighttext" v-else>请选择</text>
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
</view>
</view>
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
上架
</view>
<u-switch v-model="form.status" @change="changeswitch" size="20"></u-switch>
</view>
<!-- <view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
推荐
</view>
<u-switch v-model="form.is_re" @change="changeswitchs" size="20"></u-switch>
</view> -->
</view>
<view class="title_text">
项目描述
</view>
<view class="onecontent">
<!-- <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 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>
</view>
</view>
</view>
<view class="baocun" @tap="$u.debounce(servicecreateitem,1000)">
保存
</view>
<view class="baocun" v-if="form.service_id!=''" @click="servicedelservice" style="background: red;">
删除
</view>
<u-action-sheet :actions="listsheet" :show="sheetshow" @select="selectClick"></u-action-sheet>
</view>
</template>
<script>
import uploadImage from "@/js_sdk/yushijie-ossutil/ossutil/uploadFile.js";
export default {
data() {
return {
listsheet: [],
sheetshow: false,
readOnly: false,
formats: {},
context: {},
form: {
service_type_id: '',
title: '',
y_price: '',
price: '',
describe: '',
status: true,
is_re: false,
details: '',
service_id: '',
name: "",
img: '',
}
}
},
async onLoad(e) {
try {
if (e.id) {
console.log(e)
this.form.service_id = e.id
let res = await this.api.servicedetail({
service_id: e.id
})
uni.setNavigationBarTitle({
title: '修改项目'
})
if (res.code = 1) {
this.form = res.data
var thisdatadescribe = res.data.details
uni.createSelectorQuery().select('#editor').context((res) => {
if (!res) return
res.context.setContents({
html: thisdatadescribe
})
}).exec()
console.log(this.form)
}
} else {
uni.setNavigationBarTitle({
title: '创建项目'
})
}
} catch (e) {
//TODO handle the exception
}
this.serviceitemclass()
},
onShow() {},
mounted() {
this.$bus.$on('editors', this.demo)
},
methods: {
clicksheetshow() {
if (this.listsheet.length == 0) {
uni.showToast({
title: '请先去添加分类',
icon: 'none'
});
} else {
this.sheetshow = true
}
},
demo(data) {
this.form.details = data
},
demos() {
uni.pro.navigateTo('project/editor/editor', {
id: this.form.service_id
})
},
selectClick(index) {
this.sheetshow = false
this.form.name = index.name
this.form.service_type_id = index.id
console.log(index)
},
changeswitch(e) {
this.form.status = e
},
changeswitchs(e) {
this.form.is_re = e
},
async serviceitemclass(e) { //
let data = await this.api.serviceitemclass({
page:1
});
this.listsheet = data.data
},
async servicecreateitem() {
if (this.form.service_type_id == null || this.form.service_type_id == '') {
uni.showToast({
title: '请选择项目分类',
icon: 'none'
});
return false;
}
if (this.form.title == null || this.form.title == '') {
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.describe == null || this.form.describe == '') {
uni.showToast({
title: '项目详情不能为空',
icon: 'none'
});
return false;
}
if (this.form.details == null || this.form.details == '') {
uni.showToast({
title: '详情/规则不能为空',
icon: 'none'
});
return false;
}
if (this.form.img == null || this.form.img == '') {
uni.showToast({
title: '图片不能为空',
icon: 'none'
});
return false;
}
let res = await this.api.servicecreateitem({
service_type_id: this.form.service_type_id,
title: this.form.title,
y_price: this.form.y_price,
price: this.form.price,
describe: this.form.describe,
status: this.form.status,
is_re: this.form.is_re,
details: this.form.details,
img: this.form.img,
service_id: this.form.service_id
});
if (res.code == 1) {
uni.showToast({
title: this.form.service_id ? '修改成功' : '创建成功',
icon: 'none'
});
uni.navigateBack();
}
},
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, 'refund/',
result => {
this.form.avatar = ''
this.form.img = result
uni.hideLoading()
}, result => {
console.log(result, '2222')
uni.hideLoading()
})
},
fail: (res) => {
uni.hideLoading()
}
});
},
getText(e) {
this.context = e.detail.html
this.form.details = this.context
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
},
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/',
result => {
this.editorCtx.insertImage({
src: result,
alt: '图像',
})
uni.hideLoading()
}, result => {
console.log(result)
uni.hideLoading()
})
},
fail: (res) => {
uni.hideLoading()
}
});
}
}
}
</script>
<style lang="scss">
@import "./editor-icon.css";
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;
.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;
}
}
.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;
}
}
}
}
}
}
}
</style>

197
pages/project/createcap.vue Normal file
View File

@ -0,0 +1,197 @@
<template>
<view class="index">
<view class="title_text">
创建分类
</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="name" maxlength="8" type="text"
placeholder="请输入项目分类">
</view>
</view>
</view>
<view class="thereconse thereconses" @click="servicecreateitemclass">
确定
</view>
<view class="title_text">
管理分类
</view>
<view class="onecontent">
<view class="onecontent_item flex-between" v-for="(item,index) in list" :key="index"
@click="contentfixedclick(item)">
<view class="onecontent_itemleft">
{{item.name}}
</view>
<u-icon name="arrow-right" color="#333" size="20"></u-icon>
</view>
</view>
<view v-if="list.length==0 && is_end == true" style="margin-top: 100rpx;width: 100%;" class="flex-colum">
<image src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/nothave.png" mode="">
</image>
</view>
<u-loadmore :status="form.status" />
</view>
</template>
<script>
export default {
data() {
return {
name: '',
list: [],
is_end: false,
form: {
page: 1,
status: 'loadmore',
},
}
},
onShow() {
this.init_fn()
},
methods: {
init_fn() {
this.list = []
this.is_end = false
this.form.page = 1
this.form.status = 'loadmore'
this.shoppinggooodstype()
},
async shoppinggooodstype() {
let res = await this.api.serviceitemclass({
page:1
});
if (res.code == 1) {
if (res.data.length == 0) {
this.is_end = true
this.form.status = 'nomore'
return false;
} else {
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.list = [...this.list, ...res.data];
if (res.data.length == 10) {
this.form.status = 'loading';
} else {
this.is_end = true;
this.form.status = 'nomore';
}
}, 500)
}
}
},
contentfixedclick(e) {
uni.navigateTo({
url: '/pages/project/createcapinfo?name=' + e.name +'&goods_type_id='+ e.id
});
},
async servicecreateitemclass() {
let res = await this.api.servicecreateitemclass({
name: this.name,
type:1
});
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;
}
#editor {
width: 100%;
height: 456rpx;
padding: 12rpx 40rpx;
background: #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;
}
.onecontent_itemright_text {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
}
.thereconse {
width: 630rpx;
height: 80rpx;
background: #999999;
border-radius: 40rpx;
font-size: 36rpx;
text-align: center;
margin: 84rpx auto;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
line-height: 80rpx;
}
.thereconses {
background: linear-gradient(115deg, #7E81A5 0%, #4D4E64 100%);
}
}
</style>

View File

@ -0,0 +1,161 @@
<template>
<view class="index">
<view class="title_text">
修改分类
</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.name" maxlength="8" type="text"
placeholder="请输入商品分类">
</view>
</view>
</view>
<view class="thereconse" @click="servicecreateitemclass">
确定
</view>
<view class="thereconse thereconsess" @click="shoppingdeletegoodstype">
刪除
</view>
</view>
</template>
<script>
export default {
data() {
return {
form: {
name:'',
service_id:''
},
}
},
onLoad(e) {
this.form.name = e.name
this.form.service_id = e.goods_type_id
},
methods: {
async shoppingdeletegoodstype(){
let res = await this.api.servicedeleteitem({
id:this.form.service_id
});
if (res.code == 1) {
uni.showToast({
title: '删除成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
},
async servicecreateitemclass() {
let res = await this.api.servicecreateitemclass({
name: this.form.name,
type:2,
id:this.form.service_id
});
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;
}
#editor {
width: 100%;
height: 456rpx;
padding: 12rpx 40rpx;
background: #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;
}
.onecontent_itemright_text {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
}
.thereconse {
width: 630rpx;
height: 80rpx;
background: #999999;
border-radius: 40rpx;
font-size: 36rpx;
text-align: center;
margin: 50rpx auto;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
line-height: 80rpx;
background: #6699FF;
border-radius: 16rpx;
}
.thereconsess{
background:#fc5f69;
}
}
</style>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,271 @@
<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.servicedetail({
service_id: e.id
})
if (res.code = 1) {
var thisdatadescribe = res.data.details
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('editors', 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/',
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.

230
pages/project/index.vue Normal file
View File

@ -0,0 +1,230 @@
<template>
<view class="content">
<view class="onecontent flex-between">
<u-search shape="square" :clearabled="true" @blur='servicelists' :showAction="false" placeholder="输入关键字"
v-model="like"></u-search>
<view class="flex-start" style="padding-left:20rpx;" @click="contentfixedclick()">
<u-icon name="order" color="#666" size="22"></u-icon>
<text class="flex-starttext">新建项目</text>
</view>
<view class="flex-start" style="padding-left:20rpx;" @click="createcap()">
<u-icon name="order" color="#666" size="22"></u-icon>
<text class="flex-starttext">新建分类</text>
</view>
</view>
<view class="contenttow">
<view class="contenttowitem" v-for="(item,index) in list" :key="index" @click="contentfixedclick(item.service_id)">
<view class="contenttowitemone flex-between">
<text class="contenttowitemone_one"
:style="item.service_status == 0?'color: #ccc;':''">{{item.service_title}}</text>
<view class="contenttowitemone_tow flex-start" >
<text class="contenttowitemone_towtext">编辑项目</text>
<u-icon name="file-text" color="#999" size="20"></u-icon>
</view>
</view>
<view class="contenttowitemtow flex-between">
<image class="contenttowitemtowimage" :src="item.service_img" mode=""></image>
<view class="contenttowitemtow_item flex-colum-start">
<view class="contenttowitemtow_itemone" :style="item.service_status == 0?'color: #ccc;':''">
{{item.service_describe}}
</view>
<view class="contenttowitemtow_ittow flex-between">
<view class="contenttowitemtow_ittowone"
:style="item.service_status == 0?'color: #ccc;':''">
¥{{item.service_price}}<text
class="contenttowitemtow_ittowonetext">{{item.service_y_price}}</text>
</view>
<view class="contenttowitemtow_ittowtow">
<text v-if="item.service_status == 1" style="color: green;">已上架</text>
<text v-else style="color: red;">已下架</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view v-if="list.length==0 && form.is_end == true" class="flex-colum">
<image src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/nothave.png" mode="">
</image>
</view>
<u-loadmore :status="form.status" />
</view>
</template>
<script>
export default {
data() {
return {
like: "",
list: [],
form: {
is_end: false,
page: 1,
status: 'loadmore',
},
}
},
onShow() {
this.form = {
is_end: false,
page: 1,
status: 'loadmore',
},
this.list = []
this.servicelist()
},
onReachBottom() {
this.servicelist()
},
methods: {
servicelists() {
this.list = []
this.form.page = 1
this.servicelist()
},
contentfixedclick(e) {
uni.pro.navigateTo('project/create', {
id: e
})
},
createcap() {
uni.pro.navigateTo('project/createcap')
},
async servicelist(e) { //
let res = await this.api.servicelist({
page: this.form.page,
like: this.like
});
if (res.data.length == 0) {
this.form.is_end = true
this.form.status = 'nomore'
return false;
} else {
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.list = [...this.list, ...res.data];
if (res.data.length == 10) {
this.form.status = 'loading';
} else {
this.form.is_end = true;
this.form.status = 'nomore';
}
}, 500)
}
},
}
}
</script>
<style lang="scss">
page {
background: #fbfbfa;
}
.content {
.onecontent {
padding: 16rpx 20rpx;
width: 100%;
background: #FFFFFF;
.flex-start {
.flex-starttext {
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
}
}
.contenttow {
padding: 0 28rpx;
.contenttowitem {
margin-top: 34rpx;
padding: 24rpx;
width: 100%;
background: #FFFFFF;
border-radius: 24rpx;
.contenttowitemone {
width: 100%;
padding-bottom: 18rpx;
border-bottom: 1rpx solid #EAEAEA;
.contenttowitemone_one {
width: 60%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 28rpx;
font-family: SourceHanSansCN-Medium, SourceHanSansCN;
font-weight: bold;
color: #333333;
}
.contenttowitemone_tow {
.contenttowitemone_towtext {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
}
}
.contenttowitemtow {
width: 100%;
padding-top: 18rpx;
.contenttowitemtowimage {
width: 136rpx;
height: 136rpx;
border-radius: 10rpx;
}
.contenttowitemtow_item {
height: 136rpx;
width: 75%;
justify-content: space-between;
.contenttowitemtow_itemone {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #333333;
}
.contenttowitemtow_ittow {
width: 100%;
.contenttowitemtow_ittowone {
font-size: 32rpx;
font-family: SourceHanSansCN-Medium, SourceHanSansCN;
font-weight: bold;
color: #333333;
.contenttowitemtow_ittowonetext {
text-decoration: line-through;
margin-left: 10rpx;
font-size: 22rpx;
font-weight: 400;
}
}
.contenttowitemtow_ittowtow {
font-size: 16rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
}
}
}
}
</style>

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>

395
pages/staff/add.vue Normal file
View File

@ -0,0 +1,395 @@
<template>
<view class="content">
<view class="contentitem flex-between">
<view class="contentitemtext">
头像
</view>
<view class="onecontent_itemright flex-start">
<view class="onecontent_itemrightimges flex-colum" v-if="avatar" @click="chooseImagelist()">
<image :src="avatar"></image>
</view>
<view class="onecontent_itemrightimges flex-colum" v-else @click="chooseImagelist()">
+
</view>
</view>
</view>
<view class="contentitem flex-between">
<text class="contentitemtext">姓名</text>
<input class="contentiteminput" v-model="form.nickname" type="text" placeholder="请输入员工姓名">
</view>
<view class="contentitem flex-between" style="border-radius: 10rpx 10rpx 0 0 ;">
<text class="contentitemtext">账号/手机号</text>
<input class="contentiteminput" v-model="form.mobile" type="text" placeholder="请设置员工账号/手机号">
</view>
<view class="contentitem flex-between" style="border-radius: 10rpx 10rpx 0 0 ; margin-top:32rpx ;">
<text class="contentitemtext">登录密码</text>
<input class="contentiteminput" v-model="form.password" password="false" type="text" placeholder="员工登录密码">
</view>
<view v-if="staff_id" style="font-size: 24rpx; padding: 10rpx 0;">不修改密码请留空</view>
<view class="contentitem flex-between" style="border-radius:0 0 10rpx 10rpx;">
<text class="contentitemtext">确认密码</text>
<input class="contentiteminput" password="false" v-model="form.passwords" type="text" placeholder="再次输入密码">
</view>
<view class="contentitem flex-between" style="border-radius:10rpx; margin-top:32rpx;"
>
<text class="contentitemtext">排序</text>
<u-number-box integer v-model="form.sort"></u-number-box>
</view>
<view v-if="staff_id" class="positionfixed" @click="staffsavestaff">
确认修改
</view>
<view v-else class="positionfixed" @click="staffcreatestaff">
确认创建
</view>
<view class="positionfixeds" @click="staffdeletestaff">
删除员工
</view>
<view class="contentitem flex-between" style="border-radius:10rpx; margin-top:32rpx;"
@click="pickershow = true">
<text class="contentitemtext">全部订单权限</text>
<view class="flex-start">
<view class="contentiteminput">{{nameis_limits}}</view>
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
</view>
</view>
<u-picker :show="pickershow" :columns="columns" @confirm='confirm' keyName="label"
@cancel='pickershow = false'></u-picker>
</view>
</template>
<script>
import uploadImage from "@/js_sdk/yushijie-ossutil/ossutil/uploadFile.js";
import {
nextTick
} from "vue";
export default {
data() {
return {
columns: [
[{
label: '允许',
id: 1
}, {
label: '不允许',
id: 2
}],
],
pickershow: false,
staff_id: '',
avatar: '',
nameis_limits: '允许',
form: {
nickname: '',
mobile: '',
store_id: '',
password: '',
passwords: "",
sort: 1,
is_limits: 1,
avatar: ""
}
}
},
onLoad(e) {
if (e.id) {
uni.setNavigationBarTitle({
title: '修改员工'
})
this.staff_id = e.id
this.staffstaffreturn()
} else {
uni.setNavigationBarTitle({
title: '添加员工'
})
}
},
onShow() {},
methods: {
async staffdeletestaff(){
let res = await this.api.staffdeletestaff({
staff_id:this.staff_id
})
if (res.code == 1) {
uni.showToast({
title: '删除成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 2000);
}
},
confirm(e) {
this.pickershow = false
this.form.is_limits = e.value[0].id
this.nameis_limits = e.value[0].label
console.log(e)
},
//
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/staffadd/',
result => {
this.avatar = ''
this.$nextTick(() => {
this.form.avatar = result
this.avatar = result
uni.hideLoading()
})
}, result => {
uni.hideLoading()
})
},
fail: (res) => {
uni.hideLoading()
}
});
},
async staffstaffreturn() { //
let res = await this.api.staffstaffreturn({
staff_id: this.staff_id,
});
if (res.code == 1) {
this.form = res.data
this.avatar = res.data.avatar
if (this.form.is_limits == 1) {
this.nameis_limits = '允许'
} else {
this.nameis_limits = '不允许'
}
}
},
async staffsavestaff() { //
if (this.form.avatar == null || this.form.avatar == '') {
uni.showToast({
title: '请上传头像',
icon: 'none'
});
return false;
}
if (this.form.nickname == null || this.form.nickname == '') {
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.password != null || this.form.passwords != '' || this.form.password != '' || this.form
.passwords != null) {
if (this.form.password != this.form.passwords) {
uni.showToast({
title: '两次输入密码不相同',
icon: 'none'
});
return false;
}
}
if (this.form.password != this.form.passwords) {
uni.showToast({
title: '两次输入密码不相同',
icon: 'none'
});
return false;
}
if (this.form.sort == null || this.form.sort == '') {
uni.showToast({
title: '请输入排序',
icon: 'none'
});
return false;
}
let res = await this.api.staffsavestaff({
nickname: this.form.nickname,
mobile: this.form.mobile,
staff_id: this.staff_id,
sort: this.form.sort,
is_limits:this.form.is_limits,
avatar:this.form.avatar
});
if (res.code == 1) {
uni.showToast({
title: '修改成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 2000);
}
},
async staffcreatestaff() { //
if (this.form.avatar == null || this.form.avatar == '') {
uni.showToast({
title: '请上传头像',
icon: 'none'
});
return false;
}
if (this.form.nickname == null || this.form.nickname == '') {
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.password == null || this.form.password == '') {
uni.showToast({
title: '请输入密码',
icon: 'none'
});
return false;
}
if (this.form.passwords == null || this.form.passwords == '') {
uni.showToast({
title: '请输入确认密码',
icon: 'none'
});
return false;
}
if (this.form.password != this.form.passwords) {
uni.showToast({
title: '两次输入密码不相同',
icon: 'none'
});
return false;
}
if (this.form.sort == null || this.form.sort == '') {
uni.showToast({
title: '请输入排序',
icon: 'none'
});
return false;
}
let res = await this.api.staffcreatestaff(this.form);
if (res.code == 1) {
uni.showToast({
title: '创建成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 2000);
}
},
}
}
</script>
<style lang="scss">
page {
background: #FBFBFA;
}
.content {
margin: 32rpx 28rpx;
.positionfixeds {
position: fixed;
width: 70%;
bottom: 120rpx;
left: 15%;
padding: 10rpx 0;
text-align: center;
background: #d4d4d4;
font-size: 36rpx;
border-radius: 18rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #707070;
}
.positionfixed {
position: fixed;
width: 70%;
bottom: 40rpx;
left: 15%;
padding: 10rpx 0;
text-align: center;
background: #2F87FD;
font-size: 36rpx;
border-radius: 18rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #FFFFFF;
}
.contentitem {
width: 100%;
padding: 12rpx 16rpx;
border-bottom: 2rpx solid #E5E5E5;
background: #FFFFFF;
.contentitemtext {
font-size: 32rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #333333;
}
.onecontent_itemright {
.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;
}
}
.contentiteminput {
padding-left: 20rpx;
text-align: right;
flex: auto;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
</style>

204
pages/staff/createcap.vue Normal file
View File

@ -0,0 +1,204 @@
<template>
<view class="index">
<view class="title_text">
创建分类
</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="name" maxlength="8" type="text"
placeholder="请输入员工分类">
</view>
</view>
</view>
<view class="thereconse" @click="servicecreateitemclass">
确定
</view>
<view class="title_text">
管理分类
</view>
<view class="onecontent">
<view class="onecontent_item flex-between" v-for="(item,index) in list" :key="index"
@click="contentfixedclick(item)">
<view class="onecontent_itemleft">
{{item.name}}
</view>
<u-icon name="arrow-right" color="#333" size="20"></u-icon>
</view>
</view>
<view v-if="list.length==0 && is_end == true" style="margin-top: 100rpx;width: 100%;" class="flex-colum">
<image src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/nothave.png" mode="">
</image>
</view>
<u-loadmore :status="form.status" />
</view>
</template>
<script>
export default {
data() {
return {
name: '',
list: [],
is_end: false,
form: {
page: 1,
status: 'loadmore',
},
}
},
onReachBottom() {
this.shoppinggooodstype()
},
onShow() {
this.init_fn()
},
methods: {
init_fn() {
this.list = []
this.is_end = false
this.form.page = 1
this.form.status = 'loadmore'
this.shoppinggooodstype()
},
async shoppinggooodstype() {
let res = await this.api.staffemployee({
page:this.form.page
});
if (res.code == 1) {
if (res.data.length == 0) {
this.is_end = true
this.form.status = 'nomore'
return false;
} else {
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.list = [...this.list, ...res.data];
if (res.data.length == 10) {
this.form.status = 'loading';
} else {
this.is_end = true;
this.form.status = 'nomore';
}
}, 500)
}
}
},
contentfixedclick(e) {
// let data = {
// title: e.title,
// goods_type_id: e.id
// }
uni.navigateTo({
url: '/pages/staff/createcapinfo?name=' + e.name +'&goods_type_id='+ e.id
});
},
async servicecreateitemclass() {
let res = await this.api.staffemployeeadd({
name: this.name,
type: 1,
id: ''
});
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;
}
#editor {
width: 100%;
height: 456rpx;
padding: 12rpx 40rpx;
background: #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;
}
.onecontent_itemright_text {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
}
.thereconse {
width: 630rpx;
height: 80rpx;
background: #999999;
border-radius: 40rpx;
font-size: 36rpx;
text-align: center;
margin: 50rpx auto;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
line-height: 80rpx;
background: #6699FF;
border-radius: 16rpx;
}
}
</style>

View File

@ -0,0 +1,161 @@
<template>
<view class="index">
<view class="title_text">
修改分类
</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.name" maxlength="8" type="text"
placeholder="请输入员工分类">
</view>
</view>
</view>
<view class="thereconse" @click="servicecreateitemclass">
确定
</view>
<view class="thereconse thereconsess" @click="shoppingdeletegoodstype">
刪除
</view>
</view>
</template>
<script>
export default {
data() {
return {
form: {
name:'',
goods_type_id:''
},
}
},
onLoad(e) {
this.form.name = e.name
this.form.goods_type_id = e.goods_type_id
},
methods: {
async shoppingdeletegoodstype(){
let res = await this.api.staffemployeedel({
id:this.form.goods_type_id
});
if (res.code == 1) {
uni.showToast({
title: '删除成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
},
async servicecreateitemclass() {
let res = await this.api.staffemployeeadd({
name:this.form.name,
type:2,
id: this.form.goods_type_id
});
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;
}
#editor {
width: 100%;
height: 456rpx;
padding: 12rpx 40rpx;
background: #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;
}
.onecontent_itemright_text {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
}
.thereconse {
width: 630rpx;
height: 80rpx;
background: #999999;
border-radius: 40rpx;
font-size: 36rpx;
text-align: center;
margin: 50rpx auto;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
line-height: 80rpx;
background: #6699FF;
border-radius: 16rpx;
}
.thereconsess{
background:#fc5f69;
}
}
</style>

202
pages/staff/index.vue Normal file
View File

@ -0,0 +1,202 @@
<template>
<view class="content">
<view class="flex-start">
<view class="onecontent_oen flex-start">
<input class="onecontent_oen_input" type="text" v-model="like" placeholder="请输入员工姓名">
<text class="onecontent_oen_text" @click="inif">搜索</text>
</view>
<view class="onecontent_oen_right flex-start" @click="showpickerclick">
<view class="onecontent_oen_rightimageview">员工分类</view>
</view>
</view>
<view class="towcontent">
<view class="towcontentitem flex-between" v-for="(item,index) in list" :key="index"
@click="contentfixedclick(item)">
<view class="towcontentitem_one flex-colum-start">
<text class="towcontentitem_onetext">{{item.nickname}}</text>
<text class="towcontentitem_towtext">{{item.mobile}}</text>
</view>
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
</view>
</view>
<view v-if="list.length==0 && is_end == true" class="flex-colum">
<image style="margin-top:100rpx;"
src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/nothave.png" mode="">
</image>
</view>
<u-loadmore :status="form.status" />
<view class="contentfixed" @click="contentfixedclick">
+
</view>
</view>
</template>
<script>
export default {
data() {
return {
list: [],
is_end: false,
like: '',
form: {
page: 1,
status: 'loadmore',
},
}
},
onShow() {
this.inif()
},
onReachBottom() {
this.stafflist()
},
methods: {
showpickerclick() {
uni.pro.navigateTo('staff/createcap')
},
inif() {
this.list = []
this.is_end = false,
this.form = {
page: 1,
status: 'loadmore',
},
this.stafflist()
},
contentfixedclick(e) {
uni.pro.navigateTo('staff/add', {
id: e.staff_id
})
},
async stafflist() { //
let res = await this.api.stafflist({
like: this.like,
page: this.form.page
});
if (res.code == 1) {
if (res.data.length == 0) {
this.is_end = true
this.form.status = 'nomore'
return false;
} else {
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.list = [...this.list, ...res.data];
if (res.data.length == 10) {
this.form.status = 'loading';
} else {
this.is_end = true;
this.form.status = 'nomore';
}
}, 500)
}
}
},
}
}
</script>
<style lang="scss">
page {
background: #FBFBFA;
}
.content {
margin: 28rpx 30rpx;
position: relative;
top: 0;
right: 0;
.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%;
}
.flex-start {
flex-wrap: nowrap;
.onecontent_oen {
margin: 0 auto;
flex: auto;
height: 70rpx;
border-radius: 36rpx;
border: 2rpx solid #6699FF;
padding-right: 8rpx;
.onecontent_oen_input {
padding-left: 32rpx;
flex: 1;
}
.onecontent_oen_text {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #FFFFFF;
text-align: center;
line-height: 56rpx;
width: 116rpx;
height: 56rpx;
background: #6699FF;
border-radius: 36rpx;
}
}
.onecontent_oen_right {
margin-left: 26rpx;
.onecontent_oen_rightimage {
width: 17.9rpx;
height: 19.34rpx;
}
.onecontent_oen_rightimageview {
text-align: center;
margin-left: 10rpx;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
}
}
}
.towcontent {
width: 100%;
.towcontentitem {
margin-top: 30rpx;
padding-bottom: 14rpx;
border-bottom: 2rpx solid #E5E5E5;
.towcontentitem_one {
font-size: 32rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #000000;
}
.towcontentitem_towtext {
margin-top: 10rpx;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
}
</style>

343
pages/stafflist/index.vue Normal file
View File

@ -0,0 +1,343 @@
<template>
<view class="content">
<view class="contentitem" v-for="(item,index) in list" :key="index">
<view class="onecontentitem flex-start">
<view class="onecontentitemone flex-colum-start">
<image :src="item.user_avatar" mode=""></image>
</view>
<view class="onecontentitemtow flex-colum-start">
<view class="onecontentitemtowone flex-start" @click="makePhoneCall(item.mobile)">
<view class="onecontentitemtowone_text">
{{item.user_nickname}}
</view>
<view class="onecontentitemtowone_phone">
{{item.mobile.replace(/(\d{3})\d{4}(\d{4})/,'$1****$2')}}
</view>
<u-icon name="phone" color="#000" size="18"></u-icon>
</view>
<view class="onecontentitemtowtow">
预约项目{{item.title}}
</view>
<view class="onecontentitemtowthere">
预约时间{{item.time}}
</view>
</view>
</view>
<view class="onecontentitembox flex-center">
<view class="onecontentitemboxone" @click="orderokprebook(item)"
v-if="item.status == 2 || item.status == 0 ||item.status == 1">
确认预约
</view>
<view style="background:#F9F9F9;color:#999999 ;" class="onecontentitemboxone" v-if="item.status == 3">
已预约
</view>
<view class="onecontentitemboxtow" @click="orderrefuseprebook(item)">
拒绝预约
</view>
</view>
</view>
<view class="contentfixed" @click="userlogout">
<image src="@/static/exit.png" mode=""></image>
</view>
<view class="positionfixed flex-between">
<view class="positionfixeditem flex-center positionfixeditems" @click="ange(1)">
<u-icon name="list-dot" color="#2979ff" size="14"></u-icon>
<text class="positionfixedtext">预约列表</text>
</view>
<view class="positionfixeditem flex-center" @click="ange(2)">
<u-icon name="clock" color="#2979ff" size="14"></u-icon>
<text class="positionfixedtext">修改时间</text>
</view>
</view>
<view v-if="list.length==0 && is_end == true" class="flex-colum">
<image style="margin-top:100rpx;"
src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/nothave.png" mode="">
</image>
</view>
<u-loadmore :status="form.status" />
<view :style="{height:height}"></view>
</view>
</template>
<script>
export default {
data() {
return {
height: '',
list: [],
is_end: false,
form: {
page: 1,
status: 'loadmore',
},
}
},
onShow() {
this.infn()
},
onLoad() {
// #ifdef MP-WEIXIN
wx.hideHomeButton()
// #endif
},
mounted() {
var query = uni.createSelectorQuery().in(this).select('.positionfixed')
query.boundingClientRect(ele => {
var that = this;
uni.getSystemInfo({
success(res) {
that.height = ele.height + "px";
that = null;
}
})
}).exec();
},
onReachBottom() {
this.orderreselist()
},
methods: {
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
}
}
}
});
},
infn() {
this.list = []
this.form = {
page: 1,
status: 'loadmore',
},
this.is_end = false
this.orderreselist()
},
makePhoneCall(e) {
uni.makePhoneCall({
phoneNumber: e //
});
},
async orderokprebook(e) {
let res = await this.api.orderokprebook({
order_id: e.id
})
if (res.code == 1) {
uni.showToast({
title: '预约成功',
icon: 'none'
});
this.infn()
}
},
async orderrefuseprebook(e) {
let res = await this.api.orderrefuseprebook({
order_id: e.id,
refuse_str: ''
})
if (res.code == 1) {
uni.showToast({
title: '拒绝成功',
icon: 'none'
});
this.infn()
}
},
async orderreselist() {
let res = await this.api.orderreselist({
page: this.form.page
})
if (res.code == 1) {
if (res.data.length == 0) {
this.is_end = true
this.form.status = 'nomore'
return false;
} else {
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.list = [...this.list, ...res.data];
if (res.data.length == 10) {
this.form.status = 'loading';
} else {
this.is_end = true;
this.form.status = 'nomore';
}
}, 500)
}
}
},
ange(w) {
if (w == 1) {
uni.reLaunch({
url: '/pages/stafflist/index'
})
} else {
uni.reLaunch({
url: '/pages/stafflist/time'
})
}
},
}
}
</script>
<style lang="scss">
page {
background: #F6F6F6;
}
.content {
padding: 32rpx 28rpx 0 28rpx;
.contentitem {
width: 100%;
padding: 24rpx 32rpx;
background: #FFFFFF;
border-radius: 12rpx;
.onecontentitem {
height: 100%;
.onecontentitemone {
height: 100%;
justify-content: flex-start;
image {
width: 72rpx;
height: 72rpx;
}
}
.onecontentitemtow {
margin-left: 14rpx;
height: 100%;
.onecontentitemtowone {
.onecontentitemtowone_text {
font-size: 32rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
}
.onecontentitemtowone_phone {
margin: 0 15rpx;
font-size: 28rpx;
font-family: Roboto-Regular, Roboto;
font-weight: 400;
color: #999999;
}
}
.onecontentitemtowtow {
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
.onecontentitemtowthere {
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
}
}
.onecontentitembox {
margin-top: 32rpx;
.onecontentitemboxone {
background: #2F87FD;
padding: 16rpx 58rpx;
border-radius: 8rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #FFFFFF;
}
.onecontentitemboxtow {
margin-left: 52rpx;
padding: 16rpx 58rpx;
border-radius: 8rpx;
border: 2rpx solid #2F87FD;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #2F87FD;
}
}
}
.contentfixed {
position: fixed;
bottom: 16%;
right: 5%;
font-size: 52rpx;
color: #FFFFFF;
image {
width: 100rpx;
height: 100rpx;
}
// width: 100rpx;
// height: 100rpx;
// line-height: 100rpx;
// text-align: center;
// border-radius: 50%;
}
.positionfixed {
position: fixed;
background: #FFFFFF;
width: 100%;
bottom: 0;
left: 0;
padding: 15rpx;
.positionfixeditems::after {
position: absolute;
content: '';
height: 50rpx;
left: 50%;
border-right: 1rpx solid #999;
}
.positionfixeditem {
padding: 20rpx 0;
text-align: center;
width: 50%;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
.positionfixedtext {
margin-left: 10rpx;
}
}
}
}
</style>

445
pages/stafflist/time.vue Normal file
View File

@ -0,0 +1,445 @@
<template>
<view class="content">
<view class="contentone">
<view class="onecontenttowone flex-start">
<view class="onecontenttowone_one">
选择休息时间
</view>
</view>
<view class="onecontenttowtow flex-between">
<view class="onecontenttowtow_item flex-between">
<view class=" flex-colum" v-for="(item,index) in reservationlist" :key="index"
:class="reservationshow == index ? 'onecontenttowtow_item_ones':'onecontenttowtow_item_one'"
@click="reservation(item,index)">
<text class="onecontenttowtow_item_one_textone">{{item.week}}</text>
<text class="onecontenttowtow_item_one_texttow">{{item.date.slice(5,10)}}</text>
</view>
</view>
<view class="onecontenttowtow_left flex-colum" @click="calendarshow = true">
<u-icon name="calendar" color="#b4b4b4" size="20"></u-icon>
<text class="onecontenttowtow_lefttext">选择</text>
</view>
</view>
<view class="onecontenttowthere flex-start">
<view v-for="(item,index) in listday_time" :key="index" @click="clicktime(item,index)"
:class="item.select?'onecontenttowthere_items':'onecontenttowthere_item'">
{{item.time}}
</view>
</view>
</view>
<view class="contentone" style="margin-top: 40rpx;">
<view class="onecontenttowone flex-start">
<view class="onecontenttowone_one">
我的休息时间
</view>
</view>
<view class="onecontenttowthere flex-start">
<view v-for="(item,index) in listday_xx" :key="index" class="onecontenttowthere_item">
{{item.time}}
</view>
</view>
</view>
<view class="contentbox" @click="staffsavestaffhours">
提交
</view>
<view class="positionfixed flex-between">
<view class="positionfixeditem flex-center positionfixeditems" @click="ange(1)">
<u-icon name="list-dot" color="#2979ff" size="14"></u-icon>
<text class="positionfixedtext">预约列表</text>
</view>
<view class="positionfixeditem flex-center" @click="ange(2)">
<u-icon name="clock" color="#2979ff" size="14"></u-icon>
<text class="positionfixedtext">修改时间</text>
</view>
</view>
<view :style="{height:height}"></view>
<u-calendar mode="single" @confirm="confirm" :show="calendarshow" @close="calendarshow = false"></u-calendar>
</view>
</template>
<script>
export default {
data() {
return {
height: '',
reservationshow: 0,
reservationlist: [],
calendarshow: false,
listday_time: [],
listday_xx: [],
listday_xxxxx: [],
day_time: '', //
day_hour: '', //
}
},
onLoad() {
// #ifdef MP-WEIXIN
wx.hideHomeButton()
// #endif
this.confirm() //
},
onShow() {},
mounted() {
var query = uni.createSelectorQuery().in(this).select('.positionfixed')
query.boundingClientRect(ele => {
var that = this;
uni.getSystemInfo({
success(res) {
that.height = ele.height + "px";
that = null;
}
})
}).exec();
},
methods: {
ange(w) {
if (w == 1) {
uni.reLaunch({
url: '/pages/stafflist/index'
})
} else {
uni.reLaunch({
url: '/pages/stafflist/time'
})
}
},
clicktime(d, p) {
this.listday_time[p].select = !d.select
let res = this.listday_time.filter((num, index) => {
return num.select !== false
})
this.listday_xx = [...this.listday_xxxxx, ...res]
},
reservation(a, b) {
this.reservationshow = b
this.day_time = a.date
this.staffbhoures() //
},
async staffsavestaffhours() { //
let hours_str = this.listday_xx.map(ele => {
return ele.time
});
let res = await this.api.staffsavestaffhours({
day_time: this.day_time,
hours_str: hours_str.toString()
})
if (res.code == 1) {
uni.showToast({
title: '修改成功',
icon: 'none'
});
}
},
async staffbhoures() {
let res = await this.api.staffbhoures({
day_time: this.day_time
})
this.listday_xxxxx = []
if (res.length != 0) {
this.listday_time = res.data.hours
let dataxx = res.data.hours.filter((num, index) => {
return num.select !== false
})
try {
if (res.data.xx.split(",").length > dataxx.length) {
this.listday_xxxxx = res.data.xx.split(",").slice(0, (res.data.xx.split(",").length -
dataxx
.length)).map(ele => {
return {
select: true,
time: ele
}
});
}
} catch (e) {
//TODO handle the exception
}
this.listday_xx = [...this.listday_xxxxx, ...dataxx]
} else {
this.listday_time = []
}
},
confirm(e) {
if (e) {
this.calendarshow = false
console.log(new Date(e[0]));
var now = new Date(e[0]);
} else {
//
var now = new Date();
// var year = now.getFullYear(); //
// var month = now.getMonth() + 1; //
// var date = now.getDate(); //
// data = year + "" + month + "" + date + "";
}
this.reservationlist = []
for (let i = 0; i < 7; i++) {
var date = new Date(now.getTime() + i * 24 * 3600 * 1000);
var year = date.getFullYear();
var month = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : '0' + (date.getMonth() + 1);
var day = (date.getDate()) > 9 ? (date.getDate()) : '0' + (date.getDate());
var dt2 = new Date(now.getTime() + i * 24 * 3600 * 1000);
var weekDay = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
// var weekDays = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"];
this.reservationlist.push({
date: year + "-" + month + "-" + day,
// date: month + "-" + day,
// day: day,
// weekday: weekDays[dt2.getDay()],
week: weekDay[dt2.getDay()],
});
}
this.day_time = this.reservationlist[0].date
this.staffbhoures() //
}
}
}
</script>
<style lang="scss">
page {
background: #F6F6F6;
}
.content {
padding: 32rpx 28rpx 0 28rpx;
.contentbox {
width: 80%;
margin: 40rpx auto;
padding: 24rpx 0;
background: #2F87FD;
font-size: 36rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
text-align: center;
border-radius: 48rpx;
}
.contentone {
background: #FFFFFF;
border-radius: 24rpx;
padding: 32rpx 28rpx;
.onecontenttowone {
.onecontenttowone_one {
font-family: Source Han Sans CN-Bold, Source Han Sans CN;
font-size: 28rpx;
font-weight: 500;
color: #333333;
}
}
.onecontenttowtow {
margin-top: 32rpx;
.onecontenttowtow_item {
flex: 1;
flex-wrap: nowrap;
.onecontenttowtow_item_one:nth-child(1) {
margin: 0 !important;
}
.onecontenttowtow_item_one {
padding: 6rpx;
.onecontenttowtow_item_one_textone {
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
.onecontenttowtow_item_one_texttow {
margin-top: 5rpx;
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
}
.onecontenttowtow_item_ones {
padding: 6rpx;
border-radius: 10rpx;
background: #2f87fd;
.onecontenttowtow_item_one_textone {
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #FFFFFF;
}
.onecontenttowtow_item_one_texttow {
margin-top: 5rpx;
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #FFFFFF;
}
}
}
.onecontenttowtow_left {
border-left: 1rpx solid #f9f9f9;
background: #FFFFFF;
padding-left: 24rpx;
box-shadow: -2rpx 0px 4rpx 2rpx rgba(193, 193, 193, 0.09);
.onecontenttowtow_lefttext {
font-size: 24rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
}
}
.onecontenttowthere {
.onecontenttowthere_item {
width: 20%;
margin: 16rpx 2.5%;
text-align: center;
background: #F7F7F7;
border-radius: 8rpx;
border: 2rpx solid #F7F7F7;
padding: 8rpx 26rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #999999;
}
.onecontenttowthere_items {
width: 20%;
margin: 16rpx 2.5%;
background: #FFFFFF;
border: 2rpx solid #2F87FD;
text-align: center;
border-radius: 8rpx;
padding: 8rpx 26rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #2F87FD;
}
}
}
.contentitem {
width: 100%;
padding: 24rpx 32rpx;
background: #FFFFFF;
border-radius: 12rpx;
.onecontentitem {
height: 100%;
.onecontentitemone {
height: 100%;
justify-content: flex-start;
image {
width: 72rpx;
height: 72rpx;
}
}
.onecontentitemtow {
margin-left: 14rpx;
height: 100%;
.onecontentitemtowone {
.onecontentitemtowone_text {
font-size: 32rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
}
.onecontentitemtowone_phone {
font-size: 28rpx;
font-family: Roboto-Regular, Roboto;
font-weight: 400;
color: #999999;
}
}
.onecontentitemtowtow {
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
.onecontentitemtowthere {
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #999999;
}
}
}
.onecontentitembox {
margin-top: 32rpx;
.onecontentitemboxone {
background: #2F87FD;
padding: 16rpx 58rpx;
border-radius: 8rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #FFFFFF;
}
.onecontentitemboxtow {
margin-left: 52rpx;
padding: 16rpx 58rpx;
border-radius: 8rpx;
border: 2rpx solid #2F87FD;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #2F87FD;
}
}
}
.positionfixed {
position: fixed;
background: #FFFFFF;
width: 100%;
bottom: 0;
left: 0;
padding: 15rpx;
.positionfixeditems::after {
position: absolute;
content: '';
height: 50rpx;
left: 50%;
border-right: 1rpx solid #999;
}
.positionfixeditem {
padding: 20rpx 0;
text-align: center;
width: 50%;
font-size: 28rpx;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
.positionfixedtext {
margin-left: 10rpx;
}
}
}
}
</style>

29
pages/webview/html.vue Normal file
View File

@ -0,0 +1,29 @@
<template>
<view class="content" v-html="src">
</view>
</template>
<script>
export default {
data() {
return {
src: ''
};
},
async onLoad(options) {
let res = await this.api.useruserpolicy();
if (options.src == 1) {
//
this.src = res.data.agreement
} else {
this.src = res.data.policy
}
}
};
</script>
<style scoped>
.content {
padding: 20rpx 30rpx;
}
</style>

55
pages/webview/imge.vue Normal file
View File

@ -0,0 +1,55 @@
<template>
<view class="box flex-colum">
<image src="@/static/logo.png" mode="widthFix"></image>
</view>
</template>
<script>
export default {
data() {
return {
imge: '',
tyte: '',
name: ''
};
},
async onLoad(e) {
this.name = e.name
this.tyte = e.tyte
this.imge = str;
},
methods: {}
};
</script>
<style lang="scss">
page {
background: #f9f9f9;
}
v-deep {
p {
width: 100%;
}
}
.box {
height: 100%;
width: 100%;
image{
margin-top:120rpx;
}
.view {
position: fixed;
width: 50%;
padding: 10rpx;
text-align: center;
bottom: 20rpx;
margin: 0 auto;
background: #3089fd;
border-radius: 50rpx;
color: #fff;
}
}
</style>

16
pages/webview/webview.vue Normal file
View File

@ -0,0 +1,16 @@
<template>
<web-view :src="src"></web-view>
</template>
<script>
export default {
data() {
return {
src: ''
};
},
onLoad(options) {
this.src = options.url;
}
};
</script>

BIN
static/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

BIN
static/exit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
static/icon/my.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
static/icon/mypath.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
static/icon/orderPath.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
static/icon/shopPath.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
static/icon/staffPath.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
static/iconfont.ttf Normal file

Binary file not shown.

BIN
static/img_vipno_vip1-1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Some files were not shown because too many files have changed in this diff Show More