Commit c38505d0 authored by home's avatar home

zxh

parent 968f7c06
......@@ -131,7 +131,8 @@
defaultinfo:{},//修改的时候的默认初始数据
listchind:[
{name:"是否新产品",value:"is_new",checked:false},
{name:"是否热卖产品",value:"is_hot",checked:false},
{name:"是否热卖产品",value:"is_hot",checked:false},
{name:"是否是秒杀产品",value:"is_seckill",checked:false},
],
selchildList:[],
cate_name:"",
......@@ -266,6 +267,12 @@
can.is_hot = 1;
}else{
can.is_hot = 0;
}
if(this.selchildList.includes("is_hot")){
can.is_seckill = 1;
}else{
can.is_seckill = 0;
}
......
......@@ -23,7 +23,8 @@
<view class="xiaol">销量:{{item.sold_num}}</view>
</view>
<view class="btn">
<view class="btn_01" @tap="jump_edit(item)" >编辑</view>
<view class="btn_01" @tap="jump_edit(item)">编辑</view>
<view class="btn_01" @tap="pullfun(item,index)" v-if="current==0" >下架</view>
<view class="btn_01" @tap="pushfun(item,index)" v-if="current==1" >上架</view>
<view class="btn_01" @tap="delfun(item,index)" >删除</view>
......@@ -35,7 +36,7 @@
</block>
<view class="tjsp">
<navigator url="/pages/edit/product/addshop">
<navigator :url="'/pages/edit/product/addshop?activity_type='+this.activity_type" >
<view class="flex flex-direction">
<button class="cu-btn bg-red margin-tb-sm lg">添加商品</button>
</view>
......@@ -72,14 +73,16 @@
isshowall:true,
isselect:"2",
sendindex:"",
money_type:""
money_type:"",
activity_type:0
}
},
onLoad(opdata) {
console.info(opdata)
this.money_type=opdata.money_type;
this.money_type=opdata.money_type;
this.activity_type = opdata.activity_type//秒杀资格判断
if(opdata.isselect==1){
this.isselect = 1;
this.sendindex = opdata.sendindex;//插入索引
......@@ -98,8 +101,10 @@
onShow() {
this.page =0;
this.goodsListdata = [];
this.isshowall = true;
this.getgoodsListfun();
this.isshowall = true;
this.getgoodsListfun();
},
computed:{
staticUrl(){
......@@ -121,6 +126,8 @@
page:this.page,
});
if(res.code==0){
console.log(res);
if(res.data.length!=0){
this.goodsListdata = [...this.goodsListdata,...res.data];
......@@ -268,14 +275,17 @@
// }
// }
// })
},
},
//编辑产品
jump_edit(item) {
uni.navigateTo({
//url: '/pages/edit/product/product?id=' + id
url:"/pages/edit/product/addshop?id="+item.goods_id+'&money_type='+this.money_type,
url:"/pages/edit/product/addshop?id="+item.goods_id+'&money_type='+this.money_type+'&activity_type='+this.activity_type,
})
},
},
//tab切换事件
onClickItem(index) {
if (this.current !== index) {
......
......@@ -140,19 +140,60 @@
<view class="title">标识:</view>
<!-- 表特和类目 -->
<checkbox-group @change="checkboxChange">
<view class="chindlost ali-c flex flex-wrap">
<label class="lableitem flex ali-c" v-for="(item,index) in listchind" :key="index">
<view>
<checkbox color="#FF6900" :value="item.value" :checked="item.checked" />
</view>
<view class="titles">{{item.name}}</view>
</label>
</view>
<view class="chindlost ali-c flex flex-wrap" >
<label class="lableitem flex ali-c" v-for="(item,index) in listchind" :key="index">
<view>
<checkbox color="#FF6900" :value="item.value" :checked="item.checked" />
</view>
<view class="titles">{{item.name}}</view>
</label>
<view v-if="activity_type==1">
<label class="lableitem flex ali-c" v-for="item of listissetkill" :key="index">
<view>
<checkbox color="#FF6900" :value="item.value" :checked="item.checked" />
</view>
<view class="titles">{{item.name}}</view>
</label>
</view>
<!-- <view v-for="(item,index) in seckilltimelist">
<label class="lableitem flex ali-c">
<view>
<checkbox color="#FF6900" value="is_seckill" :checked="false" />
</view>
<view class="titles">{{item.title}}</view>
</label>
</view> -->
</view>
</checkbox-group>
</view>
<!-- 单选列表 -->
<view class="checkboxs" v-if="seckilltimelist.length !=0 ">
<view class="title">选择秒杀时段:</view>
<!-- scroll-view 与 picker-view 达成效果一致-->
<!-- <scroll-view scroll-y="true" >
<view class="chindlost ali-c flex flex-wrap" style="height: 200upx;margin-top: 40upx;">
<radio-group @change="radioChange">
<label class="lableitem flex ali-c" v-for="(item,index) in seckilltimelist" :key="index">
<view>
<radio :value="item.activity_id+''" />
</view>
<view class="titles">{{item.title}}</view>
</label>
</radio-group>
</view>
</scroll-view> -->
<picker-view indicator-style="height: 50px;" style="width: 100%; height: 200px;" @change="radioChange">
<picker-view-column>
<view v-for="(item,index) in seckilltimelist" :key="index" style="line-height: 50px; text-align: center;">{{item.title}}</view>
</picker-view-column>
</picker-view>
</view>
<!-- 多选end -->
<view class="submits active" @tap="geteditOk">发布商品</view>
<!-- create_goods -->
......@@ -167,7 +208,9 @@
import {getGoodsCate,addEditGoods,goodsDetails} from "@/utils/api/api.js";
import jinedit from "@/components/jinedit/jinedit.vue";
import jinedit from "@/components/jinedit/jinedit.vue";
import {getActivityList} from '@/utils/api/merchant.js';
export default {
components:{
......@@ -202,11 +245,18 @@
formData: {
"imgtype": "comment"
},
indexsss:0,
indexsss:0,
listchind:[
{name:"是否新产品",value:"is_new",checked:false},
{name:"是否热卖产品",value:"is_hot",checked:false},
],
{name:"是否热卖产品",value:"is_hot",checked:false},
// {name:"是否秒杀产品",value:"is_seckill",checked:false,status:1}, /* */
],
seckilltimelist:[], //秒杀时间列表
listissetkill:[{name:"是否秒杀产品",value:"is_seckill",checked:false}],
activity_type:0,
index:0,
idx:0,
idj:0,
......@@ -232,10 +282,14 @@
photos:"",//更多详情图
details:'',///商品详情(编辑器插件)
is_new:"0",//0 1 是否新产品
is_hot:"0",//0 1 是否热卖产品
action:"add",//方式(添加:add,修改:edit)
money:''
is_hot:"0",//0 1 是否热卖产品
is_seckill:"0",//0 1 是否秒杀产品
activity_id:'0',//秒杀activity_id
activity_list:'49,',//秒杀列表
action:"add",//方式(添加:add,修改:edit)
money:''
},
goodsCate:[],
shopCate:[],
......@@ -246,10 +300,13 @@
c_photosTwo:[],//更多图里面的数据
c_pics: [],//主图的数据
c_picsTwo:[],//更多详情图
issubmit:true,//重复提交开关
issubmit:true,//重复提交开关
selchildList:[],//勾选列表选中的值
isjiumodelshop:{},//修改信息的时候 默认的信息
isjiumodelshop:{},//修改信息的时候 默认的信息
};
},
computed: {
......@@ -267,8 +324,10 @@
},
onLoad(opdata) {
console.info(opdata)
this.money_type=opdata.money_type
console.info(opdata,2222222)
this.money_type=opdata.money_type
this.activity_type = opdata.activity_type
if(opdata.id!="" && opdata.id!=undefined){
this.canform.goods_id = opdata.id;//修改的商品id
this.canform.action = "edit";
......@@ -298,14 +357,28 @@
},
pickertow(){
this.$refs.picker1.show() // 显示
},
// 秒杀列表
async getActivityListfun(){
let res = await getActivityList({
// audit:1,
})
if(res.code==0){
console.log(res,3333)
this.seckilltimelist = res.data.head
// this.canform.activity_id = res.data.activity_id
}
},
//获取原来的商品详情信息
async goodsDetailsfun(){
let res = await goodsDetails({
goods_id:this.canform.goods_id,
});
if(res.code==0){
this.isjiumodelshop = res.data;//赋值
if(res.code==0){
console.log(res)
this.isjiumodelshop = res.data;//赋值
this.canform.title = res.data.title;
this.canform.intro = res.data.intro;
......@@ -346,7 +419,6 @@
data:"",
msg:"success",
time:"1587021687",
};
obj.data = item.photo;
this.c_photosTwo.push(item.photo);//默认值
......@@ -363,7 +435,14 @@
let listchind= [
{name:"是否新产品",value:"is_new",checked:res.data.is_new==1?true:false},
{name:"是否热卖产品",value:"is_hot",checked:res.data.is_hot==1?true:false},
];
];
// console.log(res.activity_list=="49,",res.data.activity_list);
let listissetkill =[{name:"是否秒杀产品",value:"is_seckill",checked:res.data.activity_list=="49,"?true:false}]
this.listissetkill = listissetkill;
this.listchind = listchind;
if(res.data.is_new==1){
......@@ -371,9 +450,7 @@
}
if(res.data.is_hot==1){
this.selchildList.push("is_hot");
}
}
}else{
this.$api.msg(res.msg);
......@@ -447,6 +524,8 @@
}
let selchildList = this.selchildList;
console.log(selchildList)
selchildList.forEach((item,index)=>{//勾选的两个
if(item=="is_new"){
......@@ -454,8 +533,10 @@
}
if(item=="is_hot"){
this.canform.is_hot= "1";
}
}
// if(item=="is_seckill"){
// this.canform.is_seckill= "1";
// }
})
// console.info(this.canform,"canform");
......@@ -463,12 +544,14 @@
//添加
console.log(this.canform.mall_price)
console.log(this.canform.price)
console.log(this.canform.price)
if(parseFloat(this.canform.price)<parseFloat(this.canform.mall_price)){
this.$api.msg('商城价格不能大于市场价格');
this.issubmit=true;
return;
}
}
let res = await addEditGoods(this.canform)
......@@ -494,12 +577,33 @@
this.issubmit=true;
}
},
},
//多选 勾选 列表
checkboxChange(e){
// console.log(e);
console.log(e,111111111);
// console.log()
if(e.detail.value.indexOf('is_seckill')!=-1){
this.getActivityListfun();
}
this.selchildList = e.detail.value;
},
},
//单选框
radioChange(e){
// console.log(e)
// console.log(this.seckilltimelist[e.detail.value[0]].activity_id)
this.activity_id = this.seckilltimelist[e.detail.value[0]].activity_id;
// this.activity_id = e.detail.value;
// let listindex = e.detail.value
// console.log(this.activity_id,111111)
// console.log( e.detail.value,111111)
},
changepicker(e){
console.log(e)
},
// 改变下拉选项 一级的
// bindPickerChange (event) {
// console.info(event.detail.value);
......
......@@ -235,7 +235,8 @@
countdata: {},
shop_type: "", //店铺类型 ele goods
is_luck_draw:"",
money_type:""
money_type:"",
activity_type:0
}
},
components: {
......@@ -284,7 +285,7 @@
methods: {
jump(){
uni.navigateTo({
url:'/pages/edit/pro_manage/pro_manage?money_type='+this.money_type
url:'/pages/edit/pro_manage/pro_manage?money_type='+this.money_type + '&'+'activity_type='+this.activity_type
})
},
......@@ -365,7 +366,9 @@
async storeIndexfun() {
let res = await storeIndex({
});
});
console.log(res);
console.log(res.data.shop_info.activity_type)
uni.stopPullDownRefresh(); //结束下拉刷新
console.log(res.data.shop_info.shop_id)
if (res.code == 0) {
......@@ -375,7 +378,8 @@
this.shop_id = res.data.shop_info.shop_id;
this.is_luck_draw=res.data.shop_info.is_luck_draw
this.money_type=res.data.shop_info.money_type
this.money_type=res.data.shop_info.money_type
this.activity_type = res.data.shop_info.activity_type //判断是否有秒杀资格
} else {
this.$api.msg(res.msg);
......
......@@ -22,7 +22,9 @@
<text class="title">规格模型:</text>
<view class="modlename">{{goodsSpec_goodsType[Typeindex].name?goodsSpec_goodsType[Typeindex].name:""}}</view>
<image class="dopicon" src="/static/news/dopicon.png" mode=""></image>
</view>
</view>
<lb-picker ref="picker" :list="goodsSpec_goodsType" :value='Typeindex' range-key="label" :props="myProps" @confirm='confirm'></lb-picker>
......@@ -37,7 +39,8 @@
<view class="specsShop_list">
<view class="specsShop_list_item" v-for="(item,index) in endobjdata" :key="index">
<view class="specsShop_list_item" v-for="(item,index) in endobjdata" :key="index">
<view class="itemnames">{{item.key_name}}</view>
<view class="cleelable flex ali-c">
......@@ -45,13 +48,22 @@
<view class="inputbox flex1">
<input class="input" type="text" value="" v-model="item.price" placeholder="请输入售价" ></input>
</view>
</view>
</view>
<view class="cleelable flex ali-c">
<view class="names"><text class="bitian">*</text> 秒杀价</view>
<view class="inputbox flex1">
<input class="input" type="text" value="" v-model="item.seckill_price" placeholder="请输入售价" ></input>
</view>
</view>
<view class="cleelable flex ali-c">
<view class="names"><text class="bitian">*</text> 库存</view>
<view class="inputbox flex1">
<input class="input" type="text" v-model="item.store_count" value="" placeholder="请输入库存" ></input>
</view>
</view>
</view>
<!-- <QSInput :name="name" titleColor="#000000" variableName="shoptitle" required layout="row" title="库存" v-model="form.shoptitle"></QSInput> -->
<!-- <QSInput :name="name" titleColor="#000000" variableName="shoptitle" required layout="row" title="售价" v-model="form.shoptitle"></QSInput> -->
<!-- <QSPics :name="name" variableName="pics" title="商品图片" v-model="form.pics"></QSPics> -->
......@@ -82,7 +94,9 @@
<script>
import {goodsSpec,ajaxGetSpecSelect,addEditProductSpec} from "@/utils/api/api.js";
import yiCheckbox from "@/components/yiCheckbox/yiCheckbox.vue";
import config from "@/utils/config.js";
import config from "@/utils/config.js";
import {getActivityList} from '@/utils/api/merchant.js';
/**
* 查询商品的规格 商品规格详情 goodsSpec
*
......@@ -100,7 +114,8 @@
},
name:"shops",
name:"shops",
form:{
pics: [{name: '测试'}],
shoptitle:"",
......@@ -144,12 +159,16 @@
return this.$store.state.staticUrl;
}
},
onLoad(opdata) {
onLoad(opdata) {
console.log(opdata)
this.goods_id = opdata.id;
this.goodsSpecfun();//商品规格详情
},
methods:{
methods:{
confirm(e){
console.log(e)
// this.parent_name=e.item.value;
......@@ -158,10 +177,13 @@
this.type_id =e.item.id;
this.Typeindex = e.index;
this.ajaxGetSpecSelectfun();//获取选中的分类下面的规格
},
},
//分类选择触发后
bindPickerChange(e){
this.$refs.picker.show() // 显示
bindPickerChange(e){
this.$refs.picker.show() // 显示
},
......@@ -206,45 +228,59 @@
// 库存,图片,售价 添加规定的方法 最终提交的方法
addEditProductSpecfun(){
// addEditProductSpec
let isbool = false;
let isbool = false;
isbool = this.endobjdata.every((item,index)=>{
return item.price!="" && item.price!="";
})
})
if(!isbool){
this.$api.msg("规格填写有误");
return false;
}
if(this.endobjdata.length==0){
this.$api.msg("你必须填写规格才能提交");
return false;
}
console.log(111111111111111111111111111111111111111111);
console.info("endobjdata",this.endobjdata,this.endobjdata);
// return false;
console.log(this.goods_id)
console.info("endobjdata",this.endobjdata);
// return false;
addEditProductSpec({
goods_id:this.goods_id,//商品id
type_id:this.type_id,//模型id
item:this.endobjdata,
item:this.endobjdata,
}).then((res)=>{
if(res.code==0){
if(res.code==0){
console.log(res,"ress")
this.$api.msg(res.data);
setTimeout(()=>{
uni.navigateBack({
})
},1000)
},1000)
}else{
this.$api.msg(res.data);
}
})
},
//商品规格详情 第一步 获取 一级
async goodsSpecfun(){
async goodsSpecfun(){
let res = await goodsSpec({
goods_id:this.goods_id
});
});
console.log(res,"goodsSpec")
if(res.code==0){
this. goodsSpec_goodsType = res.data.goodsType;
this. goodsSpec_info = res.data.info;
......@@ -268,7 +304,10 @@
let res = await ajaxGetSpecSelect({
goods_id:this.goods_id,//商品id
type_id:this.type_id,
});
});
console.log(res,"ajaxGetSpecSelectfun")
if(res.code==0){
//items_ids 商品规格key,将规格id遍历
// specList 规格详情列表
......@@ -393,7 +432,8 @@
changeupdata(e){
// console.info("数据改变后",e);
},
},
//初始化数据呀
initdatalist(){
var arr1 = [1,2,3];
......@@ -410,15 +450,22 @@
},
inititemdata(){
}
},
}
},
watch:{
form(e,c){
console.info(e,c,"watch");
}
}
},
}
</script>
......
......@@ -28,4 +28,10 @@ import request from "./../request.js";//这里用的是two
// 订单号
export function showsend(data) {
return request.post("Turntable/send", data, { noAuth: true});
}
\ No newline at end of file
}
// 秒杀状态列表
export function getActivityList(){
return request.post("store/getActivityList", {}, { noAuth: true});
}
\ No newline at end of file
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