init
This commit is contained in:
201
wx214944c362629fc7/pages/gongzuo/index.js
Normal file
201
wx214944c362629fc7/pages/gongzuo/index.js
Normal file
@@ -0,0 +1,201 @@
|
||||
require("../../@babel/runtime/helpers/Arrayincludes");
|
||||
|
||||
var a = getApp(), t = require("../../wxParse/wxParse.js");
|
||||
|
||||
Page({
|
||||
data: {
|
||||
imgList: [],
|
||||
goodsNo: null,
|
||||
fromData: null,
|
||||
isShangJia: !1,
|
||||
searchValue: "",
|
||||
searchGoodsNoArray: [],
|
||||
imageObjArray: [],
|
||||
imageUrlArray: [],
|
||||
cateObjArray: [],
|
||||
indexCate: null,
|
||||
colourObjList: [],
|
||||
indexColour: null
|
||||
},
|
||||
bindPickerChangeCate: function(a) {
|
||||
var t = this.data.fromData;
|
||||
t.category_id = this.data.cateObjArray[a.detail.value].category_id, this.setData({
|
||||
fromData: t,
|
||||
indexCate: a.detail.value
|
||||
});
|
||||
},
|
||||
bindPickerChangeColour: function(a) {
|
||||
var t = this.data.fromData;
|
||||
t.colour = this.data.colourObjList[a.detail.value].id, this.setData({
|
||||
fromData: t,
|
||||
indexColour: a.detail.value
|
||||
});
|
||||
},
|
||||
onLoad: function(a) {
|
||||
var t = this, o = wx.getStorageSync("values");
|
||||
wx.getStorage({
|
||||
key: "phone",
|
||||
success: function(a) {
|
||||
"" != a.data && o.includes(a.data) || wx.showModal({
|
||||
title: "提示",
|
||||
content: "无权访问",
|
||||
success: function(a) {
|
||||
a.confirm, wx.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
}
|
||||
}), t.CategoryList(), t.ColourList();
|
||||
}
|
||||
});
|
||||
},
|
||||
onShow: function() {},
|
||||
bindFormSubmit: function(t) {
|
||||
var o = t.detail.value.jieshao, e = t.detail.value.goods_price, s = t.detail.value.l_a, i = t.detail.value.l_b, r = t.detail.value.stock_num;
|
||||
console.log(r);
|
||||
var n = this.data.fromData;
|
||||
if (n.content = o, n.goods_price = e, n.l_b = i, n.l_a = s, n.goods_status = this.data.shangjiastatus,
|
||||
null != n.colour && null != n.category_id) {
|
||||
var l = {}, d = {};
|
||||
l.goods_id = n.goods_id, l.images = n.imageIdList, l.content = o, d.goods_no = this.data.goodsNo,
|
||||
d.goods_price = e, d.l_b = i, d.l_a = s, d.stock_num = r, l.spec = d, l.colour = n.colour,
|
||||
l.goods_status = n.goods_status, l.category_id = n.category_id, console.log(l),
|
||||
wx.request({
|
||||
url: "https://ltwxminiapp.19year.cn/index.php?s=/api/goods/editGoods&wxapp_id=10001",
|
||||
header: {
|
||||
"content-type": "application/json"
|
||||
},
|
||||
data: l,
|
||||
method: "POST",
|
||||
success: function(t) {
|
||||
console.log(t.data), 1 == t.data.code ? a.showError("保存成功") : a.showError("保存失败");
|
||||
}
|
||||
});
|
||||
} else a.showError("请选择分类与成色");
|
||||
},
|
||||
getSearchContent: function(t) {
|
||||
var o = this, e = t.detail.value;
|
||||
console.log(e), a._get("goods/likeGoodsNo", {
|
||||
goods_no: e
|
||||
}, function(a) {
|
||||
console.log(a.data.list), o.setData({
|
||||
searchGoodsNoArray: a.data.list
|
||||
});
|
||||
}), o.setData({
|
||||
searchValue: e
|
||||
});
|
||||
},
|
||||
clearNo: function() {
|
||||
this.setData({
|
||||
searchValue: "",
|
||||
searchGoodsNoArray: []
|
||||
});
|
||||
},
|
||||
xuanze: function(t) {
|
||||
var o = t.currentTarget.dataset.goodsId;
|
||||
if (console.log(t.currentTarget.dataset.goodsId), o.length <= 0) return a.showError("没有选中数据"),
|
||||
!1;
|
||||
this.setData({
|
||||
searchValue: "",
|
||||
searchGoodsNoArray: []
|
||||
}), this.getGoodsDetail(o);
|
||||
},
|
||||
CategoryList: function() {
|
||||
var t = this;
|
||||
a._get("category/lists", {}, function(a) {
|
||||
var o = a.data;
|
||||
t.setData({
|
||||
cateObjArray: o.list
|
||||
});
|
||||
});
|
||||
},
|
||||
ColourList: function() {
|
||||
var t = this;
|
||||
a._get("goods/getColourListV2", {}, function(a) {
|
||||
var o = a.data;
|
||||
t.setData({
|
||||
colourObjList: o.data
|
||||
});
|
||||
});
|
||||
},
|
||||
onSaoMa: function() {
|
||||
var t = this;
|
||||
wx.scanCode({
|
||||
onlyFromCamera: !0,
|
||||
scanType: [ "barCode" ],
|
||||
success: function(a) {
|
||||
t.getGoodsDetail(a.result);
|
||||
},
|
||||
fail: function(t) {
|
||||
a.showError(t.result + "扫码错误");
|
||||
}
|
||||
});
|
||||
},
|
||||
getGoodsDetail: function(t) {
|
||||
var o = this;
|
||||
a._get("goods/infos", {
|
||||
goods_no: t
|
||||
}, function(a) {
|
||||
var e = o.initGoodsDetailData(a.data);
|
||||
o.setData(e), o.setData({
|
||||
goodsNo: t
|
||||
});
|
||||
var s = [], i = [];
|
||||
e.detail.image.forEach(function(a) {
|
||||
s.push(a.file_path), i.push(a);
|
||||
}), o.setData({
|
||||
imageUrlArray: s,
|
||||
imageObjArray: i
|
||||
}), console.log(e);
|
||||
var r = {
|
||||
imageIdList: []
|
||||
};
|
||||
r.goods_price = e.goods_price, r.l_a = e.l_a, r.l_b = e.l_b, r.content = o.delHtmlTag(e.detail.content),
|
||||
r.goods_id = e.detail.goods_id, console.log(e.detail.category_id), o.setData({
|
||||
indexCate: null
|
||||
}), o.data.cateObjArray.forEach(function(a, t) {
|
||||
a.category_id == e.detail.category_id && (o.setData({
|
||||
indexCate: t
|
||||
}), r.category_id = a.category_id);
|
||||
}), console.log(e.detail.colour), o.setData({
|
||||
indexColour: null
|
||||
}), o.data.colourObjList.forEach(function(a, t) {
|
||||
a.id == parseInt(e.detail.colour) && (o.setData({
|
||||
indexColour: t
|
||||
}), r.colour = a.id);
|
||||
}), 10 == e.detail.goods_status.value ? (r.goods_status = 10, o.setData({
|
||||
isShangJia: !0,
|
||||
fromData: r,
|
||||
shangjiastatus: 10
|
||||
})) : (r.goods_status = 20, o.setData({
|
||||
isShangJia: !1,
|
||||
fromData: r,
|
||||
shangjiastatus: 20
|
||||
}));
|
||||
});
|
||||
},
|
||||
initGoodsDetailData: function(a) {
|
||||
return a.detail.content.length > 0 && t.wxParse("content", "html", a.detail.content, this, 0),
|
||||
a.goods_sku_id = a.detail.spec[0].spec_sku_id, a.goods_price = a.detail.spec[0].goods_price,
|
||||
a.l_a = a.detail.spec[0].l_a, a.l_b = a.detail.spec[0].l_b, a.line_price = a.detail.spec[0].line_price,
|
||||
a.stock_num = a.detail.spec[0].stock_num, a;
|
||||
},
|
||||
updateImageList: function(a) {
|
||||
console.log("update", a);
|
||||
var t = a.detail.list.map(function(a) {
|
||||
return a.image_id;
|
||||
}), o = this.data.fromData;
|
||||
o.imageIdList = t, console.log(), this.setData({
|
||||
fromData: o
|
||||
});
|
||||
},
|
||||
delHtmlTag: function(a) {
|
||||
return a.replace(/<[^>]+>/g, "");
|
||||
},
|
||||
shangJiaSwitch: function(a) {
|
||||
a.detail.value ? this.setData({
|
||||
shangjiastatus: 10
|
||||
}) : this.setData({
|
||||
shangjiastatus: 20
|
||||
});
|
||||
}
|
||||
});
|
||||
6
wx214944c362629fc7/pages/gongzuo/index.json
Normal file
6
wx214944c362629fc7/pages/gongzuo/index.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"navigationBarTitleText": "工作台",
|
||||
"usingComponents": {
|
||||
"wxDragImg": "/components/imgDrag/imgDrag"
|
||||
}
|
||||
}
|
||||
91
wx214944c362629fc7/pages/gongzuo/index.wxml
Normal file
91
wx214944c362629fc7/pages/gongzuo/index.wxml
Normal file
@@ -0,0 +1,91 @@
|
||||
<view class="container">
|
||||
<view class="cont-box b-f">
|
||||
<button bindtap="onSaoMa" class="saoma">扫码</button>
|
||||
</view>
|
||||
<view class="dis-flex search-input-box flex-box">
|
||||
<view class="search-input">
|
||||
<view class="dis-flex search-box">
|
||||
<view class="left">
|
||||
<icon color="rgba(180,180,180,1)" size="15" type="search"></icon>
|
||||
</view>
|
||||
<view class="right">
|
||||
<input bindinput="getSearchContent" class="input" placeholder="输入串号搜索" placeholderStyle="color:#aba9a9" type="number" value="{{searchValue}}"></input>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="serch-button">
|
||||
<button bindtap="clearNo" type="warn"> 清空 </button>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:for="{{searchGoodsNoArray}}" wx:key="this">
|
||||
<view bindtap="xuanze" data-goods-id="{{item.goods_no}}" style="background: rgb(248, 136, 136); border: 1rpx solid white; padding:10rpx; text-align: center;">
|
||||
<text style="text-align: center;">{{item.goods_no}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cont-box b-f" wx:if="{{goodsNo!==null}}">
|
||||
<view class="goods-title">
|
||||
<text>名称:{{detail.goods_name}}</text>
|
||||
</view>
|
||||
<view class="goods-title">
|
||||
<text class="title f-26" style="color: red;">价 格:{{goods_price}}</text>
|
||||
</view>
|
||||
<view class="goods-title">
|
||||
<text class="title f-26" style="color: red;">数 量:{{stock_num}}</text>
|
||||
</view>
|
||||
<view class="goods-title">
|
||||
<text class="title f-26 twolist-hidden" style="color: #555;">标 题:{{detail.goods_title.length>0?detail.goods_title:' '}}</text>
|
||||
</view>
|
||||
<view class="goods-title">
|
||||
<text class="title f-26 twolist-hidden" style="color: red;">状 态:{{detail.goods_status.text}}</text>
|
||||
</view>
|
||||
<wxDragImg bind:updateImageList="updateImageList" columns="{{3}}" defaultGoodsId="{{fromData.goods_id}}" defaultImgList="{{imageObjArray}}" defaultImgUrlList="{{imageUrlArray}}" gap="{{9}}" maxCount="{{9}}" previewSize="{{100}}" style="margin:5rpx;"></wxDragImg>
|
||||
<form bindsubmit="bindFormSubmit">
|
||||
<view class="ipt-wrap" style="display: flex;align-items: center; padding-bottom: 10rpx; border-bottom: 1px solid red; ">
|
||||
<label class="f-30" for="" style="color: #555;">价格:</label>
|
||||
<input name="goods_price" placeholder="请输入姓名" type="number" value="{{goods_price}}"></input>
|
||||
</view>
|
||||
<view class="ipt-wrap" style="display: flex;align-items: center; padding-bottom: 10rpx; border-bottom: 1px solid red; ">
|
||||
<label class="f-30" for="" style="color: #555;">分销价格:</label>
|
||||
<input name="l_a" placeholder="" type="number" value="{{l_a}}"></input>
|
||||
</view>
|
||||
<view class="ipt-wrap" style="display: flex;align-items: center; padding-bottom: 10rpx; border-bottom: 1px solid red; ">
|
||||
<label class="f-30" for="" style="color: #555;">一级分销价格:</label>
|
||||
<input name="l_b" placeholder="" type="number" value="{{l_b}}"></input>
|
||||
</view>
|
||||
<view class="ipt-wrap" style="display: flex;align-items: center; padding-bottom: 10rpx; border-bottom: 1px solid red; ">
|
||||
<label class="f-30" for="" style="color: #555;">数量:</label>
|
||||
<input name="stock_num" placeholder="请输入姓名" type="number" value="{{stock_num}}"></input>
|
||||
</view>
|
||||
<view class="ipt-wrap" style=" padding-bottom: 10rpx; border-bottom: 1px solid red;">
|
||||
<label class="f-30" for="" style="color: #555;">商品介绍:</label>
|
||||
<textarea autoHeight class="f-30" name="jieshao" placeholder="此处填写商品介绍" style=" width: auto; margin-bottom: 10rpx; line-height: 10rpx;" value="{{fromData.content}}"></textarea>
|
||||
</view>
|
||||
<view class="ipt-wrap" style=" padding-bottom: 10rpx; border-bottom: 1px solid red;">
|
||||
<picker bindchange="bindPickerChangeCate" range="{{cateObjArray}}" rangeKey="name" value="{{indexCate}}">
|
||||
<view class="f-30" style="color: #555;"> 分类:<text style="color: black;">{{cateObjArray[indexCate].name}}</text>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="ipt-wrap" style=" padding-bottom: 10rpx; border-bottom: 1px solid red;">
|
||||
<picker bindchange="bindPickerChangeColour" range="{{colourObjList}}" rangeKey="name" value="{{indexColour}}">
|
||||
<view class="f-30" style="color: #555;"> 成色:<text style="color: black;">{{colourObjList[indexColour].name}}</text>
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view style="display: flex; align-items: center;justify-content: space-between; padding-bottom: 10rpx; margin-top: 10rpx; border-bottom: 1px solid red;">
|
||||
<view style="display: flex; align-items: center;">
|
||||
<label class="f-30" for="" style="color: #555;">是否上架:</label>
|
||||
</view>
|
||||
<view class="flex" style="display: flex;">
|
||||
<switch bindchange="shangJiaSwitch" checked="{{isShangJia}}" class="switch"></switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cont-box b-f">
|
||||
<button class="sub" formType="submit"> 保存 </button>
|
||||
</view>
|
||||
</form>
|
||||
</view>
|
||||
<view wx:else>
|
||||
<view class="center-text">请先扫码或根据串号查询商品</view>
|
||||
</view>
|
||||
</view>
|
||||
142
wx214944c362629fc7/pages/gongzuo/index.wxss
Normal file
142
wx214944c362629fc7/pages/gongzuo/index.wxss
Normal file
@@ -0,0 +1,142 @@
|
||||
.saoma {
|
||||
align-items: center;
|
||||
background-color: #f70000;
|
||||
border-radius: 98rpx;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
margin-top: 10rpx;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.search-input-box {
|
||||
background: #f7f7f7;
|
||||
height: 64rpx;
|
||||
margin-right: 10rpx;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
background: #fff;
|
||||
border-radius: 5px 0 0 5px;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
padding-left: 10rpx;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.search-input input {
|
||||
font-size: 30rpx;
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
}
|
||||
|
||||
.serch-button {
|
||||
box-sizing: border-box;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.serch-button button {
|
||||
border-radius: 0 5px 5px 0;
|
||||
font-size: 28rpx;
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
}
|
||||
|
||||
.search-cate-box {
|
||||
height: 70rpx;
|
||||
}
|
||||
|
||||
.search-cate {
|
||||
position: relative;
|
||||
top: 30%;
|
||||
}
|
||||
|
||||
.sub {
|
||||
align-items: center;
|
||||
background-color: #50f85e;
|
||||
border-radius: 98rpx;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
margin-top: 10rpx;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.ipt-wrap {
|
||||
line-height: 100rpx;
|
||||
min-height: 100rpx;
|
||||
}
|
||||
|
||||
.ipt-wrap label {
|
||||
min-width: 120rpx;
|
||||
}
|
||||
|
||||
.goods-title {
|
||||
color: #333;
|
||||
overflow: hidden;
|
||||
padding: 0 0rpx 0 0;
|
||||
}
|
||||
|
||||
.money-box,.money-box .num {
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.money-box .num {
|
||||
color: #ff495e;
|
||||
font-size: 40rpx;
|
||||
}
|
||||
|
||||
.money-box .del {
|
||||
TEXT-DECORATION: line-through;
|
||||
color: #999;
|
||||
font-size: 24rpx;
|
||||
margin-left: 6rpx;
|
||||
}
|
||||
|
||||
.center-text {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding-top: 25rpx;
|
||||
}
|
||||
|
||||
.center-text,.img_box {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.img_box {
|
||||
flex-wrap: wrap;
|
||||
margin: 20rpx;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.img_item_i {
|
||||
display: block;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.add_icon {
|
||||
display: block;
|
||||
height: 50%;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.img_item {
|
||||
border: 1px solid #c0ccda;
|
||||
height: 210rpx;
|
||||
margin-bottom: 2%;
|
||||
margin-right: 2%;
|
||||
position: relative;
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
.closeImv {
|
||||
height: 50rpx;
|
||||
position: absolute;
|
||||
right: 0rpx;
|
||||
top: 0rpx;
|
||||
width: 50rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user