wangfukang 3 years ago
parent
commit
c89b5b83de
  1. 203
      package1/AI/AIHangOrderList.vue
  2. 24
      package1/AI/AIInventoryList.vue
  3. 220
      package1/AI/AIPicture.vue
  4. 6
      package1/AI/AiChat.vue
  5. BIN
      package1/cropper/.DS_Store
  6. 309
      package1/cropper/cropper.vue
  7. 4
      package1/inventory/addGoods.vue
  8. 7
      package1/inventory/inventoryConfirm.vue

203
package1/AI/AIHangOrderList.vue

@ -81,7 +81,7 @@
</view> </view>
<view class="shop-list" v-for="(items,index1) in item.saleDetailDTOList" :key="index1"> <view class="shop-list" v-for="(items,index1) in item.saleDetailDTOList" :key="index1">
<view class="order-name"> <view class="order-name">
<text style="float: left;">{{items.productName}}({{items.productSn}})单价:{{items.discountAmount}}</text> <text style="float: left;"><text style="width: 80%;">{{items.productName}}({{items.productSn}})</text>单价:{{items.discountAmount || items.wholesalePrice}}</text>
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/6b5ab32ff93a4c51b90e562e0b22e850.png" @tap.stop="largeImg(items.productPicture)" alt=""> <img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/6b5ab32ff93a4c51b90e562e0b22e850.png" @tap.stop="largeImg(items.productPicture)" alt="">
</view> </view>
<view class="specs-name" v-for="(itemss,index2) in items.stockLogList1" :key="index2"> <view class="specs-name" v-for="(itemss,index2) in items.stockLogList1" :key="index2">
@ -229,7 +229,7 @@
components: {}, components: {},
data() { data() {
return { return {
Name:{}, khName:[],
regList:[], regList:[],
pageNumber: 1, pageNumber: 1,
recordState: false, recordState: false,
@ -278,19 +278,19 @@
this.getRegList() this.getRegList()
}, },
onShow() { onShow() {
this.getRegList() this.khName = JSON.parse(JSON.stringify(this.khName)) || ''
this.Name = JSON.parse(JSON.stringify(this.khName)) || ''
if(uni.getStorageSync('hangOrderType') == 'scanCode'){ if(uni.getStorageSync('hangOrderType') == 'scanCode'){
this.addReg() this.addReg()
uni.removeStorageSync('hangOrderType') uni.removeStorageSync('hangOrderType')
return; return;
} }
if(this.Name != ''){ if(this.khName != ''){
this.khName = []
uni.navigateTo({ uni.navigateTo({
url: '/package1/AI/AiChat?khName='+ JSON.stringify(this.Name) url: '/package1/AI/AiChat?khName='+ JSON.stringify(this.khName)
}) })
} }
this.khName = []
this.getRegList()
}, },
onLoad() { onLoad() {
this.shopName = uni.getStorageSync('shopName') this.shopName = uni.getStorageSync('shopName')
@ -321,14 +321,14 @@
}, },
addReg() { addReg() {
this.tui.request("/app/sale/saveOrder", "POST", { this.tui.request("/app/sale/saveOrder", "POST", {
userId:this.Name.id, userId:this.khName.id,
userName:this.Name.name, userName:this.khName.name,
aiFlag:0, aiFlag:0,
status: 7, status: 7,
area:this.Name.area, area:this.khName.area,
city:this.Name.city, city:this.khName.city,
province:this.Name.province, province:this.khName.province,
receiveAddress:this.Name.address receiveAddress:this.khName.address
}, false, false).then((res) => { }, false, false).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.getRegList() this.getRegList()
@ -486,12 +486,13 @@
value.push(value1) value.push(value1)
evalue.push(name) evalue.push(name)
} }
console.log(jishuqi)
// if (jishuqi == 0) { // if (jishuqi == 0) {
// this.oldTemList = [] // this.oldTemList = []
// } // }
if (this.temporaryList.length == 0) { // if (this.temporaryList.length == 0) {
if (jishuqi == this.goodsList.length) { if (jishuqi == this.goodsList.length) {
console.log(jishuqi)
for (var i = 0; i < value.length; i++) { for (var i = 0; i < value.length; i++) {
this.attributeList = { this.attributeList = {
attributeList: value[i], attributeList: value[i],
@ -503,55 +504,56 @@
this.temporaryList.push(this.attributeList); this.temporaryList.push(this.attributeList);
} }
} }
} else { this.$forceUpdate()
let newProductCount = 0; // } else {
for (var i = 0; i < value.length; i++) { // let newProductCount = 0;
for (var m = 0; m < this.temporaryList.length; m++) { // for (var i = 0; i < value.length; i++) {
if (this.temporaryList[m].attributeList == value[i]) { // for (var m = 0; m < this.temporaryList.length; m++) {
newProductCount = this.temporaryList[m].productCount // if (this.temporaryList[m].attributeList == value[i]) {
} // newProductCount = this.temporaryList[m].productCount
} // }
this.attributeList = { // }
attributeList: value[i], // this.attributeList = {
productCount: newProductCount, // attributeList: value[i],
productNum: this.productNum, // productCount: newProductCount,
name: evalue[i], // productNum: this.productNum,
price: this.purchasePrice // name: evalue[i],
} // price: this.purchasePrice
// }
this.newTemList.push(this.attributeList); // this.newTemList.push(this.attributeList);
newProductCount = 0; // newProductCount = 0;
} // }
for (var i = 0; i < this.oldTemList.length; i++) { // for (var i = 0; i < this.oldTemList.length; i++) {
let oldAttributeList = ''; // let oldAttributeList = '';
let oldProductCount = ''; // let oldProductCount = '';
let notChcek = true; // let notChcek = true;
for (var m = 0; m < this.newTemList.length; m++) { // for (var m = 0; m < this.newTemList.length; m++) {
if (this.oldTemList[i].attributeList == this.newTemList[m].attributeList) { // if (this.oldTemList[i].attributeList == this.newTemList[m].attributeList) {
this.newTemList[m].productCount = this.oldTemList[i].productCount // this.newTemList[m].productCount = this.oldTemList[i].productCount
notChcek = false; // notChcek = false;
} // }
} // }
if (this.newTemList.length > 0 && notChcek) { // if (this.newTemList.length > 0 && notChcek) {
this.newTemList.push(this.oldTemList[i]); // this.newTemList.push(this.oldTemList[i]);
} // }
} // }
for (var i = 0; i < this.pageOldTemList.length; i++) { // for (var i = 0; i < this.pageOldTemList.length; i++) {
let oldAttributeList = ''; // let oldAttributeList = '';
let oldProductCount = ''; // let oldProductCount = '';
let notChcek = true; // let notChcek = true;
for (var m = 0; m < this.newTemList.length; m++) { // for (var m = 0; m < this.newTemList.length; m++) {
if (this.pageOldTemList[i].attributeList == this.newTemList[m].attributeList) { // if (this.pageOldTemList[i].attributeList == this.newTemList[m].attributeList) {
this.newTemList[m].productCount = this.pageOldTemList[i].productCount // this.newTemList[m].productCount = this.pageOldTemList[i].productCount
notChcek = false; // notChcek = false;
} // }
} // }
if (this.newTemList.length > 0 && notChcek) { // if (this.newTemList.length > 0 && notChcek) {
this.newTemList.push(this.pageOldTemList[i]); // this.newTemList.push(this.pageOldTemList[i]);
} // }
} // }
} // }
this.$nextTick(() => { this.$nextTick(() => {
for (var i = 0; i < this.temporaryList.length; i++) { for (var i = 0; i < this.temporaryList.length; i++) {
for (var m = 0; m < this.pecsList.length; m++) { for (var m = 0; m < this.pecsList.length; m++) {
@ -561,17 +563,17 @@
} }
} }
}) })
if (jishuqi != this.goodsList.length) { // if (jishuqi != this.goodsList.length) {
if (this.oldTemList.length == 0 && this.pageOldTemList.length == 0) { // if (this.oldTemList.length == 0 && this.pageOldTemList.length == 0) {
this.newTemList = [] // this.newTemList = []
this.temporaryList = [] // this.temporaryList = []
} // }
} // }
if (this.newTemList.length != 0 && jishuqi == this.goodsList.length) { // if (this.newTemList.length != 0 && jishuqi == this.goodsList.length) {
this.temporaryList = this.newTemList; // this.temporaryList = this.newTemList;
this.oldTemList = [] // this.oldTemList = []
this.newTemList = [] // this.newTemList = []
} // }
}, },
temporaryChange(val) { temporaryChange(val) {
@ -592,6 +594,7 @@
for (var i = 0; i < this.temporaryList.length; i++) { for (var i = 0; i < this.temporaryList.length; i++) {
if(this.temporaryList[i].productCount <= 0){ if(this.temporaryList[i].productCount <= 0){
this.tui.toast("商品数量不能为零!") this.tui.toast("商品数量不能为零!")
return
} }
} }
let data = { let data = {
@ -641,6 +644,7 @@
toggle(type, id) { toggle(type, id) {
this.type = type this.type = type
if (type == 'bottom') { if (type == 'bottom') {
this.allChangeNum = 0
this.getById(id); this.getById(id);
} else { } else {
wx.vibrateShort() wx.vibrateShort()
@ -697,13 +701,17 @@
//带参数跳转到开单页 //带参数跳转到开单页
goSaleGoods(item) { goSaleGoods(item) {
let dataList = [] let dataList = []
if(item.aiNotRecognition != ''){
this.tui.toast(item.aiNotRecognition)
}
setTimeout(res => {
if(item.saleDetailDTOList){ if(item.saleDetailDTOList){
for (let i = 0; i < item.saleDetailDTOList.length; i++) { for (let i = 0; i < item.saleDetailDTOList.length; i++) {
let obj = {} let obj = {}
obj.saleDetailQueryDTO = item.saleDetailDTOList[i].stockLogList1 obj.saleDetailQueryDTO = item.saleDetailDTOList[i].stockLogList1
obj.num = 0 obj.num = 0
obj.id = item.saleDetailDTOList[i].productId obj.id = item.saleDetailDTOList[i].productId
obj.price = 0 obj.price = item.saleDetailDTOList[i].price
obj.lsprice = item.saleDetailDTOList[i].price obj.lsprice = item.saleDetailDTOList[i].price
obj.zPrice = item.saleDetailDTOList[i].discountAmount obj.zPrice = item.saleDetailDTOList[i].discountAmount
obj.unitPrice = item.saleDetailDTOList[i].discountAmount obj.unitPrice = item.saleDetailDTOList[i].discountAmount
@ -737,10 +745,11 @@
} }
uni.setStorageSync('carList1', JSON.stringify(dataList)) uni.setStorageSync('carList1', JSON.stringify(dataList))
uni.setStorageSync('khName', JSON.stringify(khName)) uni.setStorageSync('khName', JSON.stringify(khName))
uni.setStorageSync('hangOrder', true)
uni.switchTab({ uni.switchTab({
url: '/pages/inventory/goodsList1' url: '/pages/inventory/goodsList1'
}) })
}, 1000)
}, },
//点击切换折叠状态 //点击切换折叠状态
clickCollapse(item) { clickCollapse(item) {
@ -795,6 +804,7 @@
categoryId: this.goodsDetail.categoryId categoryId: this.goodsDetail.categoryId
}, false, true).then((res1) => { }, false, true).then((res1) => {
if (res1.code == 200) { if (res1.code == 200) {
this.goodsList = []
this.$refs.shopPopup.open('bottom') this.$refs.shopPopup.open('bottom')
if (typeof(res1.result) == 'string') { if (typeof(res1.result) == 'string') {
let newObj = JSON.parse(res1.result) let newObj = JSON.parse(res1.result)
@ -905,6 +915,49 @@
clearText(){ clearText(){
this.voiceText = '' this.voiceText = ''
}, },
//删除整条商品
delGoods(item, productId) {
let that = this;
this.hangId = item.id;
uni.showModal({
title: "提示",
content: "确定删除此条商品吗?",
success: function(res) {
if (res.confirm) {
for (let i = 0; i < item.saleDetailDTOList.length; i++) {
if (item.saleDetailDTOList[i].productId == productId) {
item.saleDetailDTOList.splice(item.saleDetailDTOList[i], 1)
}
}
that.carList = item.saleDetailDTOList
that.setSaleDetail();
}
}
})
},
//选商品的时候能删除规格
delCarData(index) {
this.temporaryList.splice(index, 1);
this.temporaryChange()
},
//删除商品下的单条规格
delGoodsPrecs(item, index, index1) {
let that = this;
this.hangId = item.id;
uni.showModal({
title: "提示",
content: "确定删除此条规格吗?",
success: function(res) {
if (res.confirm) {
item.saleDetailDTOList[index].stockLogList1.splice(item.saleDetailDTOList[index]
.stockLogList1[index1], 1)
that.carList = item.saleDetailDTOList
that.setSaleDetail();
}
}
})
},
} }
} }
</script> </script>

24
package1/AI/AIInventoryList.vue

@ -23,7 +23,11 @@
</view> </view>
</view> </view>
<view class="content"> <view class="content">
<view style="height: 80rpx;line-height: 80rpx;font-size: 32rpx;font-weight: bold;padding-left: 30rpx;">入库列表 <view style="height: 80rpx;line-height: 80rpx;font-size: 32rpx;font-weight: bold;padding-left: 30rpx;position: relative;">
入库列表
<view @tap="goAiPicture" style="position: absolute;top: 0;right: 20rpx;">
<uni-icons type="plusempty" size="26"></uni-icons>
</view>
</view> </view>
<view class="content-list" v-for="(item,index) in aiList" :key="index"> <view class="content-list" v-for="(item,index) in aiList" :key="index">
<view class="image-box"> <view class="image-box">
@ -42,10 +46,6 @@
</view> </view>
</view> </view>
</view> </view>
<view class="bottom" @tap="goAiPicture">
<view class="btn-x bottom-btn"></view>
<view class="btn-y bottom-btn"></view>
</view>
</view> </view>
</template> </template>
@ -112,16 +112,17 @@
for(let i=0;i<this.purchaseDetails.length;i++){ for(let i=0;i<this.purchaseDetails.length;i++){
let data = { let data = {
id: this.purchaseDetails[i].id, id: this.purchaseDetails[i].id,
// price: , price: this.purchaseDetails[i].price,
num: this.purchaseDetails[i].productCount, productCount: 0,
wholesalePrice: 0, categoryId:this.purchaseDetails[i].categoryId,
purchasePrice:this.purchaseDetails[i].price, wholesalePrice: this.purchaseDetails[i].wholesalePrice,
purchasePrice:this.purchaseDetails[i].purchasePrice,
isNew: this.purchaseDetails[i].productId==null?true:false, isNew: this.purchaseDetails[i].productId==null?true:false,
productId:this.purchaseDetails[i].productId, productId:this.purchaseDetails[i].productId,
productName: this.purchaseDetails[i].productName, productName: this.purchaseDetails[i].productName,
productSn: this.purchaseDetails[i].productSn, productSn: this.purchaseDetails[i].productSn,
productPicture: '', productPicture: this.purchaseDetails[i].productPicture,
supplierName: '', supplierName: this.purchaseDetails[i].supplierName,
saleDetailQueryDTO: [] saleDetailQueryDTO: []
} }
for(let m=0;m<this.purchaseDetails[i].stockLogList1.length;m++){ for(let m=0;m<this.purchaseDetails[i].stockLogList1.length;m++){
@ -132,6 +133,7 @@
name: this.sliceMsg(this.purchaseDetails[i].stockLogList1[m].attributeList), name: this.sliceMsg(this.purchaseDetails[i].stockLogList1[m].attributeList),
price: this.purchaseDetails[i].stockLogList1[m].purchasePrice price: this.purchaseDetails[i].stockLogList1[m].purchasePrice
} }
data.productCount += this.purchaseDetails[i].stockLogList1[m].productCount
data.saleDetailQueryDTO.push(list) data.saleDetailQueryDTO.push(list)
} }
this.carList1.push(data) this.carList1.push(data)

220
package1/AI/AIPicture.vue

@ -22,6 +22,7 @@
<text>1.每张图片建议您裁剪到20个规格或以下</text> <text>1.每张图片建议您裁剪到20个规格或以下</text>
<text>2.确保最后一款商品规格截取完整</text> <text>2.确保最后一款商品规格截取完整</text>
<text>3.每张图片输入对应的规格数量</text> <text>3.每张图片输入对应的规格数量</text>
<text>4.如果拍照后找不到所拍照片,打开微信的设置-通用-照片、视频里面的照片,点击开启后重启微信即可</text>
</view> </view>
<view class="prompt-title-img"> <view class="prompt-title-img">
<view class="img" v-for="(item,index) in imgList" :key="index"> <view class="img" v-for="(item,index) in imgList" :key="index">
@ -29,15 +30,17 @@
</view> </view>
</view> </view>
</view> </view>
<view @tap="upLoadImg()" <view @tap="toggle"
style="height: 98rpx;line-height: 98rpx;font-size: 34rpx;font-weight: bold;padding-left: 30rpx;position: relative;"> style="height: 98rpx;line-height: 98rpx;font-size: 34rpx;font-weight: bold;padding-left: 30rpx;position: relative;">
上传图片 上传图片
<view class="title-line"></view> <view class="title-line"></view>
<view class="icon-upload"> <view class="icon-upload">
<uni-icons type="cloud-upload" color="#00BFFF" size="30"></uni-icons> <uni-icons type="cloud-upload" color="#00BFFF" size="30"></uni-icons>
<text style="font-size: 24rpx;float: left;font-weight: normal;">(←点击此处添加主图)</text>
</view> </view>
</view> </view>
<view v-for="(item,index) in purchaseOcrPictureList" :key="index" style="display: flex;width: 100%;overflow: scroll;"> <view v-for="(item,index) in purchaseOcrPictureList" :key="index"
style="display: flex;width: 100%;overflow: scroll;">
<view class="content-list-img"> <view class="content-list-img">
<view class="del-icon" @tap="delImage(index)"> <view class="del-icon" @tap="delImage(index)">
<uni-icons type="trash" color="#00BFFF" size="20"></uni-icons> <uni-icons type="trash" color="#00BFFF" size="20"></uni-icons>
@ -46,25 +49,37 @@
<uni-easyinput type='number' prefixIcon="compose" v-model='item.count' <uni-easyinput type='number' prefixIcon="compose" v-model='item.count'
placeholder="请输入规格数量"></uni-easyinput> placeholder="请输入规格数量"></uni-easyinput>
</view> </view>
<view v-for="(items,indexs) in item.children" :key="indexs" style="width: 200rpx;height: 280rpx;position: relative;background: #fff;margin-left: 20rpx;border-radius: 10px;"> <view v-for="(items,indexs) in item.children" :key="indexs"
<view class="del-icon" @tap="delImage(index)"> style="width: 200rpx;height: 280rpx;position: relative;background: #fff;margin-left: 20rpx;border-radius: 10px;">
<view class="del-icon" @tap="delSonImage(index,indexs)">
<uni-icons type="trash" color="#00BFFF" size="20"></uni-icons> <uni-icons type="trash" color="#00BFFF" size="20"></uni-icons>
</view> </view>
<image show-menu-by-longpress :src="items.ocrPicture" @tap="showImage(items.ocrPicture)" style="width: 200rpx;height: 200rpx;padding: 5px;"></image> <image show-menu-by-longpress :src="items.ocrPicture" @tap="showImage(items.ocrPicture)"
style="width: 200rpx;height: 200rpx;padding: 5px;"></image>
<uni-easyinput type='number' v-model='items.count' placeholder="子图规格数量"></uni-easyinput> <uni-easyinput type='number' v-model='items.count' placeholder="子图规格数量"></uni-easyinput>
</view> </view>
<view @tap="addSonImg(item.id)" style="width: 200rpx;height: 219rpx;background: rgba(255,255,255,0.4);margin: 0 20rpx;border-radius: 10px;font-size: 24rpx;color: #777;text-align: center;"> <view @tap="addSonImg(item.id)"
style="width: 200rpx;height: 219rpx;background: rgba(255,255,255,0.4);margin: 0 20rpx;border-radius: 10px;font-size: 24rpx;color: #777;text-align: center;">
<uni-icons type="plusempty" color="#777" size="80"></uni-icons> <uni-icons type="plusempty" color="#777" size="80"></uni-icons>
<view style="height: 30rpx;line-height: 30rpx;">点击添加子图</view> <view style="height: 30rpx;line-height: 30rpx;">点击添加子图</view>
</view> </view>
</view> </view>
<view style="height:200rpx;"></view>
</view> </view>
<view class="bottom" @tap="identify"> <view class="bottom-box" @tap="identify">
<view class="run-line"></view> <view class="run-line"></view>
<img class="bottom-img" <img class="bottom-img"
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/27e2655fe19f454d93970f968d91fbef.png" alt="" /> src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/27e2655fe19f454d93970f968d91fbef.png" alt="" />
<view class="bottom-btn">Ai识别</view> <view class="bottom-btn">Ai识别</view>
</view> </view>
<!-- 弹出层 -->
<uni-popup ref="popup" background-color="#fff">
<view style="height:340rpx;">
<view @tap="upLoadImg('pai')" class="popup-photo">拍照</view>
<view @tap="upLoadImg('xuan')" class="popup-photo">从相册选择</view>
<view @tap="$refs.popup.close()" class="popup-photo" style="border-bottom:0;border-top:10px solid #eee;">取消</view>
</view>
</uni-popup>
</view> </view>
</template> </template>
@ -80,78 +95,53 @@
'https://jewel-shop.oss-cn-beijing.aliyuncs.com/2a55142e562b4ea480ce553c8b84d092.jpg' 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/2a55142e562b4ea480ce553c8b84d092.jpg'
], ],
purchaseOcrPictureList: [], purchaseOcrPictureList: [],
parentPicturePath:'', parentPicturePath: '',
parentId:'', parentId: '',
newSubmit:[] newSubmit: []
} }
}, },
onShow() { onShow() {
if (this.uploadUrl && this.uploadNum == 1) {
if(this.parentId !=''){
for(let i=0;i<this.purchaseOcrPictureList.length;i++){
if(this.purchaseOcrPictureList[i].id == this.parentId){
let data = {
ocrPicture: this.uploadUrl,
count: '',
}
this.purchaseOcrPictureList[i].children.push(data)
}
}
this.parentId = ''
}else{
let data = {
ocrPicture: this.uploadUrl,
count: '',
id:this.splitData(this.uploadUrl),
children:[]
}
this.purchaseOcrPictureList.push(data)
}
console.log('查看图片',this.purchaseOcrPictureList)
this.uploadUrl = ''
this.uploadNum = ''
this.parentPicturePath = ''
}
}, },
onLoad() { onLoad() {
}, },
methods: { methods: {
addSonImg(id){ addSonImg(id) {
this.parentId = id this.parentId = id
this.upLoadImg() this.toggle()
}, },
splitData(str){ splitData(str) {
return str.split('/')[3].split('.')[0] return str.split('/')[3].split('.')[0]
}, },
identify() { identify() {
this.newSubmit = [] this.newSubmit = []
if(this.purchaseOcrPictureList.length == 0){ if (this.purchaseOcrPictureList.length == 0) {
this.tui.toast("请选择要上传的图片") this.tui.toast("请选择要上传的图片")
return return
} }
for(let i=0;i<this.purchaseOcrPictureList.length;i++){ for (let i = 0; i < this.purchaseOcrPictureList.length; i++) {
if(this.purchaseOcrPictureList[i].count == 0 || this.purchaseOcrPictureList[i].count == ''){ if (this.purchaseOcrPictureList[i].count == 0 || this.purchaseOcrPictureList[i].count == '') {
this.tui.toast("请输入数量") this.tui.toast("请输入数量")
return return
}else{ } else {
let data = { let data = {
ocrPicture: this.purchaseOcrPictureList[i].ocrPicture, ocrPicture: this.purchaseOcrPictureList[i].ocrPicture,
count: this.purchaseOcrPictureList[i].count, count: this.purchaseOcrPictureList[i].count,
parentPicturePath:'' parentPicturePath: ''
} }
this.newSubmit.push(data) this.newSubmit.push(data)
if(this.purchaseOcrPictureList[i].children.length > 0){ if (this.purchaseOcrPictureList[i].children.length > 0) {
for(let m=0;m<this.purchaseOcrPictureList[i].children.length;m++){ for (let m = 0; m < this.purchaseOcrPictureList[i].children.length; m++) {
if(this.purchaseOcrPictureList[i].children[m].count == 0 || this.purchaseOcrPictureList[i].children[m].count == ''){ if (this.purchaseOcrPictureList[i].children[m].count == 0 || this.purchaseOcrPictureList[i]
.children[m].count == '') {
this.tui.toast("请输入子图片的规格数量") this.tui.toast("请输入子图片的规格数量")
return return
}else{ } else {
let data = { let data = {
ocrPicture: this.purchaseOcrPictureList[i].children[m].ocrPicture, ocrPicture: this.purchaseOcrPictureList[i].children[m].ocrPicture,
count: this.purchaseOcrPictureList[i].children[m].count, count: this.purchaseOcrPictureList[i].children[m].count,
parentPicturePath:this.purchaseOcrPictureList[i].ocrPicture parentPicturePath: this.purchaseOcrPictureList[i].ocrPicture
} }
this.newSubmit.push(data) this.newSubmit.push(data)
} }
@ -166,12 +156,9 @@
}, false, false).then((res) => { }, false, false).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.tui.toast("识别中,请等待...")
setTimeout(res => {
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1
}) })
}, 2000)
} else { } else {
this.tui.toast(res.message) this.tui.toast(res.message)
@ -190,19 +177,108 @@
current: img current: img
}) })
}, },
upLoadImg() { toggle(){
let that = this;
uni.getSystemInfo({
success: function (res) {
if(res.osName == 'ios'){
that.upLoadImg('ios')
}else if(res.osName == 'android'){
that.$refs.popup.open('bottom')
}
}
});
},
upLoadImg(type) {
let that = this; let that = this;
if(type == 'ios'){
uni.chooseMedia({ uni.chooseMedia({
count: 1, count: 1,
mediaType: ['image'], mediaType: ['image'],
sourceType: ['album', 'camera'], sourceType: ['camera','album'],
camera: 'back', camera: 'back',
success(res) { success(res) {
uni.navigateTo({ that.upLoadFile(res.tempFiles[0].tempFilePath)
url: '/package1/cropper/cropper?imgSrc='+res.tempFiles[0].tempFilePath }
})
}else if(type == 'pai'){
uni.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['camera'],
camera: 'back',
success(res) {
uni.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['album'],
success(res1) {
that.upLoadFile(res1.tempFiles[0].tempFilePath)
}
})
}
})
}else if(type == 'xuan'){
uni.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['album'],
success(res1) {
that.upLoadFile(res1.tempFiles[0].tempFilePath)
}
}) })
} }
this.$refs.popup.close()
},
upLoadFile(path){
let that = this;
let hiver_token = uni.getStorageSync("hiver_token")
uni.uploadFile({
url: 'https://dev.xenjoyou.com/hiver/upload/file',
filePath: path,
name: 'file',
header: {
"content-type": "multipart/form-data",
'accessToken': hiver_token
},
formData: {},
success: (uploadFileRes) => {
let path = JSON.parse(uploadFileRes.data)
if (that.parentId != '') {
for (let i = 0; i < that.purchaseOcrPictureList
.length; i++) {
if (that.purchaseOcrPictureList[i].id ==
that.parentId) {
let data = {
ocrPicture: path.result,
count: '',
}
that.purchaseOcrPictureList[i].children
.push(data)
}
}
that.parentId = ''
} else {
let data = {
ocrPicture: path.result,
count: '',
id: that.splitData(path.result),
children: []
}
that.purchaseOcrPictureList.push(data)
}
console.log('查看图片', that.purchaseOcrPictureList)
},
fail: (err) => {
uni.showToast({
title: JSON.stringify(err),
icon: 'none'
}) })
}
});
}, },
delImage(index) { delImage(index) {
let that = this; let that = this;
@ -215,6 +291,19 @@
} }
} }
}) })
},
delSonImage(index,indexs) {
let that = this;
console.log(that.purchaseOcrPictureList)
uni.showModal({
title: "提示",
content: "确定删除该子图吗?",
success: function(res) {
if (res.confirm) {
that.purchaseOcrPictureList[index].children.splice(indexs, 1);
}
}
})
} }
} }
} }
@ -353,7 +442,7 @@
animation: blinking 1s infinite; animation: blinking 1s infinite;
} }
.bottom { .bottom-box {
position: fixed; position: fixed;
bottom: 100rpx; bottom: 100rpx;
right: 0; right: 0;
@ -464,6 +553,7 @@
padding: 10px; padding: 10px;
} }
} }
.uni-easyinput { .uni-easyinput {
width: 100%; width: 100%;
height: 20%; height: 20%;
@ -472,10 +562,11 @@
background: #F8FAFF; background: #F8FAFF;
text-align: center; text-align: center;
display: block; display: block;
border:none; border: none;
border-bottom-left-radius: 10px; border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px; border-bottom-right-radius: 10px;
} }
.del-icon { .del-icon {
width: 50rpx; width: 50rpx;
height: 50rpx; height: 50rpx;
@ -483,11 +574,16 @@
top: 0; top: 0;
right: 0; right: 0;
} }
.icon-upload { .icon-upload {
position: absolute; position: absolute;
top: 0; top: 0;
left: 190rpx; left: 190rpx;
height: 100%; height: 100%;
uni-icons{
float: left;
}
} }
.title-line { .title-line {
@ -532,4 +628,12 @@
transform: rotate(360deg); transform: rotate(360deg);
} }
} }
.popup-photo{
height: 110rpx;
line-height: 110rpx;
text-align: center;
font-size: 36rpx;
font-weight: 800;
border-bottom: 1px solid #eee;
}
</style> </style>

6
package1/AI/AiChat.vue

@ -104,6 +104,7 @@
this.khName = JSON.parse(option.khName) this.khName = JSON.parse(option.khName)
console.log(this.khName) console.log(this.khName)
this.initRecord();
}, },
methods: { methods: {
switchChat(type){ switchChat(type){
@ -153,6 +154,7 @@
manager.stop() manager.stop()
// 识别结束事件 // 识别结束事件
manager.onStop = (res) => { manager.onStop = (res) => {
console.log(res)
if (res.result == '') { if (res.result == '') {
uni.showToast({ uni.showToast({
title: "请重新说一遍", title: "请重新说一遍",
@ -180,6 +182,10 @@
} }
}, },
addReg() { addReg() {
if(this.msgList.length <= 0){
this.tui.toast("小助手没有检测到可识别的内容哦~")
return
}
this.tui.request("/app/sale/saveOrder", "POST", { this.tui.request("/app/sale/saveOrder", "POST", {
userId:this.khName.id, userId:this.khName.id,
userName:this.khName.name, userName:this.khName.name,

BIN
package1/cropper/.DS_Store

Binary file not shown.

309
package1/cropper/cropper.vue

@ -1,309 +0,0 @@
<template>
<view>
<view style="width:100%;height:500rpx;">
<image-cropper id="image-cropper" @load="cropperload" @imageload="loadimage" @tapcut="clickcut" limit_move="{{limit_move}}" disable_rotate="{{disable_rotate}}" width="{{width}}" height="{{height}}" imgSrc="{{src}}" angle="{{angle}}" disable_width="{{disable_width}}" max_width="{{max_width}}" max_height="{{max_height}}" disable_height="{{disable_height}}" disable_ratio="{{disable_ratio}}">
</image-cropper>
</view>
<text class="hint">点击中间裁剪框可查看裁剪后的图片</text>
<view class='bottom'>
<button @tap='submit'>确定</button>
<!-- <button class="button" @touchstart='rotate' @touchend='end' data-type="rotate">旋转</button> -->
<button class="button" @tap='upload'>上传</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
src: '',
width: 250, //宽度
height: 250, //高度
max_width: 1080,
max_height: 1920,
disable_rotate: true, //是否禁用旋转
disable_ratio: false, //锁定比例
limit_move: true, //是否限制移动
}
},
onLoad(options) {
let that = this;
this.cropper = this.selectComponent("#image-cropper");
this.src= options.imgSrc
if(!options.imgSrc){
this.cropper.upload(); //上传图片
}
},
methods: {
cropperload(e) {
console.log('cropper加载完成');
},
loadimage(e) {
wx.hideLoading();
console.log('图片');
// this.cropper.imgReset();
this.cropper.setCutSize()
this.cropper.setCutCenter()
},
clickcut(e) {
console.log(e.detail);
//图片预览
wx.previewImage({
current: e.detail.url, // 当前显示图片的http链接
urls: [e.detail.url] // 需要预览的图片http链接列表
})
},
upload() {
let that = this;
wx.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success(res) {
wx.showLoading({
title: '加载中',
})
const tempFilePaths = res.tempFilePaths[0];
//重置图片角度、缩放、位置
that.cropper.imgReset();
that.src= tempFilePaths
}
})
},
setWidth(e) {
this.width= e.detail.value < 10 ? 10 : e.detail.value
this.cut_left= this.cropper.data.cut_left
},
setHeight(e) {
this.height= e.detail.value < 10 ? 10 : e.detail.value
this.cut_top= this.cropper.data.cut_top
},
switchChangeDisableRatio(e) {
//设置宽度之后使剪裁框居中
this.disable_ratio= e.detail.value
},
setCutTop(e) {
this.cut_top= e.detail.value
this.cut_top= this.cropper.data.cut_top
},
setCutLeft(e) {
this.cut_left= e.detail.value
this.cut_left= this.cropper.data.cut_left
},
switchChangeDisableRotate(e) {
//开启旋转的同时不限制移动
if (!e.detail.value) {
this.limit_move= false,
this.disable_rotate= e.detail.value
} else {
this.disable_rotate= e.detail.value
}
},
switchChangeLimitMove(e) {
//限制移动的同时锁定旋转
if (e.detail.value) {
this.disable_rotate= true
}
this.cropper.setLimitMove(e.detail.value);
},
switchChangeDisableWidth(e) {
this.disable_width= e.detail.value
},
switchChangeDisableHeight(e) {
this.disable_height= e.detail.value
},
submit() {
let that = this;
let hiver_token = uni.getStorageSync("hiver_token")
this.cropper.getImg((obj) => {
console.log(obj.url)
console.log(that.tui.getToken())
uni.uploadFile({
url: 'https://dev.xenjoyou.com/hiver/upload/file',
filePath: obj.url,
name: 'file',
header: {
"content-type": "multipart/form-data",
'accessToken': hiver_token
},
formData: {},
success: (uploadFileRes) => {
let path = JSON.parse(uploadFileRes.data)
console.log(path)
// let data = {
// url:path.result,
// specNum:''
// }
// that.productPicture.push(data)
let pages = getCurrentPages();
let prevPage = pages[pages.length - 2];
prevPage.$vm.uploadUrl = path.result
prevPage.$vm.uploadNum = 1
//后端返回的地址,存入图片地址
wx.navigateBack({
delta: 1
})
},fail: (err) =>{
uni.showToast({
title: JSON.stringify(err),
icon: 'none'
})
}
});
});
},
rotate() {
//在用户旋转的基础上旋转90°
this.cropper.setAngle(this.cropper.data.angle += 90);
},
top() {
this.data.top = setInterval(() => {
this.cropper.setTransform({
y: -3
});
}, 1000 / 60)
},
bottom() {
this.data.bottom = setInterval(() => {
this.cropper.setTransform({
y: 3
});
}, 1000 / 60)
},
left() {
this.data.left = setInterval(() => {
this.cropper.setTransform({
x: -3
});
}, 1000 / 60)
},
right() {
this.data.right = setInterval(() => {
this.cropper.setTransform({
x: 3
});
}, 1000 / 60)
},
narrow() {
this.data.narrow = setInterval(() => {
this.cropper.setTransform({
scale: -0.02
});
}, 1000 / 60)
},
enlarge() {
this.data.enlarge = setInterval(() => {
this.cropper.setTransform({
scale: 0.02
});
}, 1000 / 60)
},
end(e) {
clearInterval(this.data[e.currentTarget.dataset.type]);
},
}
}
</script>
<style>
.top {
position: absolute;
width: 100%;
top: 10rpx;
display: flex;
flex-flow: wrap;
z-index: 10;
color: white;
justify-content: space-around;
}
.hint {
position: absolute;
top: 10rpx;
width: 100%;
font-size: 33rpx;
text-align: center;
color: white;
z-index: 10;
}
page {
background: white;
}
view {
font-size: 30rpx;
}
.bottom {
position: absolute;
width: 100%;
bottom: 50rpx;
display: flex;
z-index: 10;
justify-content: center;
align-items: center;
flex-wrap: wrap;
height: 210rpx;
}
button {
font-size: 27rpx;
z-index: 2;
padding: 0 20rpx;
height: 60rpx;
min-width: 70rpx;
margin: 0 4rpx;
}
.input {
display: flex;
height: 50rpx;
width: 50%;
}
.input>.label {
min-width: 150rpx;
font-size: 30rpx;
height: 50rpx;
line-height: 50rpx;
}
.input>input {
margin-left: 10rpx;
text-align: center;
max-width: 160rpx;
border: 1px solid rgb(255, 255, 255);
height: 50rpx;
line-height: 50rpx;
min-height: 50rpx;
box-sizing: border-box;
}
</style>

4
package1/inventory/addGoods.vue

@ -72,7 +72,7 @@
price: '', price: '',
productSn: '', productSn: '',
wholesalePrice: '', wholesalePrice: '',
productPicture: [], productPicture: '',
productIntro: '', productIntro: '',
categoryId: '', categoryId: '',
salesWeek: '', salesWeek: '',
@ -192,7 +192,7 @@
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let a = uni.uploadFile({ let a = uni.uploadFile({
url: 'https://storage.xenjoyou.com/hiver/upload/file', url: 'https://dev.xenjoyou.com/hiver/upload/file',
filePath: url, filePath: url,
name: 'file', name: 'file',
header: { header: {

7
package1/inventory/inventoryConfirm.vue

@ -63,7 +63,7 @@
</view> </view>
</view> </view>
<view class="tui-tabbar"> <view class="tui-tabbar">
<view class="tui-btn-mr" @click="batchPrint">批量打印</view> <view class="tui-btn-mr" @click="batchPrint" v-if="aiinventory !=1">批量打印</view>
<view class="tui-btn-mr" @click="inventorySubmit">确认提交</view> <view class="tui-btn-mr" @click="inventorySubmit">确认提交</view>
</view> </view>
</view> </view>
@ -75,7 +75,7 @@
return { return {
purchase:'', purchase:'',
purchaseDetails:'', purchaseDetails:'',
aiinventory:0 aiinventory:0 //1是AI入库 0是普通入库
} }
}, },
filters: { filters: {
@ -131,7 +131,7 @@
uni.navigateTo({ uni.navigateTo({
url: "/package1/inventory/batchPrint?purchase=" + JSON.stringify(this.purchase) + '&purchaseDetails=' + JSON.stringify(this.purchaseDetails) url: "/package1/inventory/batchPrint?purchase=" + JSON.stringify(this.purchase) + '&purchaseDetails=' + JSON.stringify(this.purchaseDetails)
}) })
} },
}, },
} }
</script> </script>
@ -278,6 +278,7 @@
line-height: 140rpx; line-height: 140rpx;
color: #777; color: #777;
background: #eee; background: #eee;
margin: 15px 0 0 15px;
} }
.uni-tooltip { .uni-tooltip {
display: flex !important; display: flex !important;

Loading…
Cancel
Save