修改文字
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view class="basics-content">
|
||||||
<view class="coupons-preview">
|
<view class="coupons-preview">
|
||||||
<view class="item cover">
|
<view class="item cover">
|
||||||
<view v-if="types[typeIndex].id == 2">
|
<view v-if="types[typeIndex].id == 2">
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="inputs">
|
<view class="inputs">
|
||||||
<label class="input-label">关联商品</label>
|
<label class="input-label">关联商品</label>
|
||||||
<view class="input-text" @click="onSelectGoods">
|
<view class="input-text" @click="onSelectGoods" v-if="coupongoods">
|
||||||
<block v-if="coupongoods.length > 0">已关联{{coupongoods.length}}件商品</block>
|
<block v-if="coupongoods.length > 0">已关联{{coupongoods.length}}件商品</block>
|
||||||
<block v-else>选择关联商品</block>
|
<block v-else>选择关联商品</block>
|
||||||
<uni-icons class="picker-icon" type="arrowdown" size="14" />
|
<uni-icons class="picker-icon" type="arrowdown" size="14" />
|
||||||
@@ -100,9 +100,9 @@
|
|||||||
<label>使用规则</label>
|
<label>使用规则</label>
|
||||||
<textarea :maxlength="-1" v-model="description" placeholder="输入使用规则说明" />
|
<textarea :maxlength="-1" v-model="description" placeholder="输入使用规则说明" />
|
||||||
</view>
|
</view>
|
||||||
<view class="add-btn ios-bottom">
|
<view class="basisc-btn">
|
||||||
<button type="default" @click="updComponent">发布优惠券</button>
|
<button type="default" class="btn" @click="updComponent">发布优惠券</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -234,7 +234,36 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
|
.basics-content{
|
||||||
|
padding-bottom: ($padding*3) + 90;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按钮组
|
||||||
|
.basisc-btn{
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
padding: $padding;
|
||||||
|
background: white;
|
||||||
|
box-shadow: 0 0 4rpx 4rpx rgba($color: #000000, $alpha: .02);
|
||||||
|
.btn {
|
||||||
|
background: $mian-color;
|
||||||
|
color: white;
|
||||||
|
border-radius: 0;
|
||||||
|
font-size: $title-size-lg;
|
||||||
|
line-height: 88rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
&::after {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
&[disabled] {
|
||||||
|
background: rgba($color: $mian-color, $alpha: .6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.add-btn{
|
.add-btn{
|
||||||
padding: $padding;
|
padding: $padding;
|
||||||
button{
|
button{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view class="basics-content">
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="tabs">
|
<view class="tabs">
|
||||||
<view class="item" :class="{'show': listType == ''}" @click="onTabs('')">全部</view>
|
<view class="item" :class="{'show': listType == ''}" @click="onTabs('')">全部</view>
|
||||||
@@ -102,6 +102,10 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.basics-content{
|
||||||
|
padding-bottom: ($padding*3) + 90;
|
||||||
|
}
|
||||||
|
|
||||||
// 按钮组
|
// 按钮组
|
||||||
.basisc-btn{
|
.basisc-btn{
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
|||||||
@@ -56,9 +56,9 @@
|
|||||||
</checkbox-group>
|
</checkbox-group>
|
||||||
</view>
|
</view>
|
||||||
<!-- 按钮 -->
|
<!-- 按钮 -->
|
||||||
<view class="add-btns">
|
<view class="basisc-btn">
|
||||||
<button size="default" @click="onAddEmployees">{{type === 'PUT' ? '修改': '添加'}}</button>
|
<button class="btn" size="default" @click="onAddEmployees">{{type === 'PUT' ? '修改': '添加'}}</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -191,8 +191,34 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
// 按钮组
|
||||||
|
.basisc-btn{
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
padding: $padding;
|
||||||
|
background: white;
|
||||||
|
box-shadow: 0 0 4rpx 4rpx rgba($color: #000000, $alpha: .02);
|
||||||
|
.btn {
|
||||||
|
background: $mian-color;
|
||||||
|
color: white;
|
||||||
|
border-radius: 0;
|
||||||
|
font-size: $title-size-lg;
|
||||||
|
line-height: 88rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
&::after {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
&[disabled] {
|
||||||
|
background: rgba($color: $mian-color, $alpha: .6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.content{
|
.content{
|
||||||
min-height: 100vh;
|
// min-height: 100vh;
|
||||||
|
padding-bottom: ($padding*3) + 90;
|
||||||
@extend .ios-bottom;
|
@extend .ios-bottom;
|
||||||
.title{
|
.title{
|
||||||
padding: ($padding/2) $padding;
|
padding: ($padding/2) $padding;
|
||||||
|
|||||||
@@ -72,16 +72,16 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- 商品详情介绍 -->
|
<!-- 商品详情介绍 -->
|
||||||
<view class="form-block">
|
<view class="form-block">
|
||||||
<view class="form-box picker-flex">
|
<!-- <view class="form-box picker-flex">
|
||||||
<label class="form-label">支持易货</label>
|
<label class="form-label">支持易货</label>
|
||||||
<view class="picker-switch">
|
<view class="picker-switch">
|
||||||
<switch :checked="isChange" color="#e93340" @change="pickerChange($event, 'isChange')"/>
|
<switch :checked="isChange" color="#e93340" @change="pickerChange($event, 'isChange')"/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
<view class="form-box inputs-flex" v-if="isChange">
|
<!-- <view class="form-box inputs-flex" v-if="isChange">
|
||||||
<label class="form-label">最低易货量</label>
|
<label class="form-label">最低易货量</label>
|
||||||
<input type="number" v-model="skus_number" placeholder="输入最低易货量"/>
|
<input type="number" v-model="skus_number" placeholder="输入最低易货量"/>
|
||||||
</view>
|
</view> -->
|
||||||
<view class="form-box inputs-flex">
|
<view class="form-box inputs-flex">
|
||||||
<label class="form-label">发行权证数</label>
|
<label class="form-label">发行权证数</label>
|
||||||
<input type="number" v-model="skus_stock" placeholder="输入商品发行权证数"/>
|
<input type="number" v-model="skus_stock" placeholder="输入商品发行权证数"/>
|
||||||
@@ -398,13 +398,14 @@
|
|||||||
content : this.$Route.query.type === 'edit' ? '商品权证已更新,是否立即补充产品附加信息认证?' : '商品权证已发布,是否立即补充产品附加信息认证?',
|
content : this.$Route.query.type === 'edit' ? '商品权证已更新,是否立即补充产品附加信息认证?' : '商品权证已发布,是否立即补充产品附加信息认证?',
|
||||||
cancelText : '稍后认证',
|
cancelText : '稍后认证',
|
||||||
confirmText : '立即认证',
|
confirmText : '立即认证',
|
||||||
success : res => {
|
success : authRes => {
|
||||||
if(res.cancel){
|
if(authRes.cancel){
|
||||||
this.$Router.back(this.$Route.query.type === 'edit' ? 1 : 2)
|
this.$Router.back(this.$Route.query.type === 'edit' ? 1 : 2)
|
||||||
}
|
}
|
||||||
if(res.confirm){
|
if(authRes.confirm){
|
||||||
let goodsId = this.$Route.query.type === 'edit' ? this.$Route.query.id : res
|
let goodsId = this.$Route.query.type === 'edit' ? this.$Route.query.id : res
|
||||||
this.$Router.push({name: 'goodsAuth', params: { id: goodsId , type: 'goodsAdd', edit: this.$Route.query.type === 'edit'}})
|
console.log(goodsId)
|
||||||
|
this.$Router.push({name: 'goodsAddAuth', params: { id: goodsId , type: 'goodsAdd', edit: this.$Route.query.type === 'edit'}})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
methods:{
|
methods:{
|
||||||
// 选择分类
|
// 选择分类
|
||||||
onCategory(cid){
|
onCategory(cid){
|
||||||
this.$Router.push({name: 'GoodsMagAdd', params: {cid, id: this.category[this.stairIndex].category_id}})
|
this.$Router.push({name: 'goodsAdd', params: {cid, id: this.category[this.stairIndex].category_id}})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,7 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
console.log(this.$Route.query)
|
||||||
if(this.$Route.query.edit == 'true'){
|
if(this.$Route.query.edit == 'true'){
|
||||||
managesGoodsExtends(this.$Route.query.id).then(res => {
|
managesGoodsExtends(this.$Route.query.id).then(res => {
|
||||||
this.productedAt = res.producted_at
|
this.productedAt = res.producted_at
|
||||||
|
|||||||
@@ -47,6 +47,10 @@
|
|||||||
<view class="btn" @click="additionalOrBurning">确认</view>
|
<view class="btn" @click="additionalOrBurning">确认</view>
|
||||||
</view>
|
</view>
|
||||||
</uni-popup>
|
</uni-popup>
|
||||||
|
|
||||||
|
<view class="basisc-btn">
|
||||||
|
<button class="btn" type="default" @click="$Router.push({name: 'goodsaddClassify'})">添加商品权证</button>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -83,7 +87,6 @@
|
|||||||
managesGoodsIndex({
|
managesGoodsIndex({
|
||||||
status: this.status
|
status: this.status
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log(res)
|
|
||||||
this.goods = res.data
|
this.goods = res.data
|
||||||
this.pages = res.page
|
this.pages = res.page
|
||||||
})
|
})
|
||||||
@@ -171,14 +174,44 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onNavigationBarButtonTap() {
|
onNavigationBarButtonTap() {
|
||||||
this.$Router.push({name: 'addClassify'})
|
// this.$Router.push({name: 'addClassify'})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.basics-content{
|
||||||
|
padding-bottom: ($padding*3) + 90;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按钮组
|
||||||
|
.basisc-btn{
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
padding: $padding;
|
||||||
|
background: white;
|
||||||
|
box-shadow: 0 0 4rpx 4rpx rgba($color: #000000, $alpha: .02);
|
||||||
|
.btn {
|
||||||
|
background: $mian-color;
|
||||||
|
color: white;
|
||||||
|
border-radius: 0;
|
||||||
|
font-size: $title-size-lg;
|
||||||
|
line-height: 88rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
&::after {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
&[disabled] {
|
||||||
|
background: rgba($color: $mian-color, $alpha: .6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.content{
|
.content{
|
||||||
padding-top: 90rpx;
|
padding-top: 90rpx;
|
||||||
|
padding-bottom: ($padding*3) + 90;
|
||||||
}
|
}
|
||||||
// tabs
|
// tabs
|
||||||
.tabs{
|
.tabs{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view class="basics-content">
|
||||||
<view class="create-form">
|
<view class="create-form">
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view @click="updLogo">
|
<view @click="updLogo">
|
||||||
@@ -47,10 +47,10 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="create-btns">
|
<view class="basisc-btn">
|
||||||
<button class="item-btn btn-submit" type="default" @click="createShop">{{type === 'add' ? '创建': '保存'}}</button>
|
<button class="add-modules" type="default" @click="onDeleteShop" v-if="type === 'edit'">删除</button>
|
||||||
<button class="item-btn btn-delete" type="default" @click="onDeleteShop" v-if="type === 'edit'">删除</button>
|
<button class="btn" type="default" @click="createShop">{{type === 'add' ? '创建': '保存'}}</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -211,6 +211,55 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.basics-content{
|
||||||
|
padding-bottom: ($padding*3) + 90;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按钮组
|
||||||
|
.basisc-btn{
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
padding: $padding;
|
||||||
|
background: white;
|
||||||
|
margin-top: $margin - 10;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
box-shadow: 0 0 4rpx 4rpx rgba($color: #000000, $alpha: .02);
|
||||||
|
.add-modules{
|
||||||
|
line-height: 86rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
text-align: center;
|
||||||
|
color: $text-price;
|
||||||
|
background: white;
|
||||||
|
width: calc(50% - 15rpx);
|
||||||
|
margin-right: 30rpx;
|
||||||
|
border:solid 1rpx $mian-color;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: $title-size-lg;
|
||||||
|
.icon{
|
||||||
|
margin-right: $margin/3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.btn {
|
||||||
|
background: $mian-color;
|
||||||
|
color: white;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
font-size: $title-size-lg;
|
||||||
|
line-height: 88rpx;
|
||||||
|
height: 88rpx;
|
||||||
|
width: calc(50% - 15rpx);
|
||||||
|
&::after {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&[disabled] {
|
||||||
|
background: rgba($color: $mian-color, $alpha: .6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 门店信息
|
// 门店信息
|
||||||
.create-form{
|
.create-form{
|
||||||
.header{
|
.header{
|
||||||
|
|||||||
@@ -160,7 +160,8 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 开通会员
|
// 开通会员
|
||||||
openOrder(){
|
openOrder(){
|
||||||
|
let can = this.canBtn,
|
||||||
identitiesId = this.identitie[this.tabsIndex].identity_id
|
identitiesId = this.identitie[this.tabsIndex].identity_id
|
||||||
if(this.selected == false) {
|
if(this.selected == false) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -168,11 +169,23 @@
|
|||||||
icon : 'none'
|
icon : 'none'
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
|
}
|
||||||
// 判断是否线上,线下开通 can.on_line=true为线上开通
|
// 判断是否线上,线下开通 can.on_line=true为线上开通
|
||||||
if(can.on_line) {
|
if(can.on_line) {
|
||||||
console.log('微信支付')
|
|
||||||
// 线上开通 - 再一次按断是否续费 can.buy= true为续费
|
// 线上开通 - 再一次按断是否续费 can.buy= true为续费
|
||||||
if(can.buy) {
|
if(can.buy) {
|
||||||
|
// 开通vip提交
|
||||||
|
console.log('开通vip提交')
|
||||||
|
this.vipSubmitr(identitiesId);
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: can.message,
|
||||||
|
icon : 'none'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 线下开通 - 再一次按断是否续费 can.buy= true为续费
|
||||||
|
if(can.buy) {
|
||||||
// 上传凭证
|
// 上传凭证
|
||||||
this.canClick();
|
this.canClick();
|
||||||
} else {
|
} else {
|
||||||
@@ -182,43 +195,41 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
let identitiesId = this.identitie[this.tabsIndex].identity_id
|
|
||||||
|
},
|
||||||
|
// 开通vip提交
|
||||||
|
vipSubmitr(id) {
|
||||||
vipOrder(id,{
|
vipOrder(id,{
|
||||||
year: 1
|
year: 1
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if(!res.test){
|
if(!res.test){
|
||||||
let verifyForm = res
|
let verifyForm = res
|
||||||
this.wechatPay(res.id)
|
this.wechatPay(res.id)
|
||||||
}else{
|
}else{
|
||||||
// 测试环境
|
// 测试环境
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title : '开通提示',
|
title : '开通提示',
|
||||||
content : '会员开通成功,是否继续完成企业认证',
|
content : '会员开通成功,是否继续完成企业认证',
|
||||||
showCancel : true,
|
showCancel : true,
|
||||||
cancelText : '稍后认证',
|
cancelText : '稍后认证',
|
||||||
confirmText : '立即认证',
|
confirmText : '立即认证',
|
||||||
success : modalRes => {
|
success : modalRes => {
|
||||||
if(modalRes.confirm){
|
if(modalRes.confirm){
|
||||||
this.$Router.replace({name: 'Approve'})
|
this.$Router.replace({name: 'Approve'})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.$Router.back()
|
this.$Router.back()
|
||||||
},
|
},
|
||||||
fail(err) {
|
fail(err) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}).catch(err =>{
|
}).catch(err =>{
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: err.message,
|
title: err.message,
|
||||||
icon : 'none'
|
icon : 'none'
|
||||||
})
|
})
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// 轻节点身份-跳转个人认证
|
|
||||||
openUrl() {
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
18
uni_modules/uni-number-box/changelog.md
Normal file
18
uni_modules/uni-number-box/changelog.md
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
## 1.1.1(2021-07-30)
|
||||||
|
- 优化 vue3下事件警告的问题
|
||||||
|
## 1.1.0(2021-07-13)
|
||||||
|
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
|
||||||
|
## 1.0.7(2021-05-12)
|
||||||
|
- 新增 组件示例地址
|
||||||
|
## 1.0.6(2021-04-20)
|
||||||
|
- 修复 uni-number-box 浮点数运算不精确的 bug
|
||||||
|
- 修复 uni-number-box change 事件触发不正确的 bug
|
||||||
|
- 新增 uni-number-box v-model 双向绑定
|
||||||
|
## 1.0.5(2021-02-05)
|
||||||
|
- 调整为uni_modules目录规范
|
||||||
|
|
||||||
|
## 1.0.7(2021-02-05)
|
||||||
|
- 调整为uni_modules目录规范
|
||||||
|
- 新增 支持 v-model
|
||||||
|
- 新增 支持 focus、blur 事件
|
||||||
|
- 新增 支持 PC 端
|
||||||
@@ -0,0 +1,231 @@
|
|||||||
|
<template>
|
||||||
|
<view class="uni-numbox">
|
||||||
|
<view @click="_calcValue('minus')" class="uni-numbox__minus uni-cursor-point">
|
||||||
|
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue <= min || disabled }">-</text>
|
||||||
|
</view>
|
||||||
|
<input :disabled="disabled" @focus="_onFocus" @blur="_onBlur" class="uni-numbox__value" type="number" v-model="inputValue"/>
|
||||||
|
<view @click="_calcValue('plus')" class="uni-numbox__plus uni-cursor-point">
|
||||||
|
<text class="uni-numbox--text" :class="{ 'uni-numbox--disabled': inputValue >= max || disabled }">+</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* NumberBox 数字输入框
|
||||||
|
* @description 带加减按钮的数字输入框
|
||||||
|
* @tutorial https://ext.dcloud.net.cn/plugin?id=31
|
||||||
|
* @property {Number} value 输入框当前值
|
||||||
|
* @property {Number} min 最小值
|
||||||
|
* @property {Number} max 最大值
|
||||||
|
* @property {Number} step 每次点击改变的间隔大小
|
||||||
|
* @property {Boolean} disabled = [true|false] 是否为禁用状态
|
||||||
|
* @event {Function} change 输入框值改变时触发的事件,参数为输入框当前的 value
|
||||||
|
*/
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "UniNumberBox",
|
||||||
|
emits:['change','input','update:modelValue','blur','focus'],
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 1
|
||||||
|
},
|
||||||
|
modelValue:{
|
||||||
|
type: [Number, String],
|
||||||
|
default: 1
|
||||||
|
},
|
||||||
|
min: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
|
max: {
|
||||||
|
type: Number,
|
||||||
|
default: 100
|
||||||
|
},
|
||||||
|
step: {
|
||||||
|
type: Number,
|
||||||
|
default: 1
|
||||||
|
},
|
||||||
|
disabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
inputValue: 0
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
value(val) {
|
||||||
|
this.inputValue = +val;
|
||||||
|
},
|
||||||
|
modelValue(val){
|
||||||
|
this.inputValue = +val;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
if(this.value === 1){
|
||||||
|
this.inputValue = +this.modelValue;
|
||||||
|
}
|
||||||
|
if(this.modelValue === 1){
|
||||||
|
this.inputValue = +this.value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
_calcValue(type) {
|
||||||
|
if (this.disabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const scale = this._getDecimalScale();
|
||||||
|
let value = this.inputValue * scale;
|
||||||
|
let step = this.step * scale;
|
||||||
|
if (type === "minus") {
|
||||||
|
value -= step;
|
||||||
|
if (value < (this.min * scale)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (value > (this.max * scale)) {
|
||||||
|
value = this.max * scale
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === "plus") {
|
||||||
|
value += step;
|
||||||
|
if (value > (this.max * scale)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (value < (this.min * scale)) {
|
||||||
|
value = this.min * scale
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.inputValue = (value / scale).toFixed(String(scale).length - 1);
|
||||||
|
this.$emit("change", +this.inputValue);
|
||||||
|
// TODO vue2 兼容
|
||||||
|
this.$emit("input", +this.inputValue);
|
||||||
|
// TODO vue3 兼容
|
||||||
|
this.$emit("update:modelValue", +this.inputValue);
|
||||||
|
},
|
||||||
|
_getDecimalScale() {
|
||||||
|
|
||||||
|
let scale = 1;
|
||||||
|
// 浮点型
|
||||||
|
if (~~this.step !== this.step) {
|
||||||
|
scale = Math.pow(10, String(this.step).split(".")[1].length);
|
||||||
|
}
|
||||||
|
return scale;
|
||||||
|
},
|
||||||
|
_onBlur(event) {
|
||||||
|
this.$emit('blur', event)
|
||||||
|
let value = event.detail.value;
|
||||||
|
if (!value) {
|
||||||
|
// this.inputValue = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
value = +value;
|
||||||
|
if (value > this.max) {
|
||||||
|
value = this.max;
|
||||||
|
} else if (value < this.min) {
|
||||||
|
value = this.min;
|
||||||
|
}
|
||||||
|
const scale = this._getDecimalScale();
|
||||||
|
this.inputValue = value.toFixed(String(scale).length - 1);
|
||||||
|
this.$emit("change", +this.inputValue);
|
||||||
|
this.$emit("input", +this.inputValue);
|
||||||
|
},
|
||||||
|
_onFocus(event) {
|
||||||
|
this.$emit('focus', event)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
$box-height: 35px;
|
||||||
|
/* #ifdef APP-NVUE */
|
||||||
|
$box-line-height: 35px;
|
||||||
|
/* #endif */
|
||||||
|
$box-line-height: 26px;
|
||||||
|
$box-width: 35px;
|
||||||
|
|
||||||
|
.uni-numbox {
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
/* #endif */
|
||||||
|
flex-direction: row;
|
||||||
|
height: $box-height;
|
||||||
|
line-height: $box-height;
|
||||||
|
width: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-cursor-point {
|
||||||
|
/* #ifdef H5 */
|
||||||
|
cursor: pointer;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-numbox__value {
|
||||||
|
background-color: $uni-bg-color;
|
||||||
|
width: 50px;
|
||||||
|
height: $box-height;
|
||||||
|
text-align: center;
|
||||||
|
font-size: $uni-font-size-lg;
|
||||||
|
border-width: 1rpx;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: $uni-border-color;
|
||||||
|
border-left-width: 0;
|
||||||
|
border-right-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-numbox__minus {
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
/* #endif */
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: $box-width;
|
||||||
|
height: $box-height;
|
||||||
|
// line-height: $box-line-height;
|
||||||
|
// text-align: center;
|
||||||
|
font-size: 20px;
|
||||||
|
color: $uni-text-color;
|
||||||
|
background-color: $uni-bg-color-grey;
|
||||||
|
border-width: 1rpx;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: $uni-border-color;
|
||||||
|
border-top-left-radius: $uni-border-radius-base;
|
||||||
|
border-bottom-left-radius: $uni-border-radius-base;
|
||||||
|
border-right-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-numbox__plus {
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
/* #endif */
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: $box-width;
|
||||||
|
height: $box-height;
|
||||||
|
border-width: 1rpx;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: $uni-border-color;
|
||||||
|
border-top-right-radius: $uni-border-radius-base;
|
||||||
|
border-bottom-right-radius: $uni-border-radius-base;
|
||||||
|
background-color: $uni-bg-color-grey;
|
||||||
|
border-left-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-numbox--text {
|
||||||
|
font-size: 20px;
|
||||||
|
color: $uni-text-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-numbox--disabled {
|
||||||
|
color: $uni-text-color-disable;
|
||||||
|
/* #ifdef H5 */
|
||||||
|
cursor: not-allowed;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
</style>
|
||||||
81
uni_modules/uni-number-box/package.json
Normal file
81
uni_modules/uni-number-box/package.json
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
{
|
||||||
|
"id": "uni-number-box",
|
||||||
|
"displayName": "uni-number-box 数字输入框",
|
||||||
|
"version": "1.1.1",
|
||||||
|
"description": "NumberBox 带加减按钮的数字输入框组件,用户可以控制每次点击增加的数值,支持小数。",
|
||||||
|
"keywords": [
|
||||||
|
"uni-ui",
|
||||||
|
"uniui",
|
||||||
|
"数字输入框"
|
||||||
|
],
|
||||||
|
"repository": "https://github.com/dcloudio/uni-ui",
|
||||||
|
"engines": {
|
||||||
|
"HBuilderX": ""
|
||||||
|
},
|
||||||
|
"directories": {
|
||||||
|
"example": "../../temps/example_temps"
|
||||||
|
},
|
||||||
|
"dcloudext": {
|
||||||
|
"category": [
|
||||||
|
"前端组件",
|
||||||
|
"通用组件"
|
||||||
|
],
|
||||||
|
"sale": {
|
||||||
|
"regular": {
|
||||||
|
"price": "0.00"
|
||||||
|
},
|
||||||
|
"sourcecode": {
|
||||||
|
"price": "0.00"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contact": {
|
||||||
|
"qq": ""
|
||||||
|
},
|
||||||
|
"declaration": {
|
||||||
|
"ads": "无",
|
||||||
|
"data": "无",
|
||||||
|
"permissions": "无"
|
||||||
|
},
|
||||||
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||||
|
},
|
||||||
|
"uni_modules": {
|
||||||
|
"dependencies": [],
|
||||||
|
"encrypt": [],
|
||||||
|
"platforms": {
|
||||||
|
"cloud": {
|
||||||
|
"tcb": "y",
|
||||||
|
"aliyun": "y"
|
||||||
|
},
|
||||||
|
"client": {
|
||||||
|
"App": {
|
||||||
|
"app-vue": "y",
|
||||||
|
"app-nvue": "y"
|
||||||
|
},
|
||||||
|
"H5-mobile": {
|
||||||
|
"Safari": "y",
|
||||||
|
"Android Browser": "y",
|
||||||
|
"微信浏览器(Android)": "y",
|
||||||
|
"QQ浏览器(Android)": "y"
|
||||||
|
},
|
||||||
|
"H5-pc": {
|
||||||
|
"Chrome": "y",
|
||||||
|
"IE": "y",
|
||||||
|
"Edge": "y",
|
||||||
|
"Firefox": "y",
|
||||||
|
"Safari": "y"
|
||||||
|
},
|
||||||
|
"小程序": {
|
||||||
|
"微信": "y",
|
||||||
|
"阿里": "y",
|
||||||
|
"百度": "y",
|
||||||
|
"字节跳动": "y",
|
||||||
|
"QQ": "y"
|
||||||
|
},
|
||||||
|
"快应用": {
|
||||||
|
"华为": "u",
|
||||||
|
"联盟": "u"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
50
uni_modules/uni-number-box/readme.md
Normal file
50
uni_modules/uni-number-box/readme.md
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
|
||||||
|
|
||||||
|
## NumberBox 数字输入框
|
||||||
|
> **组件名:uni-number-box**
|
||||||
|
> 代码块: `uNumberBox`
|
||||||
|
|
||||||
|
|
||||||
|
带加减按钮的数字输入框。
|
||||||
|
|
||||||
|
### 安装方式
|
||||||
|
|
||||||
|
本组件符合[easycom](https://uniapp.dcloud.io/collocation/pages?id=easycom)规范,`HBuilderX 2.5.5`起,只需将本组件导入项目,在页面`template`中即可直接使用,无需在页面中`import`和注册`components`。
|
||||||
|
|
||||||
|
如需通过`npm`方式使用`uni-ui`组件,另见文档:[https://ext.dcloud.net.cn/plugin?id=55](https://ext.dcloud.net.cn/plugin?id=55)
|
||||||
|
|
||||||
|
### 基本用法
|
||||||
|
|
||||||
|
在 ``template`` 中使用组件
|
||||||
|
|
||||||
|
```html
|
||||||
|
<uni-number-box></uni-number-box>
|
||||||
|
<uni-number-box v-model = "vModelValue" />
|
||||||
|
<uni-number-box :min="0" :max="9"></uni-number-box>
|
||||||
|
<uni-number-box @change="bindChange"></uni-number-box>
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### NumberBox Props
|
||||||
|
|
||||||
|
|属性名 |类型 |默认值 |说明 |
|
||||||
|
|:-: |:-: |:-: |:-: |
|
||||||
|
|value/v-model|Number |0 |输入框当前值 |
|
||||||
|
|min |Number |0 |最小值 |
|
||||||
|
|max |Number |100 |最大值 |
|
||||||
|
|step |Number |1 |每次点击改变的间隔大小 |
|
||||||
|
|disabled |Boolean|false |是否为禁用状态 |
|
||||||
|
|
||||||
|
### NumberBox Events
|
||||||
|
|
||||||
|
|事件名称 |说明 |返回值 |
|
||||||
|
|:-: |:-: |:-: |
|
||||||
|
|change |输入框值改变时触发的事件,参数为输入框当前的 value |- |
|
||||||
|
|focus |输入框聚焦时触发的事件,参数为 event 对象 |- |
|
||||||
|
|blur |输入框失焦时触发的事件,参数为 event 对象 |- |
|
||||||
|
|
||||||
|
|
||||||
|
## 组件示例
|
||||||
|
|
||||||
|
点击查看:[https://hellouniapp.dcloud.net.cn/pages/extUI/number-box/number-box](https://hellouniapp.dcloud.net.cn/pages/extUI/number-box/number-box)
|
||||||
Reference in New Issue
Block a user