Commit c0ff0dc5 by 赵雅纹

种草专区

parent 77cedff3
...@@ -9,7 +9,10 @@ Component({ ...@@ -9,7 +9,10 @@ Component({
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
proGoods: { // 显示标识
type: Array,
value: false
}
}, },
attached () { attached () {
......
<!--component/grassItem/grassItem.wxml--> <!--component/grassItem/grassItem.wxml-->
<view class="grass-item weui-flex border_box"> <block wx:for="{{proGoods}}" wx:key="{{index}}">
<view class="grass-item weui-flex border_box">
<view class="grass-img-box"> <view class="grass-img-box">
<image class="grass-img" src="./../../assets/imgs/7_1_0/scancode.png" mode="widthFix" lazy-load="false" binderror="" bindload="" /> <image class="grass-img" src="{{item.indexUrl}}" mode="widthFix" lazy-load="false" binderror="" bindload="" />
</view> </view>
<view class="grass-item-desc border_box"> <view class="grass-item-desc border_box">
<view class="item-name">商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称商品名称</view> <view class="item-name">{{item.productName}}</view>
</view> </view>
</view> </view>
</block>
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
overflow: hidden; overflow: hidden;
background-color: rgba(255, 255, 255, 1); background-color: rgba(255, 255, 255, 1);
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1); box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
margin-top: 25rpx;
}
.grass-item:first-child{
margin-top: 0;
} }
.grass-img-box, .grass-img { .grass-img-box, .grass-img {
width: 200rpx; width: 200rpx;
...@@ -16,15 +20,10 @@ ...@@ -16,15 +20,10 @@
margin-left: 28rpx; margin-left: 28rpx;
} }
.item-name { .item-name {
color: rgba(0, 0, 0, 1);
font-family: PingFangSC-Light; font-family: PingFangSC-Light;
padding: 20rpx 0 20rpx 0; padding: 20rpx 0 20rpx 0;
width: 459rpx; width: 459rpx;
height: 74rpx; height: 74rpx;
color: rgba(0, 0, 0, 1); color: rgba(0, 0, 0, 1);
font-size: 26rpx; font-size: 26rpx;
} }
...@@ -12,21 +12,28 @@ Component({ ...@@ -12,21 +12,28 @@ Component({
selectShow: { // 显示标识 selectShow: { // 显示标识
type: Boolean, type: Boolean,
value: false value: false
},
proList: { // 显示标识
type: Array,
value: ''
} }
}, },
attached () { attached () {
if (this.data.selectShow){
}
this.getProList()
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
isSelect:false, // isSelect:false,
proList:[] proList:[
// {
// indexUrl:'',
// productName:'111111',
// productId:'11'
// }
]
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
...@@ -34,29 +41,43 @@ Component({ ...@@ -34,29 +41,43 @@ Component({
methods: { methods: {
selectCoupon(e) { selectCoupon(e) {
console.log(e) console.log(e)
let params = { let proData = []
id: e.currentTarget.dataset.item let proList = this.data.proList
var index = e.currentTarget.dataset.index
if (proList[index].isSelect) {
proList[index].isSelect = false
} else {
proList[index].isSelect = true
} }
this.setData({ this.setData({
isSelect: !this.data.isSelect proList: proList
}) })
for (var i in proList){
if (proList[i].isSelect){
proData.push(proList[i])
}
}
console.log(proData)
wxService.nextTick(() => { wxService.nextTick(() => {
this.triggerEvent('_selectCoupon', params) this.triggerEvent('_selectCoupon', proData)
}) })
}, },
getProList(){ // getProList(){
wxService.post(`/sale/product/buyer/listWithMember`).then(res => { // wxService.post(`/sale/product/buyer/listWithMember`).then(res => {
const { result, data } = res.data // const { result, data } = res.data
if (result == 0) { // if (result == 0) {
this.setData({ // data.forEach(item => {
proList: data // item.isSelect = false
}) // })
console.log(data) // this.setData({
} // proList: data
}).finally(() => { // })
}) // console.log(data)
// }
// }).finally(() => {
// })
} // }
} }
}) })
<block wx:for="{{proList}}" wx:key="{{index}}"> <block wx:for="{{proList}}" wx:key="{{index}}">
<view class="grass-item weui-flex border_box" bindtap="selectCoupon" data-item="{{item.item}}"> <view class="grass-item weui-flex border_box" bindtap="selectCoupon" data-index="{{index}}">
<view class="grass-img-box"> <view class="grass-img-box">
<image <image
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
<!-- <view class="item-notice">预计赚5元红包</view> --> <!-- <view class="item-notice">预计赚5元红包</view> -->
</view> </view>
<view class="select-radio"> <view class="select-radio">
<view class="{{isSelect ? 'theme-color' : ''}} coupon-radio"> <view class="{{item.isSelect ? 'theme-color' : ''}} coupon-radio">
<image <image
wx:if="{{isSelect}}" wx:if="{{item.isSelect}}"
class="tick-success" class="tick-success"
src="/assets/imgs/7_1_0/tick-success.png" src="/assets/imgs/7_1_0/tick-success.png"
mode="widthFix" mode="widthFix"
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
overflow: hidden; overflow: hidden;
background-color: rgba(255, 255, 255, 1); background-color: rgba(255, 255, 255, 1);
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1); box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
margin-top: 25rpx;
position: relative;
} }
.grass-img-box, .grass-img { .grass-img-box, .grass-img {
width: 200rpx; width: 200rpx;
...@@ -142,6 +144,8 @@ ...@@ -142,6 +144,8 @@
border: 1rpx solid rgba(0, 0, 0, 0.2); border: 1rpx solid rgba(0, 0, 0, 0.2);
line-height: 26rpx; line-height: 26rpx;
text-align: center; text-align: center;
position: absolute;
right: 0rpx;
} }
.tick-success{ .tick-success{
width: 18rpx; width: 18rpx;
......
// component/selectRelatedGoods/selectRelatedGoods.js // component/selectRelatedGoods/selectRelatedGoods.js
var app = getApp()
const wxService = require('../../utils/wxService')
const utils = require('../../utils/util')
const envInfo = require('../../config/index').envInfo
Component({ Component({
/** /**
* 组件的属性列表 * 组件的属性列表
...@@ -7,6 +12,10 @@ Component({ ...@@ -7,6 +12,10 @@ Component({
show: { // 显示标识 show: { // 显示标识
type: Boolean, type: Boolean,
value: false value: false
},
proGoods: { // 显示标识
type: Array,
value: ''
} }
}, },
...@@ -14,39 +23,101 @@ Component({ ...@@ -14,39 +23,101 @@ Component({
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
isSelect:false, proList:[],
proList:[] proData:[],
productName:''
},
attached() {
this.getProList()
},
observers: {
proGoods(val) {
for (var i in this.data.proList){
for(var j in val){
if (this.data.proList[i].productId == val[j].productId){
this.data.proList[i].isSelect = true
}
this.setData({
proList: this.data.proList
})
}
}
}
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
selectCoupon() {
console.log('2222')
this.setData({
isSelect: !this.data.isSelect
})
},
hidePopup: function () { // 隐藏弹出框 hidePopup: function () { // 隐藏弹出框
this.setData({ this.setData({
show: false show: false
}) })
}, },
_selectCoupon(e){ _selectCoupon(e){
console.log(e)
this.setData({ this.setData({
item: e.detail.item proData: e.detail
}) })
}, },
confirm(){ confirm(){
this.setData({ if (this.data.proData.length < 1){
show: false, wx.showToast({
proList:this.data.item title: '请选择关联商品',
icon: 'none'
}) })
return false;
} }
this.setData({
show: false
})
wxService.nextTick(() => {
this.triggerEvent('_selectGoods', this.data.proData)
})
},
// 点击键盘完成时触发
onTapConfirm(e){
console.log(e)
this.setData({
productName: e.detail.value
})
}, },
// search
search(){
console.log(this.data.productName)
if(!this.data.productName){
wx.showToast({
title: '请输入商品名称',
icon:'none'
})
return false
}
this.getProList()
},
// 搜索商品
getProList() {
wxService.post(`/sale/product/buyer/listWithMember`,{
productName: this.data.productName
}).then(res => {
const { result, data } = res.data
if (result == 0) {
data.forEach(item => {
item.isSelect = false
})
this.setData({
proList: data
})
console.log(data)
}
}).finally(() => {
})
}
},
}) })
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view class="modal-content{{show ? ' active' : ''}}"> <view class="modal-content{{show ? ' active' : ''}}">
<view class="modal-header"> <view class="modal-header">
<image src="/assets/imgs/7_1_0/arrow-right.png" class="modal-to-back" mode="widthFix" /> <image src="/assets/imgs/7_1_0/arrow-right.png" class="modal-to-back" mode="widthFix" bindtap="hidePopup" />
<text class="modal-title">选择订单商品</text> <text class="modal-title">选择订单商品</text>
<image <image
class="modal-close" class="modal-close"
...@@ -14,15 +14,15 @@ ...@@ -14,15 +14,15 @@
<view class="modal-info"> <view class="modal-info">
<view class="order-input weui-flex weui-progress"> <view class="order-input weui-flex weui-progress">
<input class="order-name border_box" placeholder=" 请输入商品名称" auto-focus /> <input class="order-name border_box" placeholder=" 请输入商品名称" value="{{productName}}" bindblur="onTapConfirm"/>
<text class="order-search">搜索</text> <text class="order-search" bindtap="search">搜索</text>
</view> </view>
<view class="coupon-list" bindtap="selectCoupon"> <view class="coupon-list">
<relate-order-item selectShow="{{show}}" bind:_selectCoupon="_selectCoupon" /> <relate-order-item wx:if="{{proList && proList.length > 0}}" bind:_selectCoupon="_selectCoupon" selectShow="{{show}}" proList="{{proList}}" />
</view> </view>
<view class="empty-coupon"> <view class="empty-coupon" wx:if="{{!proList || proList.length < 1}}">
暂无订单 暂无订单
</view> </view>
</view> </view>
......
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
margin-top: 95rpx; margin-top: 95rpx;
} }
.modal-info { .modal-info {
max-height: 900rpx; min-height: 900rpx;
overflow: scroll; overflow: scroll;
} }
.empty-coupon { .empty-coupon {
......
...@@ -13,31 +13,91 @@ wxService.page({ ...@@ -13,31 +13,91 @@ wxService.page({
data: { data: {
pics:[], pics:[],
showSelectRelatedGoods: false, showSelectRelatedGoods: false,
proGoods:[],
params:{ params:{
article: "", article: "",
describe: "",
headline: "", headline: "",
id: 0, sspList: [],
sspList: [ stcList: [],
{
cover: 0,
url: ""
}
],
stcList: [
{
commodityId: 0
}
],
userId: memberId userId: memberId
} },
pageNo:1,
pageSize:100
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
console.log(options)
if(options && options.id){
this.setData({
'params.id': options.id
})
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
if (this.data.params.id) {
this.getInitInfo()
}
},
// 获取编辑详情
getInitInfo(){
let params = {
id: this.data.params.id,
userId: memberId
}
wxService.post(`/merchant/contentMobileTerminal/terminalContentDetails`, params).then(res => {
const { result, data } = res.data
if (result == 0) {
this.setData({
params:{
article: data.article,
headline: data.headline,
sspList: data.sspList,
userId: memberId,
id:data.id
}
})
for (var i in data.sspList){
this.data.pics.push(app.globalData.imageUrl + data.sspList[i].url)
}
this.setData({
pics: this.data.pics
})
this.getInitPro(data.productIds)
}
}).finally(() => {
})
},
// 获取关联商品
getInitPro(productIds){
wxService.post(`/sale/product/buyer/listPage?pageNo=${this.data.pageNo}&pageSize=${this.data.pageSize}`,{
productIds: productIds
}).then(res => {
const { result, data } = res.data
if (result == 0 && data.content) {
this.setData({
proGoods: data.content
})
let stcList = []
for (var i in this.data.proGoods) {
stcList.push({
commodityId: this.data.proGoods[i].productId
})
this.setData({
'params.stcList': stcList
})
}
}
}).finally(() => {
})
}, },
/** /**
...@@ -83,12 +143,26 @@ wxService.page({ ...@@ -83,12 +143,26 @@ wxService.page({
} }
}) })
}, },
/**
* 生命周期函数--监听页面显示 // 关联商品
*/ _selectGoods(e){
onShow: function () { console.log('444',e)
this.setData({
proGoods: e.detail
})
let stcList = []
for (var i in this.data.proGoods) {
stcList.push({
commodityId: this.data.proGoods[i].productId
})
this.setData({
'params.stcList': stcList
})
}
}, },
//多张图片上传 //多张图片上传
moreImgUpload(data) { moreImgUpload(data) {
var that = this, var that = this,
...@@ -101,25 +175,29 @@ wxService.page({ ...@@ -101,25 +175,29 @@ wxService.page({
header : { header : {
'buyer-token' : wx.getStorageSync('token') 'buyer-token' : wx.getStorageSync('token')
}, },
name: 'file',//这里根据自己的实际情况改 name: 'imgs',//这里根据自己的实际情况改
formData: null,//这里是上传图片时一起上传的数据 formData: null,//这里是上传图片时一起上传的数据
success: (resp) => { success: (resp) => {
success++;//图片上传成功,图片上传成功的变量+1 success++;//图片上传成功,图片上传成功的变量+1
console.log(resp)
console.log(i);
//这里可能有BUG,失败也会执行这里,所以这里应该是后台返回过来的状态码为成功时,这里的success才+1
}, },
fail: (res) => { fail: (res) => {
fail++;//图片上传失败,图片上传失败的变量+1 fail++;//图片上传失败,图片上传失败的变量+1
console.log('fail:' + i + "fail:" + fail);
}, },
complete: () => { complete: (res) => {
console.log(i); i++;
i++;//这个图片执行完上传后,开始上传下一张 var imgdata = JSON.parse(res.data);
var img = imgdata.data[0];
var sspList = []
sspList.push({
cover:0,
url:img.url
});
if (i == data.path.length) { //当图片传完时,停止调用 if (i == data.path.length) { //当图片传完时,停止调用
console.log('执行完毕'); that.setData({
console.log('成功:' + success + " 失败:" + fail); 'params.sspList': sspList
} else {//若图片还没有传完,则继续调用函数 })
console.log('=====', that.data.params.sspList)
}else {//若图片还没有传完,则继续调用函数
console.log(i); console.log(i);
data.i = i; data.i = i;
data.success = success; data.success = success;
...@@ -132,7 +210,13 @@ wxService.page({ ...@@ -132,7 +210,13 @@ wxService.page({
// 发布笔记 // 发布笔记
formSubmit(e){ formSubmit(e){
console.log(e) wxService.post(`/merchant/contentMobileTerminal/contentSave`, this.data.params).then(res => {
const { result, data } = res.data
if (result == 0) {
wxService.router('/subPackage/page/pages/myRelease/myRelease')
}
}).finally(() => {
})
} }
}) })
\ No newline at end of file
<!--subPackage/page/pages/grassCommunity/grassCommunity.wxml--> <!--subPackage/page/pages/grassCommunity/grassCommunity.wxml-->
<form bindsubmit="formSubmit"> <!-- <form bindsubmit="formSubmit"> -->
<view class="grass-community border_box"> <view class="grass-community border_box">
<view class="page-upload-img"> <view class="page-upload-img">
<view class="flex-wrp"> <view class="flex-wrp">
...@@ -27,10 +27,10 @@ ...@@ -27,10 +27,10 @@
<view class="related-goods" bindtap="handleRelatedGoods">关联商品</view> <view class="related-goods" bindtap="handleRelatedGoods">关联商品</view>
<view class="gress-list"> <view class="gress-list">
<grass-item/> <grass-item pro-goods="{{proGoods}}"/>
</view> </view>
</view> </view>
<button class="post-notes fixed-bottom0" form-type="submit">发布笔记</button> <button class="post-notes fixed-bottom0" bindtap="formSubmit">发布笔记</button>
</form> <!-- </form> -->
<select-related-goods show="{{showSelectRelatedGoods}}" /> <select-related-goods show="{{showSelectRelatedGoods}}" bind:_selectGoods="_selectGoods" pro-goods="{{proGoods}}"/>
...@@ -34,16 +34,41 @@ wxService.page({ ...@@ -34,16 +34,41 @@ wxService.page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
this.getBannerInfo()
this.getContentList() this.getContentList()
}, },
// banner
getBannerInfo(){
const { memberId } = wx.getStorageSync('_baseUserInfo')
wxService.post(`/merchant/contentMobileTerminal/getBannerAndInviteSum`, {
userId: memberId
}).then(res => {
if (!res) return false
const { result, data } = res.data
if (result == 0) {
this.setData({
bannerUrl: data.bannerUrl,
inviteSum: data.inviteSum,
yesterdayInviteSum: data.yesterdayInviteSum
})
}
}).finally(() => {
})
},
// 获取发现内容 // 获取发现内容
getContentList() { getContentList() {
wx.showLoading({
title: '加载中'
})
const { memberId } = wx.getStorageSync('_baseUserInfo') const { memberId } = wx.getStorageSync('_baseUserInfo')
wxService.post(`/merchant/contentMobileTerminal/getContentList?pageNum=${this.data.pageNum}&pageSize=${this.data.pageSize}`, { wxService.post(`/merchant/contentMobileTerminal/getContentList?pageNum=${this.data.pageNum}&pageSize=${this.data.pageSize}`, {
userId: memberId userId: memberId
}).then(res => { }).then(res => {
wx.hideLoading()
if (!res) return false if (!res) return false
const { result, data } = res.data const { result, data } = res.data
if (result == 0) { if (result == 0) {
...@@ -60,6 +85,7 @@ wxService.page({ ...@@ -60,6 +85,7 @@ wxService.page({
} }
} }
}).finally(() => { }).finally(() => {
wx.hideLoading()
}) })
}, },
......
<!--subPackage/page/pages/myRelease/myRelease.wxml--> <!--subPackage/page/pages/myRelease/myRelease.wxml-->
<view class="release-num weui-flex df-j--bt"> <view class="release-num weui-flex df-j--bt">
<view class="num-invite df-1 border_box"> <view class="num-invite df-1 border_box">
<view class="num">6</view> <view class="num">{{inviteSum}}</view>
<view class="desc">当前邀请人数</view> <view class="desc">当前邀请人数</view>
</view> </view>
<view class="num-invite-yesterday df-1 border_box"> <view class="num-invite-yesterday df-1 border_box">
<view class="num">1</view> <view class="num">{{yesterdayInviteSum}}</view>
<view class="desc">昨天邀请新增</view> <view class="desc">昨天邀请新增</view>
</view> </view>
</view> </view>
<view class="diy-banner"> <view class="diy-banner">
商户自定义banner <image src="{{bannerUrl}}" ></image>
</view> </view>
<navigator open-type="navigate" url="/subPackage/page/pages/grassCommunity/grassCommunity" > <navigator open-type="navigate" url="/subPackage/page/pages/grassCommunity/grassCommunity" >
<view class="add">+</view> <view class="add">+</view>
......
...@@ -16,12 +16,16 @@ ...@@ -16,12 +16,16 @@
width: 712rpx; width: 712rpx;
height: 200rpx; height: 200rpx;
border-radius: 17rpx; border-radius: 17rpx;
background-color: rgba(216, 216, 216, 1);
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1); box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
margin: 10rpx auto; margin: 10rpx auto;
text-align: center; text-align: center;
line-height: 200rpx; line-height: 200rpx;
} }
.diy-banner image{
width: 712rpx;
height: 200rpx;
border-radius: 17rpx;
}
.num { .num {
color: rgba(51, 51, 51, 1); color: rgba(51, 51, 51, 1);
font-size: 42rpx; font-size: 42rpx;
...@@ -46,3 +50,4 @@ ...@@ -46,3 +50,4 @@
right: 22rpx; right: 22rpx;
bottom: 35rpx; bottom: 35rpx;
} }
...@@ -27,7 +27,10 @@ ...@@ -27,7 +27,10 @@
<view class="weui-flex df-j--bt action border_box"> <view class="weui-flex df-j--bt action border_box">
<view class="weui-flex"> <view class="weui-flex">
<view class="action-del" bindtap="handleDel"> 删除 </view> <view class="action-del" bindtap="handleDel"> 删除 </view>
<navigator url="/subPackage/page/pages/grassCommunity/grassCommunity?id={{contentInfo.id}}" hover-class="none">
<view class="action-edit"> 编辑 </view> <view class="action-edit"> 编辑 </view>
</navigator>
</view> </view>
<view class="action-check"> 查看收益 </view> <view class="action-check"> 查看收益 </view>
</view> </view>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment