接口调取完成

master
Lee 2022-11-02 14:15:55 +08:00
parent 0bfe6d07f4
commit 29f49ab4d7
69 changed files with 329 additions and 379 deletions

View File

@ -2,13 +2,13 @@
<view class="goods-list flex">
<view class="item background-white radius20 mar-s20" @tap.top="goDetail(item.id)" v-for="(item,index) in goodsList" :key="index">
<view class="cover radius20">
<image :src="item.cover" mode="widthFix"></image>
<view v-if="isOperate" class="hide-btn font24 color-ff radius20 flex" :class="item.state==0?'background-8c':'background-blue'" @tap.stop="changeStateEv(item.id,index)">{{item.state==0?'':''}}</view>
<image class="img" :src="item.cover" mode="widthFix"></image>
<view v-if="isOperate" class="hide-btn font24 color-ff radius20 flex" :class="item.status==1?'background-8c':'background-blue'" @tap.stop="changeStateEv(item.id,index)">{{item.status==1?'':''}}</view>
</view>
<text class="name font28 clips1">{{item.name}}</text>
<view class="price flex">
<text class="color-8c font24">{{item.original_price}}</text>
<text class="color-red font28">{{item.price}}</text>
<text class="text color-8c font24" v-if="item.original_price!==''">{{item.original_price}}</text>
<text class="text color-red font28">{{item.price}}</text>
</view>
</view>
</view>
@ -78,7 +78,7 @@
margin-bottom: 10rpx;
position: relative;
}
.goods-list .cover image{
.goods-list .cover .img{
width: 100%;
min-height: 100%;
}
@ -97,7 +97,7 @@
align-items: center;
margin-top: 5rpx;
}
.goods-list .price>text:first-child{
.goods-list .price>.text:first-child{
margin-right: 6rpx;
text-decoration: line-through;
}

View File

@ -2,12 +2,12 @@
<view class="tabbar-list border-box pad-sx40 background-white pad-zy20 flex">
<!-- 底部导航 -->
<view class="tabbar-item color-88 flex" :class="current==index ? 'active' : ''" @tap="chooseFootTab(index)" v-for="(item,index) in footBarList" :key="index">
<view class="icon flex"><image :style="{width:[41,38][index]+'rpx',height:[41,40][index]+'rpx'}" :src="item.iconPath" mode="widthFix"></image></view>
<view class="icon flex"><image class="img" :style="{width:[41,38][index]+'rpx',height:[41,40][index]+'rpx'}" :src="item.iconPath" mode="widthFix"></image></view>
<view class="title font26">{{item.title}}</view>
</view>
<!-- 发布按钮 -->
<view class="release-btn background-blue color-ff radius100 flex" @tap="goRelease">
<image src="/static/icon-release.png" mode="widthFix"></image>
<image class="img" src="/static/icon-release.png" mode="widthFix"></image>
</view>
</view>
</template>
@ -88,7 +88,7 @@
width: 100%;
height: 40rpx;
}
.tabbar-item .icon>image{
.tabbar-item .icon .img{
filter: grayscale(100%);
}
.tabbar-item .title{
@ -99,7 +99,7 @@
.tabbar-item.active{
color: #1981ff;
}
.tabbar-item.active .icon>image{
.tabbar-item.active .icon .img{
filter: grayscale(0);
}
/* 发布按钮 */
@ -116,7 +116,7 @@
bottom: 120rpx;
z-index: 99;
}
.release-btn>image{
.release-btn .img{
width: 48rpx;
height: 48rpx;
}

View File

@ -1,7 +1,7 @@
{
"name" : "小区闲置",
"appid" : "__UNI__768F35C",
"description" : "这是一款基于uniapp开发的app和微信小程序的模板框架",
"description" : "发布或购买小区闲置商品小程序",
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : false,

View File

@ -29,7 +29,7 @@
size:10, //
total:0, //
isLoading:false, //
estate:0, //0:,1:,2:
estate:1, //1:,2:,3:
}
},
onLoad(op) {

View File

@ -54,6 +54,7 @@
showPhone:false, //
isLoading:false, //
type:'', //
goods_id: 0,// id
}
},
onLoad(op) {
@ -61,28 +62,28 @@
this.type = op.type;
}
if(op.id){
//
this.getGoodsDetail(op.id);
}else{
this.$toolAll.tools.showToast('参数不合法');
// id
this.goods_id = op.id;
}
},
onShow() {
//
this.getGoodsDetail(this.goods_id);
},
onShareAppMessage(res) {
let shareObj = {
title:'老农极鲜',
path: uni.getStorageSync('page-path-options')+'?invite_code='+uni.getStorageSync('invite_code'),
imageUrl:'/static/img/shear-index.jpg',
title:this.goodsDetail.name,
path: this.type=='release'?uni.getStorageSync('page-path-options').substring(0,uni.getStorageSync('page-path-options').indexOf("&")):uni.getStorageSync('page-path-options'),
imageUrl:this.goodsDetail.cover,
}
// shareObj
return shareObj;
},
onShareTimeline(res){
let shareObj = {
title:'老农极鲜',
query: '?invite_code='+uni.getStorageSync('invite_code'),
path: uni.getStorageSync('page-path-options')+'?invite_code='+uni.getStorageSync('invite_code'),
imageUrl:'/static/img/shear-index.jpg',
title:this.goodsDetail.name,
path: this.type=='release'?uni.getStorageSync('page-path-options').substring(0,uni.getStorageSync('page-path-options').indexOf("&")):uni.getStorageSync('page-path-options'),
imageUrl:this.goodsDetail.cover,
}
// shareObj
return shareObj;
@ -118,7 +119,7 @@
//
editEv(id){
uni.navigateTo({
url:`/pages/release/release?id=${id}`,
url:`/pages/idle/release?id=${id}`,
})
},
@ -127,9 +128,11 @@
this.$requst.post('/api/v1/goods/del',{id:id}).then(res=>{
if(res.code == 0){
this.$toolAll.tools.showToast('删除成功');
uni.navigateTo({
url:`/pages/goods/goods`,
})
setTimeout(()=>{
uni.navigateTo({
url:`/pages/goods/goods`,
})
},500)
}
})
},

View File

@ -22,31 +22,13 @@
size:10, //
total:0, //
isLoading:false, //
flag:true, //
}
},
onShow() {
//
this.getGoodsList();
},
onShareAppMessage(res) {
let shareObj = {
title:'老农极鲜',
path: uni.getStorageSync('page-path-options')+'?invite_code='+uni.getStorageSync('invite_code'),
imageUrl:'/static/img/shear-index.jpg',
}
// shareObj
return shareObj;
},
onShareTimeline(res){
let shareObj = {
title:'老农极鲜',
query: '?invite_code='+uni.getStorageSync('invite_code'),
path: uni.getStorageSync('page-path-options')+'?invite_code='+uni.getStorageSync('invite_code'),
imageUrl:'/static/img/shear-index.jpg',
}
// shareObj
return shareObj;
},
onReachBottom(e) {
if(this.goodsList.length<this.total){
this.page++;
@ -76,7 +58,8 @@
cover:item.cover,
name:item.title,
original_price:item.original_price,
price:item.price
price:item.price,
status:item.status
}
goodsArr.push(obj)
})
@ -89,12 +72,23 @@
//
changeStateEv(id,index){
if(this.goodsList[index].state==0){
this.goodsList[index].state = 1;
this.$toolAll.tools.showToast('状态变更成功');
}else{
this.goodsList[index].state = 0;
this.$toolAll.tools.showToast('状态变更成功');
if(this.flag){
this.flag =false;
this.$requst.post('/api/v1/goods/set-status',{id:id,status:this.goodsList[index].status==0?1:0}).then(res=>{
if(res.code == 0){
console.log(res,'改变状态');
if(this.goodsList[index].status==0){
this.goodsList[index].status = 1;
this.$toolAll.tools.showToast('已隐藏');
}else{
this.goodsList[index].status = 0;
this.$toolAll.tools.showToast('已展示');
}
}
})
setTimeout(()=>{
this.flag = true;
},500)
}
},

View File

@ -39,25 +39,25 @@
//
this.getGoodsList();
}else{
//
this.getEstateList();
uni.navigateTo({
url:'/pages/estate/estate?estate=1'
})
}
},
onShareAppMessage(res) {
let shareObj = {
title:'老农极鲜',
path: uni.getStorageSync('page-path-options')+'?invite_code='+uni.getStorageSync('invite_code'),
imageUrl:'/static/img/shear-index.jpg',
title:'小区闲置',
path: uni.getStorageSync('page-path-options'),
imageUrl:'/static/share-logo.png',
}
// shareObj
return shareObj;
},
onShareTimeline(res){
let shareObj = {
title:'老农极鲜',
query: '?invite_code='+uni.getStorageSync('invite_code'),
path: uni.getStorageSync('page-path-options')+'?invite_code='+uni.getStorageSync('invite_code'),
imageUrl:'/static/img/shear-index.jpg',
title:'小区闲置',
path: uni.getStorageSync('page-path-options'),
imageUrl:'/static/share-logo.png',
}
// shareObj
return shareObj;
@ -70,18 +70,6 @@
}
},
methods: {
//
getEstateList(){
this.$requst.get('/api/v1/goods/area').then(res=>{
if(res.code == 0){
this.area_id = res.data.list[0].id;
this.pageTitle = res.data.list[0].title+'-闲置商品';
//
this.getGoodsList();
}
})
},
//
getGoodsList(){
uni.showLoading({

View File

@ -6,6 +6,15 @@
<view class="notice-tips color-orange font26 border-box pad-all20 flex"><image src="/static/icon-notice.png" mode="widthFix"></image>请确保商品信息及联系方式的真实性!</view>
<!-- 商品编辑 -->
<view class="release-form color-48 background-white border-box">
<view class="item font26 mar-x30 flex">
<view class="title">小区选择<text class="color-red">*</text></view>
<picker mode="selector" :range="estateList" @change="choiceEstate" :value="estateIndex" :range-key="'name'">
<view class="cate-name">
<text>{{estateList[estateIndex].name}}</text>
<image src="/static/icon-arrow-down.png" mode=""></image>
</view>
</picker>
</view>
<view class="item font26 mar-x30 flex">
<view class="title">商品分类<text class="color-red">*</text></view>
<picker mode="selector" :range="cateList" @change="choiceCate" :value="cateIndex" :range-key="'name'">
@ -19,15 +28,6 @@
<view class="title">商品名称<text class="color-red">*</text></view>
<input type="text" v-model="goodsDetail.name" placeholder="请输入商品名称" placeholder-style="color:#8c8c9b">
</view>
<view class="item font26 mar-x30 flex">
<view class="title">小区选择<text class="color-red">*</text></view>
<picker mode="selector" :range="estateList" @change="choiceEstate" :value="cateIndex" :range-key="'name'">
<view class="cate-name">
<text>{{estateList[estateIndex].name}}</text>
<image src="/static/icon-arrow-down.png" mode=""></image>
</view>
</picker>
</view>
<view class="item font26 mar-x30 flex">
<view class="title">商品原价<text class="color-red">*</text></view>
<input type="number" v-model="goodsDetail.original_price" placeholder="请输入商品原价" placeholder-style="color:#8c8c9b">
@ -36,6 +36,10 @@
<view class="title">商品售价<text class="color-red">*</text></view>
<input type="number" v-model="goodsDetail.price" placeholder="请输入商品售价" placeholder-style="color:#8c8c9b">
</view>
<view class="item font26 mar-x30 flex">
<view class="title">联系方式<text class="color-red">*</text></view>
<input type="number" v-model="phone" placeholder="请输入联系方式" placeholder-style="color:#8c8c9b">
</view>
<view class="item font26 mar-x30 flex">
<view class="title">商品描述<text class="color-red">*</text></view>
<textarea v-model="goodsDetail.msg" placeholder="请输入商品描述" placeholder-style="color:#8c8c9b"></textarea>
@ -54,18 +58,14 @@
<view class="title">商品图片<text class="color-red">*</text></view>
<view class="upload-box border-box flex">
<view class="img radius10 border-box" v-for="(item,index) in goodsImg" :key="index">
<image :src="item.imgSrc" mode="widthFix"></image>
<image :src="item" mode="widthFix"></image>
<image class="del-btn" src="/static/icon-del.png" mode="widthFix" @tap="delImg(index)"></image>
</view>
<view class="upload-btn radius10 border-box flex" @tap="changeImg('img')" v-if="goodsImg.length<4"><image src="/static/icon-release.png" mode="widthFix"></image></view>
</view>
</view>
<view class="item font26 mar-x30 flex">
<view class="title">联系方式<text class="color-red">*</text></view>
<input type="number" v-model="goodsDetail.phone" placeholder="请输入联系方式" placeholder-style="color:#8c8c9b">
</view>
</view>
<view class="release-btn background-blue font32 radius10 color-ff flex"></view>
<view class="release-btn background-blue font32 radius10 color-ff flex" @tap="addGoodsEv"></view>
</view>
</template>
<script>
@ -81,11 +81,13 @@
goodsDetail:{}, //
cover:'', //
goodsImg:[], //
phone:'', //
isEdit:false, //
isLoading:false, //
page:1, //
size:100, //
StagingImg:'', //img
goods_id:-1, //id
}
},
onLoad(op) {
@ -93,34 +95,26 @@
//
this.isEdit = true;
this.pageTitle = '编辑商品';
// id
this.goods_id = op.id;
}else{
this.pageTitle = '新增商品';
//
this.getUserInfo();
}
//
this.getEstateList();
//
this.getCateList();
},
onShareAppMessage(res) {
let shareObj = {
title:'老农极鲜',
path: uni.getStorageSync('page-path-options')+'?invite_code='+uni.getStorageSync('invite_code'),
imageUrl:'/static/img/shear-index.jpg',
}
// shareObj
return shareObj;
},
onShareTimeline(res){
let shareObj = {
title:'老农极鲜',
query: '?invite_code='+uni.getStorageSync('invite_code'),
path: uni.getStorageSync('page-path-options')+'?invite_code='+uni.getStorageSync('invite_code'),
imageUrl:'/static/img/shear-index.jpg',
}
// shareObj
return shareObj;
},
methods: {
//
getUserInfo(){
this.$requst.get('/api/v1/user/info').then(res=>{
console.log(res,'用户信息');
if(res.code==0) {
this.phone = res.data.mobile;
}
})
},
//
getEstateList(){
this.$requst.get('/api/v1/goods/area').then(res=>{
@ -135,6 +129,9 @@
estateArr.push(obj)
})
this.estateList = this.estateList.concat(estateArr);
this.estateIndex = this.estateList.findIndex(item=> item.id === uni.getStorageSync('area_id'));
//
this.getCateList();
}
})
},
@ -154,50 +151,82 @@
cateArr.push(obj)
})
this.cateList = cateArr;
if(this.isEdit){
//
this.getGoodsDetail(this.goods_id);
}else{
this.isLoading = true;
}
}
})
if(this.isEdit){
//
this.getGoodsDetail();
}else{
this.isLoading = true;
}
},
//
getGoodsDetail(){
this.goodsDetail = {
name:'儿童自行车',
category_id:3,
original_price:'120.00',
price:'30.00',
phone:'18683958573',
imgSrc:'/static/index-01.png,/static/index-02.png,/static/index-03.png',
msg:'九成新儿童自行车,现在小孩到了,已经用不到了,有需要的可以联系哟!'
}
//
// this.goodsImg = this.goodsDetail.imgSrc.split(',');
//
this.cateIndex = this.cateList.findIndex(item=> item.id === this.goodsDetail.category_id);
this.isLoading = true;
getGoodsDetail(id){
this.$requst.get('/api/v1/goods/detail',{id:id}).then(res=>{
if(res.code == 0){
console.log(res,'闲置商品详情');
//
this.goodsImg = res.data.images;
//
this.phone = res.data.phone;
//
this.cover = res.data.cover;
//
this.cateIndex = this.cateList.findIndex(item=> item.name === res.data.category_name);
//
this.estateIndex = this.estateList.findIndex(item=> item.name === res.data.area_name);
//
this.goodsDetail = {
id:res.data.id,
name:res.data.title,
original_price:parseFloat(res.data.original_price),
price:parseFloat(res.data.price),
msg:res.data.content
};
}
this.isLoading = true;
})
},
//
// or
addGoodsEv(){
let params = {
id:this.goods_id!==-1?this.goods_id:'',
title:this.goodsDetail.name,
cover:this.cover,
category_id:this.goodsDetail.category_id,
area_id:this.goodsDetail.area_id,
phone:this.goodsDetail.phone,
category_id:this.cateList[this.cateIndex].id,
area_id:this.estateList[this.estateIndex].id,
phone:this.phone,
original_price:this.goodsDetail.original_price,
price:this.goodsDetail.price,
// images:this.goodsImg.toString().replace(','),
images:this.goodsImg.join(','),
content:this.goodsDetail.msg
}
this.$requst.post('/api/v1/goods/add',params).then(res=>{
this.$requst.post(this.isEdit?'/api/v1/goods/edit':'/api/v1/goods/add',params).then(res=>{
if(res.code == 0){
if(this.isEdit){
this.$toolAll.tools.showToast('修改成功');
setTimeout(()=>{
uni.navigateBack({
delta: 1,
fail: () => {
uni.reLaunch({
url: '/pages/idle/idle'
})
}
})
},500)
}else{
this.$toolAll.tools.showToast('添加成功');
setTimeout(()=>{
uni.reLaunch({
url:'/pages/idle/idle',
})
},500)
}
}else{
this.$toolAll.tools.showToast(res.msg);
}
})
},
@ -233,16 +262,11 @@
});
this.$requst.upload('/api/v1/file/upload/image',{path:this.StagingImg}).then(res=>{
if(res.code==0) {
console.log(this.$hostHttp+res.data.src,1111)
if(type=='cover'){
this.cover = this.$hostHttp+res.data.src;
}
if(type=='img'){
let goodsObj = {};
goodsObj = {
imgSrc:this.$hostHttp+res.data.src
}
this.goodsImg.push(goodsObj);
this.goodsImg.push(this.$hostHttp+res.data.src);
}
}
uni.hideLoading();

View File

@ -29,7 +29,7 @@
uni.showLoading({
title:'加载中'
});
this.$requst.get('/api/index/statement').then(res=>{
this.$requst.get('/api/v1/index/statement').then(res=>{
if(res.code==0){
this.disclaimers = this.$toolAll.tools.escape2Html(res.data.content);
} else {

View File

@ -158,8 +158,7 @@
display: block;
width: 224rpx;
height: 224rpx;
border-radius: 100%;
border: 2rpx solid #d8d8d8;
border-radius: 18.75%;
margin: 0 auto;
}

View File

@ -69,6 +69,7 @@
this.mobile = res.data.mobile;
}
uni.hideLoading();
this.isLoading = true;
})
},

View File

@ -68,9 +68,6 @@
},
onLoad(op) {
this.getUserData();
},
onShow() {
},
methods: {
//

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 104 KiB

BIN
static/share-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
{"version":3,"sources":[],"names":[],"mappings":"","file":"components/share-coupon/share-coupon.js","sourceRoot":""}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
{"version":3,"sources":["uni-app:///main.js"],"names":["wx","__webpack_require_UNI_MP_PLUGIN__","__webpack_require__","createPage","Page"],"mappings":";;;;;;;;;;kDAAA;;;AAGA;AACA,yF,8FAHA;AACAA,EAAE,CAACC,iCAAH,GAAuCC,mBAAvC,CAGAC,UAAU,CAACC,aAAD,CAAV,C","file":"pages/cart/cart.js","sourcesContent":["import 'uni-pages';\n// @ts-ignore\nwx.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;\nimport Vue from 'vue'\nimport Page from './pages/cart/cart.vue'\ncreatePage(Page)"],"sourceRoot":""}

View File

@ -1 +0,0 @@
{"version":3,"sources":["uni-app:///main.js"],"names":["wx","__webpack_require_UNI_MP_PLUGIN__","__webpack_require__","createPage","Page"],"mappings":";;;;;;;;;;kDAAA;;;AAGA;AACA,6F,8FAHA;AACAA,EAAE,CAACC,iCAAH,GAAuCC,mBAAvC,CAGAC,UAAU,CAACC,eAAD,CAAV,C","file":"pages/cart/finish.js","sourcesContent":["import 'uni-pages';\n// @ts-ignore\nwx.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;\nimport Vue from 'vue'\nimport Page from './pages/cart/finish.vue'\ncreatePage(Page)"],"sourceRoot":""}

View File

@ -1 +0,0 @@
{"version":3,"sources":["uni-app:///main.js"],"names":["wx","__webpack_require_UNI_MP_PLUGIN__","__webpack_require__","createPage","Page"],"mappings":";;;;;;;;;;kDAAA;;;AAGA;AACA,qG,8FAHA;AACAA,EAAE,CAACC,iCAAH,GAAuCC,mBAAvC,CAGAC,UAAU,CAACC,mBAAD,CAAV,C","file":"pages/cart/settlement.js","sourcesContent":["import 'uni-pages';\n// @ts-ignore\nwx.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;\nimport Vue from 'vue'\nimport Page from './pages/cart/settlement.vue'\ncreatePage(Page)"],"sourceRoot":""}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
{"version":3,"sources":["uni-app:///main.js"],"names":["wx","__webpack_require_UNI_MP_PLUGIN__","__webpack_require__","createPage","Page"],"mappings":";;;;;;;;;;kDAAA;;;AAGA;AACA,2F,8FAHA;AACAA,EAAE,CAACC,iCAAH,GAAuCC,mBAAvC,CAGAC,UAAU,CAACC,eAAD,CAAV,C","file":"pages/my/revise.js","sourcesContent":["import 'uni-pages';\n// @ts-ignore\nwx.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;\nimport Vue from 'vue'\nimport Page from './pages/my/revise.vue'\ncreatePage(Page)"],"sourceRoot":""}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<view class="goods-list flex data-v-108270a4"><block wx:for="{{goodsList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['goDetail',['$0'],[[['goodsList','',index,'id']]]]]]]}}" class="item background-white radius20 mar-s20 data-v-108270a4" bindtap="__e"><view class="cover radius20 data-v-108270a4"><image src="{{item.cover}}" mode="widthFix" class="data-v-108270a4"></image><block wx:if="{{isOperate}}"><view data-event-opts="{{[['tap',[['changeStateEv',['$0',index],[[['goodsList','',index,'id']]]]]]]}}" class="{{['hide-btn','font24','color-ff','radius20','flex','data-v-108270a4',item.state==0?'background-8c':'background-blue']}}" catchtap="__e">{{item.state==0?'已隐藏':'已展示'}}</view></block></view><text class="name font28 clips1 data-v-108270a4">{{item.name}}</text><view class="price flex data-v-108270a4"><text class="color-8c font24 data-v-108270a4">{{"¥"+item.original_price}}</text><text class="color-red font28 data-v-108270a4">{{"¥"+item.price}}</text></view></view></block></view>
<view class="goods-list flex data-v-108270a4"><block wx:for="{{goodsList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['goDetail',['$0'],[[['goodsList','',index,'id']]]]]]]}}" class="item background-white radius20 mar-s20 data-v-108270a4" bindtap="__e"><view class="cover radius20 data-v-108270a4"><image class="img data-v-108270a4" src="{{item.cover}}" mode="widthFix"></image><block wx:if="{{isOperate}}"><view data-event-opts="{{[['tap',[['changeStateEv',['$0',index],[[['goodsList','',index,'id']]]]]]]}}" class="{{['hide-btn','font24','color-ff','radius20','flex','data-v-108270a4',item.status==1?'background-8c':'background-blue']}}" catchtap="__e">{{item.status==1?'已隐藏':'已展示'}}</view></block></view><text class="name font28 clips1 data-v-108270a4">{{item.name}}</text><view class="price flex data-v-108270a4"><block wx:if="{{item.original_price!==''}}"><text class="text color-8c font24 data-v-108270a4">{{"¥"+item.original_price}}</text></block><text class="text color-red font28 data-v-108270a4">{{"¥"+item.price}}</text></view></view></block></view>

View File

@ -18,7 +18,7 @@
margin-bottom: 10rpx;
position: relative;
}
.goods-list .cover image.data-v-108270a4{
.goods-list .cover .img.data-v-108270a4{
width: 100%;
min-height: 100%;
}
@ -37,7 +37,7 @@
align-items: center;
margin-top: 5rpx;
}
.goods-list .price>text.data-v-108270a4:first-child{
.goods-list .price>.text.data-v-108270a4:first-child{
margin-right: 6rpx;
text-decoration: line-through;
}

View File

@ -1 +1 @@
<view class="tabbar-list border-box pad-sx40 background-white pad-zy20 flex data-v-8ad7aaf8"><block wx:for="{{footBarList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['chooseFootTab',[index]]]]]}}" class="{{['tabbar-item','color-88','flex','data-v-8ad7aaf8',current==index?'active':'']}}" bindtap="__e"><view class="icon flex data-v-8ad7aaf8"><image style="{{'width:'+([41,38][index]+'rpx')+';'+('height:'+([41,40][index]+'rpx')+';')}}" src="{{item.iconPath}}" mode="widthFix" class="data-v-8ad7aaf8"></image></view><view class="title font26 data-v-8ad7aaf8">{{item.title}}</view></view></block><view data-event-opts="{{[['tap',[['goRelease',['$event']]]]]}}" class="release-btn background-blue color-ff radius100 flex data-v-8ad7aaf8" bindtap="__e"><image src="/static/icon-release.png" mode="widthFix" class="data-v-8ad7aaf8"></image></view></view>
<view class="tabbar-list border-box pad-sx40 background-white pad-zy20 flex data-v-8ad7aaf8"><block wx:for="{{footBarList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['chooseFootTab',[index]]]]]}}" class="{{['tabbar-item','color-88','flex','data-v-8ad7aaf8',current==index?'active':'']}}" bindtap="__e"><view class="icon flex data-v-8ad7aaf8"><image class="img data-v-8ad7aaf8" style="{{'width:'+([41,38][index]+'rpx')+';'+('height:'+([41,40][index]+'rpx')+';')}}" src="{{item.iconPath}}" mode="widthFix"></image></view><view class="title font26 data-v-8ad7aaf8">{{item.title}}</view></view></block><view data-event-opts="{{[['tap',[['goRelease',['$event']]]]]}}" class="release-btn background-blue color-ff radius100 flex data-v-8ad7aaf8" bindtap="__e"><image class="img data-v-8ad7aaf8" src="/static/icon-release.png" mode="widthFix"></image></view></view>

View File

@ -21,7 +21,7 @@
width: 100%;
height: 40rpx;
}
.tabbar-item .icon>image.data-v-8ad7aaf8{
.tabbar-item .icon .img.data-v-8ad7aaf8{
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
}
@ -33,7 +33,7 @@
.tabbar-item.active.data-v-8ad7aaf8{
color: #1981ff;
}
.tabbar-item.active .icon>image.data-v-8ad7aaf8{
.tabbar-item.active .icon .img.data-v-8ad7aaf8{
-webkit-filter: grayscale(0);
filter: grayscale(0);
}
@ -52,7 +52,7 @@
bottom: 120rpx;
z-index: 99;
}
.release-btn>image.data-v-8ad7aaf8{
.release-btn .img.data-v-8ad7aaf8{
width: 48rpx;
height: 48rpx;
}

View File

@ -186,7 +186,7 @@ __webpack_require__.r(__webpack_exports__);
size: 10, //条数
total: 0, //总数
isLoading: false, //是否加载完成
estate: 0 //0:闲置进入,1:车位进入,2:房屋进入
estate: 1 //1:闲置进入,2:车位进入,3:房屋进入
};
},
onLoad: function onLoad(op) {

View File

@ -219,7 +219,8 @@ var _default =
goodsImg: [], //商品图片
showPhone: false, //显示电话号码
isLoading: false, //是否加载完成
type: '' //是否自己发布
type: '', //是否自己发布
goods_id: 0 // 商品id
};
},
onLoad: function onLoad(op) {
@ -227,28 +228,28 @@ var _default =
this.type = op.type;
}
if (op.id) {
// 查询商品列表
this.getGoodsDetail(op.id);
} else {
this.$toolAll.tools.showToast('参数不合法');
// 获取商品id
this.goods_id = op.id;
}
},
onShow: function onShow() {
// 查询商品详情
this.getGoodsDetail(this.goods_id);
},
onShareAppMessage: function onShareAppMessage(res) {
var shareObj = {
title: '老农极鲜',
path: uni.getStorageSync('page-path-options') + '?invite_code=' + uni.getStorageSync('invite_code'),
imageUrl: '/static/img/shear-index.jpg' };
title: this.goodsDetail.name,
path: this.type == 'release' ? uni.getStorageSync('page-path-options').substring(0, uni.getStorageSync('page-path-options').indexOf("&")) : uni.getStorageSync('page-path-options'),
imageUrl: this.goodsDetail.cover };
// 返回shareObj
return shareObj;
},
onShareTimeline: function onShareTimeline(res) {
var shareObj = {
title: '老农极鲜',
query: '?invite_code=' + uni.getStorageSync('invite_code'),
path: uni.getStorageSync('page-path-options') + '?invite_code=' + uni.getStorageSync('invite_code'),
imageUrl: '/static/img/shear-index.jpg' };
title: this.goodsDetail.name,
path: this.type == 'release' ? uni.getStorageSync('page-path-options').substring(0, uni.getStorageSync('page-path-options').indexOf("&")) : uni.getStorageSync('page-path-options'),
imageUrl: this.goodsDetail.cover };
// 返回shareObj
return shareObj;
@ -284,7 +285,7 @@ var _default =
// 编辑
editEv: function editEv(id) {
uni.navigateTo({
url: "/pages/release/release?id=".concat(id) });
url: "/pages/idle/release?id=".concat(id) });
},
@ -293,9 +294,11 @@ var _default =
this.$requst.post('/api/v1/goods/del', { id: id }).then(function (res) {
if (res.code == 0) {
_this2.$toolAll.tools.showToast('删除成功');
uni.navigateTo({
url: "/pages/goods/goods" });
setTimeout(function () {
uni.navigateTo({
url: "/pages/goods/goods" });
}, 500);
}
});
} } };exports.default = _default;

View File

@ -181,32 +181,14 @@ __webpack_require__.r(__webpack_exports__);
page: 1, //页数
size: 10, //条数
total: 0, //总数
isLoading: false //是否加载完成
isLoading: false, //是否加载完成
flag: true //改变状态
};
},
onShow: function onShow() {
// 查询商品列表
this.getGoodsList();
},
onShareAppMessage: function onShareAppMessage(res) {
var shareObj = {
title: '老农极鲜',
path: uni.getStorageSync('page-path-options') + '?invite_code=' + uni.getStorageSync('invite_code'),
imageUrl: '/static/img/shear-index.jpg' };
// 返回shareObj
return shareObj;
},
onShareTimeline: function onShareTimeline(res) {
var shareObj = {
title: '老农极鲜',
query: '?invite_code=' + uni.getStorageSync('invite_code'),
path: uni.getStorageSync('page-path-options') + '?invite_code=' + uni.getStorageSync('invite_code'),
imageUrl: '/static/img/shear-index.jpg' };
// 返回shareObj
return shareObj;
},
onReachBottom: function onReachBottom(e) {
if (this.goodsList.length < this.total) {
this.page++;
@ -236,7 +218,8 @@ __webpack_require__.r(__webpack_exports__);
cover: item.cover,
name: item.title,
original_price: item.original_price,
price: item.price };
price: item.price,
status: item.status };
goodsArr.push(obj);
});
@ -248,13 +231,24 @@ __webpack_require__.r(__webpack_exports__);
},
// 更改显示状态
changeStateEv: function changeStateEv(id, index) {
if (this.goodsList[index].state == 0) {
this.goodsList[index].state = 1;
this.$toolAll.tools.showToast('状态变更成功');
} else {
this.goodsList[index].state = 0;
this.$toolAll.tools.showToast('状态变更成功');
changeStateEv: function changeStateEv(id, index) {var _this2 = this;
if (this.flag) {
this.flag = false;
this.$requst.post('/api/v1/goods/set-status', { id: id, status: this.goodsList[index].status == 0 ? 1 : 0 }).then(function (res) {
if (res.code == 0) {
console.log(res, '改变状态');
if (_this2.goodsList[index].status == 0) {
_this2.goodsList[index].status = 1;
_this2.$toolAll.tools.showToast('已隐藏');
} else {
_this2.goodsList[index].status = 0;
_this2.$toolAll.tools.showToast('已展示');
}
}
});
setTimeout(function () {
_this2.flag = true;
}, 500);
}
},

View File

@ -202,25 +202,25 @@ __webpack_require__.r(__webpack_exports__);
// 查询商品列表
this.getGoodsList();
} else {
// 查询小区列表
this.getEstateList();
uni.navigateTo({
url: '/pages/estate/estate?estate=1' });
}
},
onShareAppMessage: function onShareAppMessage(res) {
var shareObj = {
title: '老农极鲜',
path: uni.getStorageSync('page-path-options') + '?invite_code=' + uni.getStorageSync('invite_code'),
imageUrl: '/static/img/shear-index.jpg' };
title: '小区闲置',
path: uni.getStorageSync('page-path-options'),
imageUrl: '/static/share-logo.png' };
// 返回shareObj
return shareObj;
},
onShareTimeline: function onShareTimeline(res) {
var shareObj = {
title: '老农极鲜',
query: '?invite_code=' + uni.getStorageSync('invite_code'),
path: uni.getStorageSync('page-path-options') + '?invite_code=' + uni.getStorageSync('invite_code'),
imageUrl: '/static/img/shear-index.jpg' };
title: '小区闲置',
path: uni.getStorageSync('page-path-options'),
imageUrl: '/static/share-logo.png' };
// 返回shareObj
return shareObj;
@ -233,20 +233,8 @@ __webpack_require__.r(__webpack_exports__);
}
},
methods: {
// 查询小区列表
getEstateList: function getEstateList() {var _this = this;
this.$requst.get('/api/v1/goods/area').then(function (res) {
if (res.code == 0) {
_this.area_id = res.data.list[0].id;
_this.pageTitle = res.data.list[0].title + '-闲置商品';
// 查询商品列表
_this.getGoodsList();
}
});
},
// 查询商品列表
getGoodsList: function getGoodsList() {var _this2 = this;
getGoodsList: function getGoodsList() {var _this = this;
uni.showLoading({
title: '加载中' });
@ -259,7 +247,7 @@ __webpack_require__.r(__webpack_exports__);
this.$requst.get('/api/v1/goods/list', params).then(function (res) {
if (res.code == 0) {
console.log(res, '闲置商品列表');
_this2.total = res.data.total;
_this.total = res.data.total;
var goodsArr = [];
res.data.list.forEach(function (item) {
var obj = {
@ -271,10 +259,10 @@ __webpack_require__.r(__webpack_exports__);
goodsArr.push(obj);
});
_this2.goodsList = _this2.goodsList.concat(goodsArr);
_this.goodsList = _this.goodsList.concat(goodsArr);
}
uni.hideLoading();
_this2.isLoading = true;
_this.isLoading = true;
});
} } };exports.default = _default;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))

View File

@ -243,11 +243,13 @@ var _default =
goodsDetail: {}, //商品详情
cover: '', //封面图
goodsImg: [], //商品图片
phone: '', //联系电话
isEdit: false, //是否编辑进入
isLoading: false, //是否记载完成
page: 1, //页数
size: 100, //条数
StagingImg: '' //暂存img
StagingImg: '', //暂存img
goods_id: -1 //商品id
};
},
onLoad: function onLoad(op) {
@ -255,36 +257,28 @@ var _default =
// 判断是否是编辑进入
this.isEdit = true;
this.pageTitle = '编辑商品';
// 获取商品id
this.goods_id = op.id;
} else {
this.pageTitle = '新增商品';
// 获取用户信息
this.getUserInfo();
}
// 查询小区列表
this.getEstateList();
// 查询分类
this.getCateList();
},
onShareAppMessage: function onShareAppMessage(res) {
var shareObj = {
title: '老农极鲜',
path: uni.getStorageSync('page-path-options') + '?invite_code=' + uni.getStorageSync('invite_code'),
imageUrl: '/static/img/shear-index.jpg' };
// 返回shareObj
return shareObj;
},
onShareTimeline: function onShareTimeline(res) {
var shareObj = {
title: '老农极鲜',
query: '?invite_code=' + uni.getStorageSync('invite_code'),
path: uni.getStorageSync('page-path-options') + '?invite_code=' + uni.getStorageSync('invite_code'),
imageUrl: '/static/img/shear-index.jpg' };
// 返回shareObj
return shareObj;
},
methods: {
// 获取用户信息
getUserInfo: function getUserInfo() {var _this = this;
this.$requst.get('/api/v1/user/info').then(function (res) {
console.log(res, '用户信息');
if (res.code == 0) {
_this.phone = res.data.mobile;
}
});
},
// 查询小区列表
getEstateList: function getEstateList() {var _this = this;
getEstateList: function getEstateList() {var _this2 = this;
this.$requst.get('/api/v1/goods/area').then(function (res) {
if (res.code == 0) {
console.log(res, '小区列表');
@ -296,13 +290,16 @@ var _default =
estateArr.push(obj);
});
_this.estateList = _this.estateList.concat(estateArr);
_this2.estateList = _this2.estateList.concat(estateArr);
_this2.estateIndex = _this2.estateList.findIndex(function (item) {return item.id === uni.getStorageSync('area_id');});
// 查询分类
_this2.getCateList();
}
});
},
// 查询分类
getCateList: function getCateList() {var _this2 = this;
getCateList: function getCateList() {var _this3 = this;
if (this.page == 1) this.goodsList = [];
this.$requst.get('/api/v1/goods/category').then(function (res) {
if (res.code == 0) {
@ -315,51 +312,83 @@ var _default =
cateArr.push(obj);
});
_this2.cateList = cateArr;
_this3.cateList = cateArr;
if (_this3.isEdit) {
// 查询商品详情
_this3.getGoodsDetail(_this3.goods_id);
} else {
_this3.isLoading = true;
}
}
});
if (this.isEdit) {
// 查询商品详情
this.getGoodsDetail();
} else {
this.isLoading = true;
}
},
// 查询商品详情
getGoodsDetail: function getGoodsDetail() {var _this3 = this;
this.goodsDetail = {
name: '儿童自行车',
category_id: 3,
original_price: '120.00',
price: '30.00',
phone: '18683958573',
imgSrc: '/static/index-01.png,/static/index-02.png,/static/index-03.png',
msg: '九成新儿童自行车,现在小孩到了,已经用不到了,有需要的可以联系哟!' };
getGoodsDetail: function getGoodsDetail(id) {var _this4 = this;
this.$requst.get('/api/v1/goods/detail', { id: id }).then(function (res) {
if (res.code == 0) {
console.log(res, '闲置商品详情');
// 获取图片
_this4.goodsImg = res.data.images;
// 获取电话
_this4.phone = res.data.phone;
// 获取封面图
_this4.cover = res.data.cover;
// 获取当前分类
_this4.cateIndex = _this4.cateList.findIndex(function (item) {return item.name === res.data.category_name;});
// 获取当前小区
_this4.estateIndex = _this4.estateList.findIndex(function (item) {return item.name === res.data.area_name;});
// 获取商品详情
_this4.goodsDetail = {
id: res.data.id,
name: res.data.title,
original_price: parseFloat(res.data.original_price),
price: parseFloat(res.data.price),
msg: res.data.content };
// 获取图片
// this.goodsImg = this.goodsDetail.imgSrc.split(',');
// 获取当前分类
this.cateIndex = this.cateList.findIndex(function (item) {return item.id === _this3.goodsDetail.category_id;});
this.isLoading = true;
}
_this4.isLoading = true;
});
},
// 新增闲置商品
addGoodsEv: function addGoodsEv() {
// 新增or编辑闲置商品
addGoodsEv: function addGoodsEv() {var _this5 = this;
var params = {
id: this.goods_id !== -1 ? this.goods_id : '',
title: this.goodsDetail.name,
cover: this.cover,
category_id: this.goodsDetail.category_id,
area_id: this.goodsDetail.area_id,
phone: this.goodsDetail.phone,
category_id: this.cateList[this.cateIndex].id,
area_id: this.estateList[this.estateIndex].id,
phone: this.phone,
original_price: this.goodsDetail.original_price,
price: this.goodsDetail.price,
// images:this.goodsImg.toString().replace(','),
images: this.goodsImg.join(','),
content: this.goodsDetail.msg };
this.$requst.post('/api/v1/goods/add', params).then(function (res) {
this.$requst.post(this.isEdit ? '/api/v1/goods/edit' : '/api/v1/goods/add', params).then(function (res) {
if (res.code == 0) {
if (_this5.isEdit) {
_this5.$toolAll.tools.showToast('修改成功');
setTimeout(function () {
uni.navigateBack({
delta: 1,
fail: function fail() {
uni.reLaunch({
url: '/pages/idle/idle' });
} });
}, 500);
} else {
_this5.$toolAll.tools.showToast('添加成功');
setTimeout(function () {
uni.reLaunch({
url: '/pages/idle/idle' });
}, 500);
}
} else {
_this5.$toolAll.tools.showToast(res.msg);
}
});
},
@ -375,36 +404,31 @@ var _default =
},
// 选择图片
changeImg: function changeImg(type) {var _this4 = this;
changeImg: function changeImg(type) {var _this6 = this;
if (type == 'cover') this.cover = '';
uni.chooseImage({
count: 1, //默认9
sourceType: ['album', 'camera'], //从相册选择
success: function success(res) {
_this4.StagingImg = res.tempFilePaths[0];
_this6.StagingImg = res.tempFilePaths[0];
// 上传图片
_this4.uploadImg(type);
_this6.uploadImg(type);
} });
},
// 上传图片
uploadImg: function uploadImg(type) {var _this5 = this;
uploadImg: function uploadImg(type) {var _this7 = this;
uni.showLoading({
title: '上传中' });
this.$requst.upload('/api/v1/file/upload/image', { path: this.StagingImg }).then(function (res) {
if (res.code == 0) {
console.log(_this5.$hostHttp + res.data.src, 1111);
if (type == 'cover') {
_this5.cover = _this5.$hostHttp + res.data.src;
_this7.cover = _this7.$hostHttp + res.data.src;
}
if (type == 'img') {
var goodsObj = {};
goodsObj = {
imgSrc: _this5.$hostHttp + res.data.src };
_this5.goodsImg.push(goodsObj);
_this7.goodsImg.push(_this7.$hostHttp + res.data.src);
}
}
uni.hideLoading();

File diff suppressed because one or more lines are too long

View File

@ -186,7 +186,7 @@ var _default = { data: function data() {return { disclaimersHeight: "calc(100vh
getDisclaimers: function getDisclaimers() {var _this = this;uni.showLoading({
title: '加载中' });
this.$requst.get('/api/index/statement').then(function (res) {
this.$requst.get('/api/v1/index/statement').then(function (res) {
if (res.code == 0) {
_this.disclaimers = _this.$toolAll.tools.escape2Html(res.data.content);
} else {

View File

@ -14,8 +14,7 @@
display: block;
width: 224rpx;
height: 224rpx;
border-radius: 100%;
border: 2rpx solid #d8d8d8;
border-radius: 18.75%;
margin: 0 auto;
}
.logo-name.data-v-b237504c {

View File

@ -226,6 +226,7 @@ var _default = {
_this.mobile = res.data.mobile;
}
uni.hideLoading();
_this.isLoading = true;
});
},

View File

@ -230,9 +230,6 @@ var _default =
},
onLoad: function onLoad(op) {
this.getUserData();
},
onShow: function onShow() {
},
methods: {
// 获取用户信息

View File

@ -18,34 +18,10 @@
}
},
"compileType": "miniprogram",
"libVersion": "2.26.2",
"libVersion": "",
"appid": "wxf6f7c457ee92d2ac",
"projectname": "小区闲置",
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"game": {
"current": -1,
"list": []
},
"miniprogram": {
"current": 0,
"list": [
{
"name": "",
"path": "",
"query": "",
"id": 0
}
]
}
},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2

View File

@ -1,20 +1,4 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "老农极鲜土货",
"setting": {
"compileHotReLoad": true
},
"condition": {
"miniprogram": {
"list": [
{
"name": "",
"pathName": "pages/goods/detail",
"query": "id=0",
"launchMode": "default",
"scene": null
}
]
}
}
"libVersion": "2.25.4"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB