xbx #10

Merged
theluyuan merged 7 commits from xbx into master 2020-07-21 11:50:55 +00:00
8 changed files with 244 additions and 21 deletions

View File

@ -12,6 +12,12 @@ const install = (Vue, vm) => {
},
createLivesp({spec_name}){
return vm.$u.post("Streaming/createLivesp",{spec_name})
},
getStoreGoodsList(){
return vm.$u.post("article/getStoreGoodsList")
},
createChatRoom({chat_name,live_desc,spec,goods_id,cover_img}){
return vm.$u.post("Streaming/createChatRoom",{chat_name,live_desc,spec,goods_id,cover_img})
}
}
// 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下

View File

@ -0,0 +1,71 @@
<template>
<view class="item" @click="xuanzhongs">
<image :src="image"></image>
<view class="title u-line-1" >{{title}}</view>
<view class="info">
<text>{{price}}</text>
<text>销量{{num}}</text>
</view>
<u-checkbox class="xuanzhong" active-color="#FF7A15" :name="sid" v-model="xuanzhong" @change="xuanzhongs">
</u-checkbox>
</view>
</template>
<script>
export default {
name:"shop-item",
data(){
return {
xuanzhong:false,
}
},
props:['image','title','price','num','sid'],
methods:{
xuanzhongs(){
this.xuanzhong = !this.xuanzhong
this.$emit("xuanzhong")
}
}
}
</script>
<style lang="scss" scoped>
.item{
width: 214rpx;
// height: 297rpx;
background-color: #fff;
border-radius:10rpx 10rpx 0 0;
padding-bottom: 14rpx;
overflow: hidden;
position: relative;
>image{
width: 100%;
height: 207rpx;
}
.title{
width: 194rpx;
margin: 19rpx auto;
margin-bottom: 0;
font-size: 26rpx;
color: #333;
}
.info{
display: flex;
padding: 0 10rpx;
align-items: flex-end;
justify-content: space-between;
>text:first-child{
font-size: 26rpx;
color: #FF3131;
}
>text:last-child{
font-size: 20rpx;
color: #999;
}
}
.xuanzhong{
position: absolute;
left: 8rpx;
top: 8rpx;
}
}
</style>

View File

@ -5,7 +5,7 @@
<view class="titles">标签</view>
<view class="form-view" @click="show_add()">+ 新建标签</view>
<view class="form-view" :class=" {'cur': rSelect.indexOf(item.id)!=-1} " @tap="tapInfo(item.id)" v-for="(item,index) in fileListes"
:key="index">{{item.spec_name}}</view>
:key="index">{{item.name}}</view>
</view>
<!-- 添加标签的按钮 -->
<u-popup v-model="show" mode="center" border-radius="14" :closeable="true">
@ -15,8 +15,10 @@
<view class="u-inputes">
<u-input v-model="form.name" />
</view>
<u-button class="custom-style-button" shape="circle" size="default">确定</u-button>
<u-button class="custom-style-button" shape="circle" size="default" @click="chuangjian">确定</u-button>
</u-popup>
<u-toast ref="uToast" />
</view>
</template>
@ -50,6 +52,25 @@
} else {
this.rSelect.splice(this.rSelect.indexOf(e), 1); //
}
this.$emit("qiehuan",this.rSelect)
},
chuangjian(){
this.$u.api.createLivesp({spec_name:this.form.name}).then((res)=>{
if(res.errCode != 0){
this.$refs.uToast.show({
title: res.message,
type: 'error'
})
}else{
this.show_add()
this.$refs.uToast.show({
title: res.message,
type: 'success'
})
this.$emit("chuangjian")
}
})
}
}
}

View File

@ -19,4 +19,4 @@ Vue.use(httpInterceptor, app)
import httpApi from '@/common/http.api.js'
Vue.use(httpApi, app)
app.$mount()
app.$mount()

View File

@ -195,6 +195,18 @@
}
}
}
},
{
"path": "pages/release/selectshop",
"style": {
"navigationBarTitleText": "选择商品",
"app-plus": {
"titleNView": {
"backgroundColor": "#2D2D2D",
"titleColor": "#FFFFFF"
}
}
}
}
],
"globalStyle": {

View File

@ -167,6 +167,9 @@ export default {
},
methods: {
release(){
this.publishstate = true
},
publish(){
},
@ -177,13 +180,6 @@ export default {
name: e[1].label
}
},
//
release(){
// uni.navigateTo({
// url: '/pages/release/tosign'
// });
this.publishstate = true
},
tabsChange(index) {
this.swiperCurrent = index;
},

View File

@ -0,0 +1,89 @@
<template>
<view class="selectshop">
<view class="title">我的商品</view>
<u-checkbox-group>
<view class="list">
<shopItem @xuanzhong="xuanzhong" class="items" v-for="(i,j) in list" :key="j" :image="i.goods_image" :title="i.goods_name" :price="i.goods_marketprice" :num="i.goods_salenum" :sid="i.goods_id" ref="shop"></shopItem>
</view>
</u-checkbox-group>
<view class="jiaru" @click="jiaru">加入售货袋</view>
</view>
</template>
<script>
import shopItem from "../../components/release/shop-item"
export default {
name:"selectshop",
data(){
return {
list:[],
sele:[]
}
},
components:{
shopItem
},
methods:{
xuanzhong(){
// console.log(this.$refs.shop)
this.sele = []
for(let i of this.$refs.shop){
// console.log(i)
if(i.xuanzhong){
this.sele.push(i.sid)
}
}
console.log(this.sele)
},
jiaru(){
let that = this
uni.setStorageSync("gouwudai",that.sele.join(","))
this.$u.route({
type:"back",
delta:1
})
}
},
onLoad(){
this.$u.api.getStoreGoodsList().then((res)=>{
this.list = res.data.list
})
}
}
</script>
<style lang="scss" scoped>
.selectshop{
padding: 15rpx 30rpx;
padding-left: 6rpx;
background-color: #2D2D2D;
min-height: calc(100vh - 45px);
.title{
color: #FF780F;
font-size: 30rpx;
font-weight: 400;
margin-left: 26rpx;
}
.list{
display: flex;
flex-wrap: wrap;
margin-top: 35rpx;
.items{
margin-left: 24rpx;
margin-bottom: 30rpx;
}
}
.jiaru{
position: fixed;
bottom: 33rpx;
right: 30rpx;
height: 80rox;
width: 348rpx;
background-color: #999;
font-size: 36rpx;
line-height: 80rpx;
text-align: center;
color: #fff;
border-radius: 40rpx;
}
}
</style>

View File

@ -22,16 +22,16 @@
<view class="values"><text>{{max_two}}</text>/20</view>
<u-form-item label-position="right">
<u-input v-model="form.values" placeholder="我的售货袋" />
<view class="rightes">售货袋</view>
<view class="rightes" @click="navto('selectshop')">售货袋</view>
</u-form-item>
</u-form>
<!-- 标签的引入 -->
<tap_tosign :fileListes="fileListes"></tap_tosign>
<tap_tosign :fileListes="fileListes" @chuangjian="chuangjian" @qiehuan="qiehuan"></tap_tosign>
<view class="titles">直播封面图</view>
<u-upload :max-count="1" :show-progress="true" del-color="#ececec" upload-text="上传" del-bg-color="#fff"></u-upload>
<u-upload :form-data="{'name':'article_cover'}" action='https://dmmall.sdbairui.com/storeapi/Upload/uploadFile' name="article_cover" :max-count="1" :show-progress="false" :before-upload="tupian" del-color="#ececec" upload-text="上传" del-bg-color="#fff"></u-upload>
</view>
<view class="button-uview">
<u-button>{{relerest}}</u-button>
<u-button @click="kaibo">{{relerest}}</u-button>
</view>
</view>
</view>
@ -57,8 +57,8 @@
titleMaxLength : '20',
show: false,
relerest: '开始直播',
fileListes:[]
fileListes:[],
rSelect:[]
};
},
methods: {
@ -71,7 +71,7 @@
// console.log(e);
},
mask_u() {
this.show = !this.show
},
//
getCode() {
@ -79,6 +79,37 @@
},
loading() {
},
qiehuan(a){
// console.log(a)
this.rSelect = a
},
chuangjian(){
this.init()
},
tupian(a){
console.log(a)
},
navto(url){
this.$u.route({
url:"/pages/release/" + url
})
},
kaibo(){
this.$u.api.createChatRoom({
chat_name:this.max,
live_desc:this.form.text,
spec:this.rSelect.join(","),
goods_id:uni.getStorageSync("gouwudai"),
})
},
init(){
this.$u.api.getLiveSpec().then((res)=>{
console.log(res)
this.fileListes = res.data
})
}
},
components: {
@ -92,10 +123,7 @@
}
},
onLoad(){
this.$u.api.getLiveSpec().then((res)=>{
console.log(res)
this.fileListes = res.data
})
this.init()
}
};
</script>