Browse Source

合并修改

master
杨豪 3 years ago
parent
commit
c0e156747c
  1. 1
      App.vue
  2. 12
      api/user.js
  3. 66
      components/sSwiper.vue
  4. 99
      components/vSwiper.vue
  5. 4
      config/index.js
  6. 3
      main.js
  7. 85
      pages/demandHall/resourcesDetail/index.vue
  8. 1
      pages/home/index.vue
  9. 89
      pages/life/addGoods/index.vue
  10. 2
      pages/life/index.vue
  11. 105
      pages/life/temp/index.vue
  12. 48
      pages/life/tempList/index.vue
  13. 11
      pages/order/OrderSubmission/index.vue
  14. 18
      pages/shop/GoodsCon/index.vue
  15. 482
      pages/user/agreement/index.vue
  16. 11
      pages/user/goodsManage/index.vue
  17. 7
      pages/user/index.vue
  18. 2
      pages/user/openStore/index.vue
  19. BIN
      static/images/edit-icon.png
  20. 22
      uni_modules/uni-badge/changelog.md
  21. 253
      uni_modules/uni-badge/components/uni-badge/uni-badge.vue
  22. 88
      uni_modules/uni-badge/package.json
  23. 58
      uni_modules/uni-badge/readme.md

1
App.vue

@ -251,7 +251,6 @@ export default {
setMenuHeight() {
uni.getSystemInfo({
success: res => {
console.log(res);
this.globalData.navTopHeight = res.statusBarHeight;
this.globalData.CustomBar = res.statusBarHeight + 45;
this.globalData.systemInfo = res;

12
api/user.js

@ -31,6 +31,12 @@ export function addTemp(data) {
login: true,
})
}
//删除运费模板
export function delTemp(data) {
return request.delete('/user/shippingtemplate?ids=' + data, {
login: true,
})
}
//获取运费模板列表
export function getTempList(data) {
@ -38,6 +44,12 @@ export function getTempList(data) {
login: true,
})
}
//获取运费模板详情
export function getTempDetail(data) {
return request.get('/user/shippingtemplate/getTemplatesDetail?id='+data, {
login: true,
})
}
/**
* 用户登录

66
components/sSwiper.vue

@ -0,0 +1,66 @@
<template>
<swiper class="swiper-block" autoplay="true" circular="true" previous-margin="90rpx" next-margin="90rpx" current="0" @change="swiperChange">
<block v-for="(item, index) in imgs" :key="index">
<swiper-item class="swiper-item" :class="(swiperIndex == index ? 'active' : '')" @tap="previewImg">
<image mode="aspectFill" :src="item" :class="'slide-image ' + (swiperIndex == index ? 'active' : '')"></image>
</swiper-item>
</block>
</swiper>
</template>
<script>
export default{
props: {
imgs: {
type: Array,
default: []
}
},
data(){
return {
swiperIndex: 0
}
},
methods: {
swiperChange(e) {
const that = this;
that.setData({
swiperIndex: e.detail.current
});
},
previewImg() {
uni.previewImage({
urls: this.imgs
});
}
}
}
</script>
<style lang="less">
.swiper-block {
height: 300rpx;
width: 100%;
}
.swiper-item {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
overflow: unset;
}
.slide-image {
height: 250rpx;
width: 520rpx;
border-radius: 9rpx;
margin: 0rpx 30rpx;
z-index: 1;
}
.active {
transform: scale(1.14);
transition: all 0.2s ease-in 0s;
z-index: 20;
}
</style>

99
components/vSwiper.vue

@ -0,0 +1,99 @@
<template>
<swiper class="swiper-block" vertical="true" circular="true" previous-margin="90rpx" next-margin="90rpx" current="0" @change="swiperChange">
<block v-for="(item, index) in imgs" :key="index">
<swiper-item class="swiper-item" :class="(swiperIndex == index ? 'active' : '')" @tap="previewImg">
<view class="item-box" :class="(swiperIndex == index ? 'active' : '')">
<image mode="aspectFill" :src="item" class="slide-image"></image>
<view class="content-box">
<view class="title-box">标题标题标题标题标题</view>
<view class="content acea-row">
<view>云快讯</view>
<view>3小时钱</view>
<view>300阅读</view>
</view>
</view>
</view>
</swiper-item>
</block>
</swiper>
</template>
<script>
export default{
props: {
imgs: {
type: Array,
default: []
}
},
data(){
return {
swiperIndex: 0
}
},
methods: {
swiperChange(e) {
const that = this;
that.setData({
swiperIndex: e.detail.current
});
},
previewImg() {
uni.previewImage({
urls: this.imgs
});
}
}
}
</script>
<style lang="less">
.swiper-block {
width: 670rpx;
height: 300rpx;
margin: 60rpx auto;
}
.swiper-item {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
overflow: unset;
}
.item-box{
width: 622rpx;
height: 200rpx;
position: relative;
border-radius: 20rpx;
}
.slide-image {
width: 100%;
height: 100%;
z-index: 1;
border-radius: 20rpx;
}
.content-box{
position: absolute;
bottom: 20rpx;
left: 20rpx;
color: #0081FF;
z-index: 5;
}
.title-box{
font-size: 32rpx;
font-weight: 500;
color: #fff;
}
.content{
color: #fff;
font-size: 26rpx;
}
.active {
transform: scale(1.02);
transition: all 0.2s ease-in 0s;
border-radius: 20rpx;
z-index: 20;
}
</style>

4
config/index.js

@ -1,8 +1,8 @@
// export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api';
// export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api'
// export const VUE_APP_API_URL = 'http://192.168.0.112:8092/api'
// export const VUE_APP_API_URL = 'http://192.168.0.111:8092/api'
export const VUE_APP_API_URL = 'https://cloud.api.cyjyyjy.com/api'
export const VUE_APP_API_URL = 'http://192.168.0.111:8092/api'
// export const VUE_APP_API_URL = 'https://cloud.api.cyjyyjy.com/api'
// export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api';
// export const VUE_APP_API_URL = 'https://thapi.xinxintuan.co/api'
// export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';

3
main.js

@ -45,6 +45,9 @@ Object.defineProperty(Vue.prototype, '$yroute', {
},
})
console.log(Vue.prototype)
console.log(Object.getPrototypeOf(Vue))
let deviceType = ''
// #ifdef APP-PLUS
// App平台编译的代码

85
pages/demandHall/resourcesDetail/index.vue

@ -49,13 +49,8 @@
</view>
</view>
<view>
<swiper class="swiper-block" autoplay="true" circular="true" previous-margin="90rpx" next-margin="90rpx" current="0" @change="swiperChange">
<block v-for="(item, index) in detail.resourceImgs" :key="index">
<swiper-item class="swiper-item" @tap="previewImg">
<image mode="aspectFill" :src="item" :class="'slide-image ' + (swiperIndex == index ? 'active' : '')"></image>
</swiper-item>
</block>
</swiper>
<sSwiper :imgs="detail.resourceImgs"></sSwiper>
<vSwiper :imgs="detail.resourceImgs"></vSwiper>
</view>
<view class="btn-box">
<view class="contact-btn" @tap="toResourcesContact">立即沟通</view>
@ -66,7 +61,8 @@
<script>
// pages/demandHall/resourcesDetail/index.js
const app = getApp();
import sSwiper from '@/components/sSwiper.vue'
import vSwiper from '@/components/vSwiper.vue'
export default {
data() {
return {
@ -75,8 +71,7 @@ export default {
swiperIndex: 0
};
},
components: {},
components: { sSwiper, vSwiper },
props: {},
/**
@ -88,37 +83,6 @@ export default {
});
this.getDetail();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
/**
* 用户点击右上角分享
*/
@ -175,20 +139,6 @@ export default {
}
});
},
swiperChange(e) {
const that = this;
that.setData({
swiperIndex: e.detail.current
});
},
previewImg() {
uni.previewImage({
urls: this.detail.resourceImgs
});
}
}
};
</script>
@ -324,29 +274,4 @@ export default {
color: #707070;
line-height: 40rpx;
}
.swiper-block {
height: 300rpx;
width: 100%;
}
.swiper-item {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
overflow: unset;
}
.slide-image {
height: 250rpx;
width: 520rpx;
border-radius: 9rpx;
margin: 0rpx 30rpx;
z-index: 1;
}
.active {
transform: scale(1.14);
transition: all 0.2s ease-in 0s;
z-index: 20;
}
</style>

1
pages/home/index.vue

@ -231,6 +231,7 @@ export default {
}
},
onLoad() {
uni.hideTabBar();
// app.globalData.editTabbar();
this.pagePath = '/pages/home/index'

89
pages/life/addGoods/index.vue

@ -89,7 +89,7 @@
<image src="../../../static/images/arror-r-s.png"></image>
</view>
</view>
<view class="temp-box goods-state acea-row row-between-wrapper">
<!-- <view class="temp-box goods-state acea-row row-between-wrapper">
<text>商品状态</text>
<view class="acea-row row-middle">
<radio-group @change="radioChange">
@ -101,7 +101,7 @@
</label>
</radio-group>
</view>
</view>
</view> -->
<view class="btn-box">
<view class="btn" @tap="submit">提交</view>
</view>
@ -237,6 +237,8 @@
this.attrArr = info.items
this.spec_type = 1
this.isShow = info.is_show
this.tempId = info.shippingTemplatesDto.id
this.temp = info.name
let strArr = info.items.map(item=>{
return item.value
})
@ -291,6 +293,9 @@
this.addOptionsDialog = true
},
delAttr(i){
if(this.attrArr.length == 1){
return this.alertMessage('至少有一个规格')
}
this.attrArr.splice(i,1)
this.getFormatAttr()
},
@ -303,19 +308,19 @@
///
submitAddAttr(){
if(this.attr.value == ''){
return uni.showToast({
title: '请填写属性名称!',
icon: 'none'
})
return this.alertMessage('请填写属性名称','none')
}
try{
var o = this.attr.detail;
if(o.length == 0){
throw "请至少填写一个属性值!";
}
o.forEach(function(item,index) {
if(item == ""){
throw "属性规格不能为空!";
throw "属性不能为空!";
}
});
}catch(e){
} catch(e){
uni.showToast({
title: e,
icon: 'none'
@ -337,19 +342,13 @@
if(res.success){
this.$set(this.batchData,'priceArr',res.data.value)
if(res.data.attr){
let strArr = res.data.attr.map(item=>{
return item.value
})
let strArr = res.data.attr.map(item=> item.value)
this.$set(this.batchData,'titleStr',strArr.join('/'))
} else{
this.$set(this.batchData,'titleStr','')
}
} else{
uni.showToast({
title: res.msg,
icon: 'none'
})
this.alertMessage(res.msg)
}
})
},
@ -391,7 +390,6 @@
} else{
this.attrValTitle = '批量修改规格'
}
this.showAttrVal= true
},
cancelClick(){
@ -400,7 +398,7 @@
},
submitClick(){
const idx = this.idx
console.log(this.price,this.ot_price,this.stock)
// console.log(this.price,this.ot_price,this.stock)
if(this.stock == 0){
return this.alertMessage('商品库存不能为0')
}
@ -414,9 +412,6 @@
this.$set(this.batchData.priceArr[idx],'price',this.price)
this.$set(this.batchData.priceArr[idx],'ot_price',this.ot_price)
this.$set(this.batchData.priceArr[idx],'stock',this.stock)
// this.batchData.priceArr[idx].price= this.price
// this.batchData.priceArr[idx].ot_price= this.ot_price
// this.batchData.priceArr[idx].stock= this.stock
}
this.showAttrVal= false
},
@ -436,77 +431,59 @@
isShow: this.isShow,
items: this.items
}
console.log(form.slider_image[0])
if(form.store_name == ''){
this.alertMessage('请填写商品名称')
return
} else if(form.slider_image[0] == ''){
this.alertMessage('请至少上传一张商品图片')
return
return this.alertMessage('请填写商品名称','none')
} else if(form.slider_image[0]){
return this.alertMessage('请至少上传一张商品图片','none')
} else if(form.description == ''){
this.alertMessage('请填写商品详情')
return
return this.alertMessage('请填写商品详情','none')
} else if(form.description == ''){
this.alertMessage('请填写商品详情')
return
return this.alertMessage('请填写商品详情','none')
}
form.attrs.forEach((item,index)=>{
if(item.price == '' || item.price == 0){
this.alertMessage('请商品规格价格')
return
return this.alertMessage('请商品规格价格','none')
} else if(item.stock == '' || item.stock == 0){
this.alertMessage('库存不能为0')
return
return this.alertMessage('商品规格库存不能为0','none')
}
})
if(this.id != ''){
form.id = this.id
form.spec_type = this.spec_type
console.log(form)
editProduct(form).then((res)=>{
if(res.success){
uni.showToast({
title: res.msg,
duration: 1500
})
this.alertMessage(res.msg,'success')
setTimeout((res)=>{
uni.redirectTo({
url: '/pages/user/goodsManage/index'
url: '/pages/user/goodsManage/index?type=' + 0
});
},1500)
} else{
uni.showToast({
title: res.msg,
icon: 'none'
})
this.alertMessage(res.msg,'none')
}
})
} else{
form.spec_type = this.batchData.priceArr.length > 1 ? 1 : 0
console.log(form)
addProduct(form).then((res)=>{
if(res.success){
uni.showToast({
title: res.msg,
duration: 1500
})
this.alertMessage(res.msg,'success')
setTimeout((res)=>{
uni.redirectTo({
url: '/pages/user/goodsManage/index'
url: '/pages/user/goodsManage/index?type=' + 0
});
},1500)
} else{
uni.showToast({
title: res.msg,
icon: 'none'
})
this.alertMessage(res.msg,'none')
}
})
}
},
alertMessage(msg){
alertMessage(msg,type){
uni.showToast({
title: msg,
icon: 'none'
icon: type,
duration: 1500
})
}
}

2
pages/life/index.vue

@ -179,7 +179,7 @@ export default {
} else{
this.flowList = res.data
}
this.isLoad = this.limit <= res.data.length
// this.isLoad = this.limit <= res.data.length
if(this.limit <= res.data.length){ //length
this.isLoad = true
} else{

105
pages/life/temp/index.vue

@ -22,9 +22,9 @@
<view class="step-freight-box">
<view class="acea-row row-between">
<view>阶梯运费</view>
<switch :checked="setpFreight" color="#FF6D31" style="transform:scale(0.7)" @change="switchChange" />
<switch :checked="templateList[0]" color="#FF6D31" style="transform:scale(0.7)" @change="switchChange" />
</view>
<view class="step-box" v-show="setpFreight">
<view class="step-box" v-show="templateList[0]">
<view class="acea-row row-middle row-center">
<input class="inp-price" type="text" v-model="templateList[0].first" />
<text>{{type == 0 ? '件' : 'kg' }}()</text>
@ -87,76 +87,8 @@
const app = getApp();
import selectTree from "@/components/select-tree/select-tree"
import tkiTree from "@/components/tki-tree/tki-tree.vue"
import { getCity, citys, addTemp } from "@/api/user";
import { getCity, citys, addTemp, getTempDetail } from "@/api/user";
let testList = [
{
city_id: 1,
id: 1,
isShow: 1,
lat: "39.904030",
level: 0,
lng: "116.407526",
mergerName: "北京",
name: "北京市",
parentId: 0,
children: [
{
areaCode: "110100000000",
children: null,
city_id: 2,
id: 35,
isShow: 1,
lat: "39.904030",
level: 1,
lng: "116.407526",
mergerName: "北京",
name: "北京市",
parentId: 1,
},
]
},
{
areaCode: "130000000000",
children: [
{
areaCode: "130100000000",
children: null,
city_id: 13268,
id: 37,
isShow: 1,
lat: "38.042306",
level: 1,
lng: "114.514859",
mergerName: "河北,石家庄",
name: "石家庄市",
parentId: 13267,
},
{
areaCode: "130200000000",
children: null,
city_id: 18128,
id: 38,
isShow: 1,
lat: "39.630867",
level: 1,
lng: "118.180193",
mergerName: "河北,唐山",
name: "唐山市",
parentId: 13267,
}
],
city_id: 13267,
id: 3,
isShow: 1,
lat: "38.037057",
level: 0,
lng: "114.468664",
mergerName: "河北",
name: "河北省",
parentId: 0,
}
]
var g = [
{
region: [
@ -182,17 +114,36 @@ export default {
name: "",
type:0,
setpFreight: false,
list: testList,
templateList: g
list: [],
templateList: g,
id: null
};
},
mounted(){
if(this.$yroute.query.id){
this.id = this.$yroute.query.id
this.getTempDetail(this.$yroute.query.id)
}
citys().then((res)=>{
let data = res.data;
this.list = data
})
},
methods: {
getTempDetail(id){
getTempDetail(id).then((res)=>{
if(res.success){
this.name= res.data.name
this.type= res.data.type
this.templateList = res.data.region_info
this.templateList.forEach((item)=>{
item.setpFreight = true
})
} else{
this.alertMessage(res.msg)
}
})
},
radioChange(e){
this.type = e.detail.value
},
@ -208,13 +159,13 @@ export default {
this.$refs.tkitree._show();
},
delTempItem(idx){
console.log(idx)
this.templateList.splice(idx,1)
},
//
treeConfirm(e) {
// console.log(e,'')
// console.log(this.list,'')
console.log(e,'确认')
console.log(this.list,'列表')
if(e.length == 0) return
let list = this.list;
let selectCity = e;
let selectName = [];
@ -260,13 +211,13 @@ export default {
//
treeCancel(e) {
console.log(e)
},
submit(){
let form = {}
form.name = this.name
form.type = this.type
form.region_info = this.templateList
form.id = this.id
if(form.name == '' ){
return this.alertMessage('请填写模板名字')

48
pages/life/tempList/index.vue

@ -5,8 +5,13 @@
<view class="temp-name">
{{index + 1}}{{item.name}}
</view>
<view class="handle-btn" @tap.stop="del(item)">
<image src="../../../static/images/del-goods.png"></image>
<view class="acea-row row-middle">
<view class="handle-btn" @tap.stop="del(item)">
<image src="../../../static/images/del-goods.png"></image>
</view>
<view class="handle-btn" @tap.stop="edit(item)">
<image src="../../../static/images/edit-icon.png"></image>
</view>
</view>
</view>
</view>
@ -15,7 +20,7 @@
</template>
<script>
import { getTempList } from '@/api/user'
import { getTempList, delTemp } from '@/api/user'
export default{
data(){
return {
@ -46,7 +51,24 @@
}
},
del(item){
let id = [item.id]
if(item.id == 1) return uni.showToast({ title: '默认模板不可删除!', icon:'none', })
uni.showModal({
title: '提示!',
content: '是否确认删除运费模板?',
success: (r) => {
if(r.confirm){
delTemp(id).then((res)=>{
if(res.success){
this.alertMessage('操作成功!')
this.getTempList()
} else{
this.alertMessage(res.msg)
}
})
}
}
})
},
getTempList(){
getTempList().then((res)=>{
@ -59,6 +81,17 @@
uni.navigateTo({
url:'/pages/life/temp/index'
})
},
edit(item){
uni.navigateTo({
url:'/pages/life/temp/index?id='+ item.id
})
},
alertMessage(msg){
uni.showToast({
title: msg,
icon: 'none'
})
}
}
}
@ -94,9 +127,12 @@
}
.handle-btn{
margin-left: 12rpx;
width: 38rpx;
height: 100%;
text-align: center;
image{
width: 29rpx;
height: 29rpx;
width: 35rpx;
height: 35rpx;
}
}
}

11
pages/order/OrderSubmission/index.vue

@ -67,7 +67,7 @@
</view>
</view>
</view> -->
<view class="item acea-row row-between-wrapper" v-if="!isIntegral && deduction === false && enableIntegral === true">
<!-- <view class="item acea-row row-between-wrapper" v-if="!isIntegral && deduction === false && enableIntegral === true">
<view>当前积分</view>
<view class="discount">
<view class="select-btn">
@ -80,12 +80,13 @@
</view>
</view>
</view>
</view>
</view> -->
<view class="item acea-row row-between-wrapper" v-if="shipping_type === 0">
<view>快递费用</view>
<view class="discount">
<!-- <view class="discount">
{{ orderGroupInfo.priceGroup.storePostage > 0 ? orderGroupInfo.priceGroup.storePostage : '免运费' }}
</view>
</view> -->
<view class="discount">{{ orderPrice.payPostage }}</view>
</view>
<view v-if="shipping_type === 1">
<view class="item acea-row row-between-wrapper">
@ -137,7 +138,7 @@
</view>
<view class="item acea-row row-between-wrapper" v-if="orderPrice.payPostage > 0 && !isIntegral">
<view>运费</view>
<view class="money">{{ orderPrice.payPostage }}</view>
<view class="money" v-if="Number(orderPrice.payPostage) > 0">{{ orderPrice.payPostage }}</view>
</view>
<view class="item acea-row row-between-wrapper" v-if="orderPrice.couponPrice > 0 && !isIntegral">
<view>优惠券抵扣</view>

18
pages/shop/GoodsCon/index.vue

@ -23,8 +23,8 @@
<view class="introduce">{{ storeInfo.storeName }}</view>
<view class="label acea-row row-between-wrapper">
<!-- <text v-if="!isIntegral">原价:{{ storeInfo.otPrice }}</text> -->
<text>库存:{{ storeInfo.stock }}{{ storeInfo.unitName }}</text>
<text>已售:{{ storeInfo.sales }}{{ storeInfo.unitName }}</text>
<text>库存:{{ storeInfo.stock }}</text>
<text>已售:{{ storeInfo.sales }}</text>
</view>
<view class="coupon acea-row row-between-wrapper" @click="couponTap" v-if="couponList.length">
<text class="hide line1">
@ -292,7 +292,7 @@ export default {
isIntegral: false,
}
},
computed: mapGetters(['isLogin', 'location']),
computed: mapGetters(['isLogin', 'location', 'userInfo']),
mounted: function() {
this.$store.commit('get_to', 'goodcon')
let url = handleQrCode()
@ -632,6 +632,12 @@ export default {
//
joinCart: function() {
//0=
if(uni.getStorageSync('uid') == this.storeInfo.merId){
return uni.showToast({
title: '不可以购买自己发布的商品!',
icon: 'none'
})
}
this.goCat(0)
},
//
@ -726,6 +732,12 @@ export default {
},
//
tapBuy: function() {
if(uni.getStorageSync('uid') == this.storeInfo.merId){
return uni.showToast({
title: '不可以购买自己发布的商品!',
icon: 'none'
})
}
// 1=
this.goCat(1)
},

482
pages/user/agreement/index.vue

@ -1,262 +1,270 @@
<template>
<!--pages/user/agreement/index.wxml-->
<view>
<view class="back-btn" :style="'top:' + navTopHeight + 'rpx'" @tap="backPage">
<!--pages/user/agreement/index.wxml-->
<view>
<view class="back-btn" :style="'top:' + navTopHeight + 'rpx'" @tap="backPage">
<image src="/static/images/back.png" mode></image>
</view>
<view class="pay-box" v-if="userInfo.nickname != '' && userInfo.isVip == 1">
<image src="https://download.cyjyyjy.com/pay1.png" class="img1"></image>
<image src="https://download.cyjyyjy.com/pay2.png" class="img2"></image>
</view>
<view class="agreement-box" v-else>
<image src="https://download.cyjyyjy.com/agreement1.png" class="img1"></image>
<image src="https://download.cyjyyjy.com/agreement2.png" class="img2"></image>
<image src="https://download.cyjyyjy.com/agreement3.png" class="img3"></image>
<!-- <image src="../../../images/agreement.png" class="img"></image> -->
<view class="btn-box" @tap="toPay" v-if="userInfo.nickname"></view>
<block v-else>
<button class="btn-box" v-if="canIUseGetUserProfile" @tap="getUserProfile"></button>
<button class="btn-box" v-else-if="canIUse" open-type="getUserInfo" @getuserinfo="getUserInfo"></button>
<view v-else> 请使用1.4.4及以上版本基础库 </view>
</block>
</view>
</view>
<view class="pay-box" v-if="userInfo.nickname != '' && userInfo.isVip == 1">
<image src="https://download.cyjyyjy.com/pay1.png" class="img1"></image>
<image src="https://download.cyjyyjy.com/pay2.png" class="img2"></image>
</view>
<view class="agreement-box" v-else>
<image src="https://download.cyjyyjy.com/agreement1.png" class="img1"></image>
<image src="https://download.cyjyyjy.com/agreement2.png" class="img2"></image>
<image src="https://download.cyjyyjy.com/agreement3.png" class="img3"></image>
<!-- <image src="../../../images/agreement.png" class="img"></image> -->
<view class="btn-box" @tap="toPay" v-if="userInfo.nickname"></view>
<block v-else>
<button class="btn-box" v-if="canIUseGetUserProfile" @tap="getUserProfile"></button>
<button class="btn-box" v-else-if="canIUse" open-type="getUserInfo" @getuserinfo="getUserInfo"></button>
<view v-else> 请使用1.4.4及以上版本基础库 </view>
</block>
</view>
</view>
</template>
<script>
// pages/user/agreement/index.js
const app = getApp();
// pages/user/agreement/index.js
const app = getApp();
export default {
data() {
return {
navTopHeight: app.globalData.menuTop + app.globalData.navTopHeight + 10,
userInfo: null,
canIUse: uni.canIUse('button.open-type.getUserInfo'),
canIUseGetUserProfile: false,
code: "",
hasUserInfo: false
};
},
export default {
data() {
return {
navTopHeight: app.globalData.menuTop + app.globalData.navTopHeight + 10,
userInfo: null,
canIUse: uni.canIUse('button.open-type.getUserInfo'),
canIUseGetUserProfile: false,
code: "",
hasUserInfo: false
};
},
components: {},
props: {},
components: {},
props: {},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if (uni.getUserProfile) {
this.setData({
canIUseGetUserProfile: true
});
}
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
if (uni.getUserProfile) {
this.setData({
canIUseGetUserProfile: true
});
}
uni.login({
success: res => {
// res.code openId, sessionKey, unionId
this.setData({
code: res.code
});
}
});
let pages = getCurrentPages();
app.http('get', 'userinfo').then(res => {
if (res.data.success) {
uni.setStorageSync('userInfo', res.data.data);
this.setData({
userInfo: res.data.data
});
}
}).then(() => {
if (pages[pages.length - 2]) {
} else {
if (this.userInfo.isVip) {
setTimeout(() => {
uni.reLaunch({
url: '/pages/user/mine/index'
});
}, 2000);
}
}
});
},
uni.login({
success: res => {
// res.code openId, sessionKey, unionId
this.setData({
code: res.code
});
}
});
let pages = getCurrentPages();
app.http('get', 'userinfo').then(res => {
if (res.data.success) {
uni.setStorageSync('userInfo', res.data.data);
this.setData({
userInfo: res.data.data
});
}
}).then(() => {
if (pages[pages.length - 2]) {
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
onShow: function () {
app.getInfo();
},
} else {
if (this.userInfo.isVip) {
setTimeout(() => {
uni.reLaunch({
url: '/pages/user/mine/index'
});
}, 2000);
}
}
});
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {},
onShow: function() {
app.getInfo();
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {},
methods: {
getUserProfile(e) {
// 使wx.getUserProfile
uni.getUserProfile({
desc: '展示用户信息',
//
success: response => {
uni.showLoading({
title: '登陆中...'
});
let data = {
code: this.code,
iv: response.iv,
encryptedData: response.encryptedData,
spread: 0,
login_type: 0
};
app.http('POST', 'wxapp/auth', data).then(result => {
if (result.data.success) {
uni.hideLoading();
uni.setStorageSync('token', 'Bearer ' + result.data.data.token);
uni.setStorageSync('userInfo', result.data.data.user);
uni.showModal({
title: "提示",
content: '登陆成功!点击确定按钮完善信息',
success: res => {
if (res.confirm) {
if (result.data.data.user.isVip == false) {
uni.navigateTo({
url: '../personalData/index'
});
} else {
setTimeout(() => {
uni.reLaunch({
url: '/pages/user/index'
});
}, 1000);
}
} else {
if (result.data.data.user.isVip == false) {
uni.navigateTo({
url: '../personalData/index'
});
} else {
setTimeout(() => {
uni.reLaunch({
url: '/pages/user/index'
});
}, 1000);
}
}
}
});
} else {
uni.showToast({
title: result.data.msg,
icon: 'none'
});
}
});
}
});
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {},
getUserInfo(e) {
// 使getUserInfo2021413getUserInfo
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
});
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {},
methods: {
getUserProfile(e) {
// 使wx.getUserProfile
uni.getUserProfile({
desc: '展示用户信息',
//
success: response => {
uni.showLoading({
title: '登陆中...'
});
let data = {
code: this.code,
iv: response.iv,
encryptedData: response.encryptedData,
spread: 0,
login_type: 0
};
app.http('POST', 'wxapp/auth', data).then(result => {
if (result.data.success) {
uni.hideLoading();
uni.setStorageSync('token', 'Bearer ' + result.data.data.token);
uni.setStorageSync('userInfo', result.data.data.user);
uni.showModal({
title: "提示",
content: '登陆成功!点击确定按钮完善信息',
success: res => {
if (res.confirm) {
if (result.data.data.user.isVip == false) {
uni.navigateTo({
url: '../personalData/index'
});
} else {
setTimeout(() => {
uni.reLaunch({
url: '/pages/user/index'
});
}, 1000);
}
} else {
if (result.data.data.user.isVip == false) {
uni.navigateTo({
url: '../personalData/index'
});
} else {
setTimeout(() => {
uni.reLaunch({
url: '/pages/user/index'
});
}, 1000);
}
}
}
});
} else {
uni.showToast({
title: result.data.msg,
icon: 'none'
});
}
});
}
});
},
toPay() {
uni.navigateTo({
url: '../personalData/index'
});
},
getUserInfo(e) {
// 使getUserInfo2021413getUserInfo
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
});
},
backPage() {
uni.navigateBack({
delta: 1
});
},
toPay() {
uni.navigateTo({
url: '../personalData/index'
});
},
/**
* 生命周期函数--监听页面显示
*/
getUser() {
this.setData({
userInfo: uni.getStorageSync('userInfo')
});
}
backPage() {
uni.navigateBack({
delta: 1
});
},
}
};
/**
* 生命周期函数--监听页面显示
*/
getUser() {
this.setData({
userInfo: uni.getStorageSync('userInfo')
});
}
}
};
</script>
<style>
/* pages/user/agreement/index.wxss */
.agreement-box{
width: 100%;
position: relative;
}
.agreement-box image{
width: 100%;
display: block;
}
.agreement-box .img{
height: 2848rpx;
}
.agreement-box .img1{
height: 924rpx;
}
.agreement-box .img2{
height: 834rpx;
}
.agreement-box .img3{
height: 1090rpx;
}
/* pages/user/agreement/index.wxss */
.agreement-box {
width: 100%;
position: relative;
}
.agreement-box image {
width: 100%;
display: block;
}
.agreement-box .img {
height: 2848rpx;
}
.agreement-box .img1 {
height: 924rpx;
}
.agreement-box .img2 {
height: 834rpx;
}
.agreement-box .img3 {
height: 1090rpx;
}
.btn-box {
width: 440rpx !important;
height: 142rpx !important;
padding: 0 !important;
position: absolute;
top: 658rpx;
left: 50%;
margin-left: -220rpx !important;
background: none !important;
}
.pay-box {
width: 100%;
min-height: 100vh;
}
.pay-box image {
width: 100%;
display: block;
}
.btn-box{
width: 440rpx !important;
height: 142rpx !important;
padding: 0 !important;
position: absolute;
top: 658rpx;
left: 50%;
margin-left: -220rpx !important;
background: none !important;
}
.pay-box .img1 {
height: 609rpx;
}
.pay-box{
width: 100%;
min-height: 100vh;
}
.pay-box image{
width: 100%;
display: block;
}
.pay-box .img1{
height: 609rpx;
}
.pay-box .img2{
height: 1235rpx;
}
</style>
.pay-box .img2 {
height: 1235rpx;
}
</style>

11
pages/user/goodsManage/index.vue

@ -1,10 +1,10 @@
<template>
<view class="goodsManage-page">
<view class="nav acea-row row-around">
<view class="item" :class="{ on: type === 1 }" @click="changeType(1)">
<view class="item" :class="{ on: type == 1 }" @click="changeType(1)">
<view>出售中</view>
</view>
<view class="item" :class="{ on: type === 0 }" @click="changeType(0)">
<view class="item" :class="{ on: type == 0 }" @click="changeType(0)">
<view>待上架</view>
</view>
</view>
@ -60,12 +60,15 @@
}
},
onShow() {
this.$yroute.query.type ? this.type = this.$yroute.query.type : this.type = 1
this.getProducts()
let pages = getCurrentPages();
console.log(pages)
},
onReachBottom() {
this.getProducts()
if(this.loading){
this.page= this.page + 1
this.getProducts()
}
},
onPullDownRefresh() {
this.goodsList = []

7
pages/user/index.vue

@ -230,7 +230,6 @@ export default {
userInfo: {},
CustomBar: app.globalData.CustomBar,
menuHeight: app.globalData.menuHeight,
navHeight: app.globalData.navHeight,
menuTop: app.globalData.menuTop,
demandCounts: 0,
supplyCounts: 0,
@ -250,15 +249,14 @@ export default {
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// app.globalData.editTabbar();
this.getInfo();
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
onPullDownRefresh() {
this.getInfo()
@ -311,7 +309,6 @@ export default {
},
toAuth() {
uni.navigateTo({
url: '/pages/release/index'
});

2
pages/user/openStore/index.vue

@ -146,7 +146,7 @@
min-height: 100vh;
background: #eee;
.form-box{
padding: 0rpx 40rpx;
padding: 20rpx 40rpx;
.form-item{
width: 100%;
padding: 30rpx 28rpx;

BIN
static/images/edit-icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

22
uni_modules/uni-badge/changelog.md

@ -0,0 +1,22 @@
## 1.1.6(2021-09-22)
- 修复 在字节小程序上样式不生效的 bug
## 1.1.5(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.1.4(2021-07-29)
- 修复 去掉 nvue 不支持css 的 align-self 属性,nvue 下不暂支持 absolute 属性
## 1.1.3(2021-06-24)
- 优化 示例项目
## 1.1.1(2021-05-12)
- 新增 组件示例地址
## 1.1.0(2021-05-12)
- 新增 uni-badge 的 absolute 属性,支持定位
- 新增 uni-badge 的 offset 属性,支持定位偏移
- 新增 uni-badge 的 is-dot 属性,支持仅显示有一个小点
- 新增 uni-badge 的 max-num 属性,支持自定义封顶的数字值,超过 99 显示99+
- 优化 uni-badge 属性 custom-style, 支持以对象形式自定义样式
## 1.0.7(2021-05-07)
- 修复 uni-badge 在 App 端,数字小于10时不是圆形的bug
- 修复 uni-badge 在父元素不是 flex 布局时,宽度缩小的bug
- 新增 uni-badge 属性 custom-style, 支持自定义样式
## 1.0.6(2021-02-04)
- 调整为uni_modules目录规范

253
uni_modules/uni-badge/components/uni-badge/uni-badge.vue

@ -0,0 +1,253 @@
<template>
<view class="uni-badge--x">
<slot />
<text v-if="text" :class="classNames" :style="[badgeWidth, positionStyle, customStyle, dotStyle]"
class="uni-badge"
@click="onClick()">{{displayValue}}</text>
</view>
</template>
<script>
/**
* Badge 数字角标
* @description 数字角标一般和其它控件列表9宫格等配合使用用于进行数量提示默认为实心灰色背景
* @tutorial https://ext.dcloud.net.cn/plugin?id=21
* @property {String} text 角标内容
* @property {String} type = [default|primary|success|warning|error] 颜色类型
* @value default 灰色
* @value primary 蓝色
* @value success 绿色
* @value warning 黄色
* @value error 红色
* @property {String} size = [normal|small] Badge 大小
* @value normal 一般尺寸
* @value small 小尺寸
* @property {String} inverted = [true|false] 是否无需背景颜色
* @event {Function} click 点击 Badge 触发事件
* @example <uni-badge text="1"></uni-badge>
*/
export default {
name: 'UniBadge',
emits:['click'],
props: {
type: {
type: String,
default: 'default'
},
inverted: {
type: Boolean,
default: false
},
isDot: {
type: Boolean,
default: false
},
maxNum: {
type: Number,
default: 99
},
absolute: {
type: String,
default: ''
},
offset: {
type: Array,
default () {
return [0, 0]
}
},
text: {
type: [String, Number],
default: ''
},
size: {
type: String,
default: 'normal'
},
customStyle: {
type: Object,
default () {
return {}
}
}
},
data() {
return {};
},
computed: {
width() {
return String(this.text).length * 8 + 12
},
classNames() {
const {
inverted,
type,
size,
absolute
} = this
return [
inverted ? 'uni-badge--' + type + '-inverted' : '',
'uni-badge--' + type,
'uni-badge--' + size,
absolute ? 'uni-badge--absolute' : ''
].join(' ')
},
positionStyle() {
if (!this.absolute) return {}
let w = this.width / 2,
h = 10
if (this.isDot) {
w = 5
h = 5
}
const x = `${- w + this.offset[0]}px`
const y = `${- h + this.offset[1]}px`
const whiteList = {
rightTop: {
right: x,
top: y
},
rightBottom: {
right: x,
bottom: y
},
leftBottom: {
left: x,
bottom: y
},
leftTop: {
left: x,
top: y
}
}
const match = whiteList[this.absolute]
return match ? match : whiteList['rightTop']
},
badgeWidth() {
return {
width: `${this.width}px`
}
},
dotStyle() {
if (!this.isDot) return {}
return {
width: '10px',
height: '10px',
borderRadius: '10px'
}
},
displayValue() {
const { isDot, text, maxNum } = this
return isDot ? '' : (Number(text) > maxNum ? `${maxNum}+` : text)
}
},
methods: {
onClick() {
this.$emit('click');
}
}
};
</script>
<style lang="scss" scoped>
$bage-size: 12px;
$bage-small: scale(0.8);
$bage-height: 20px;
.uni-badge--x {
/* #ifdef APP-NVUE */
// align-self: flex-start;
/* #endif */
/* #ifndef APP-NVUE */
display: inline-block;
/* #endif */
position: relative;
}
.uni-badge--absolute {
position: absolute;
}
.uni-badge {
/* #ifndef APP-NVUE */
display: flex;
overflow: hidden;
box-sizing: border-box;
/* #endif */
justify-content: center;
flex-direction: row;
height: $bage-height;
line-height: $bage-height;
color: $uni-text-color;
border-radius: 100px;
background-color: $uni-bg-color-hover;
background-color: transparent;
text-align: center;
font-family: 'Helvetica Neue', Helvetica, sans-serif;
font-size: $bage-size;
/* #ifdef H5 */
cursor: pointer;
/* #endif */
}
.uni-badge--inverted {
padding: 0 5px 0 0;
color: $uni-bg-color-hover;
}
.uni-badge--default {
color: $uni-text-color;
background-color: $uni-bg-color-hover;
}
.uni-badge--default-inverted {
color: $uni-text-color-grey;
background-color: transparent;
}
.uni-badge--primary {
color: $uni-text-color-inverse;
background-color: $uni-color-primary;
}
.uni-badge--primary-inverted {
color: $uni-color-primary;
background-color: transparent;
}
.uni-badge--success {
color: $uni-text-color-inverse;
background-color: $uni-color-success;
}
.uni-badge--success-inverted {
color: $uni-color-success;
background-color: transparent;
}
.uni-badge--warning {
color: $uni-text-color-inverse;
background-color: $uni-color-warning;
}
.uni-badge--warning-inverted {
color: $uni-color-warning;
background-color: transparent;
}
.uni-badge--error {
color: $uni-text-color-inverse;
background-color: $uni-color-error;
}
.uni-badge--error-inverted {
color: $uni-color-error;
background-color: transparent;
}
.uni-badge--small {
transform: $bage-small;
transform-origin: center center;
}
</style>

88
uni_modules/uni-badge/package.json

@ -0,0 +1,88 @@
{
"id": "uni-badge",
"displayName": "uni-badge 数字角标",
"version": "1.1.6",
"description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。",
"keywords": [
"",
"badge",
"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"
},
"快应用": {
"华为": "y",
"联盟": "y"
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
}
}
}
}

58
uni_modules/uni-badge/readme.md

@ -0,0 +1,58 @@
## Badge 数字角标
> **组件名:uni-badge**
> 代码块: `uBadge`
数字角标一般和其它控件(列表、9宫格等)配合使用,用于进行数量提示,默认为实心灰色背景,
### 安装方式
本组件符合[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-badge size="small" :text="100" absolute="rightBottom" type="primary">
<button type="default">右上</button>
</uni-badge>
<uni-badge text="1"></uni-badge>
<uni-badge text="2" type="purple" @click="bindClick"></uni-badge>
<uni-badge text="3" type="primary" :inverted="true"></uni-badge>
```
## API
### Badge Props
|属性名 |类型 |默认值 |说明 |
|:-: |:-: |:-: |:-: |
|text |String |- |角标内容 |
|type |String |default|颜色类型,可选值:default(灰色)、primary(蓝色)、success(绿色)、warning(黄色)、error(红色)|
|size |String |normal |Badge 大小,可取值:normal、small |
|is-dot |Boolean|false |不展示数字,只有一个小点 |
|max-num |String/Numbuer|99 |展示封顶的数字值,超过 99 显示99+ |
|custom-style |Object | {} |自定义 Badge 样式, 样式对象语法 |
|inverted |Boolean|false |是否无需背景颜色,为 true 时,背景颜色将变为文字的字体颜色 |
|absolute (不支持 nvue) |String| rightTop|开启绝对定位, 角标将定位到其包裹的标签的四个角上,可选值: rightTop(右上角)、rightBottom(右下角)、leftBottom(左下角) 、leftTop(左上角) |
|offset |Array[number]| [0, 0]|距定位角中心点的偏移量,[-10, -10] 表示向 absolute 指定的方向偏移 10px,[10, 10] 表示向 absolute 指定的反方向偏移 10px,只有存在 absolute 属性时有效,与absolute 的值一一对应(例如:值为rightTop, 对应 offset 为 [right, Top])|
### Badge Events
|事件名 |事件说明 |返回参数 |
|:-: |:-: |:-: |
|@click |点击 Badge 触发事件| - |
## 组件示例
点击查看:[https://hellouniapp.dcloud.net.cn/pages/extUI/badge/badge](https://hellouniapp.dcloud.net.cn/pages/extUI/badge/badge)
Loading…
Cancel
Save