You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1285 lines
34 KiB
1285 lines
34 KiB
<template>
|
|
<view class="page1">
|
|
<view class="title-box">
|
|
<uni-search-bar class="uni-mt-10" radius="5" placeholder="请输入商品名称/货号" cancelButton="none"
|
|
@confirm="search" @blur="search" @clear="clearSearch" />
|
|
</view>
|
|
<view class="content-box">
|
|
<view class="content-right">
|
|
<view class="right-box" v-for="(item,index) in shopList" :key="index" @tap="toggle('bottom',item)">
|
|
<view class="box-left" @tap.stop="largeImg(item.productPicture)">
|
|
<img class="img-radius" :src="item.productPicture" alt="" v-if="item.productPicture">
|
|
<view class="noPic" v-else>暂无图片</view>
|
|
</view>
|
|
<view class="box-right">
|
|
<view class="box-right-name">{{item.productName == null ?'暂无':item.productName}}</view>
|
|
<view class="box-right-num">{{item.productSn == null ?'暂无':item.productSn}}</view>
|
|
<view class="box-right-price">
|
|
<view class="price-box" v-if="priceType == 1">
|
|
<text>{{item.wholesalePrice == null ?'暂无':item.wholesalePrice}}</text>
|
|
<text>批发价</text>
|
|
</view>
|
|
<view class="price-box" v-if="priceType == 0">
|
|
<text>{{item.price == null ?'暂无':item.price}}</text>
|
|
<text>零售价</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<u-loadmore :status="status" />
|
|
<view class="bottom-box">
|
|
<view class="bottom-left" @tap="toggle('carPopup')">
|
|
<view class="bottom-left-box">
|
|
<uni-icons type="cart" size="20" color="#646566"></uni-icons>
|
|
<text class="uni-tab__text">已选择</text>
|
|
</view>
|
|
<text style="background-color:#ff0000;color:#fff;position: absolute;top: 0;right: 10rpx;"
|
|
class="uni-tab__dot">{{carList.length}}</text>
|
|
</view>
|
|
<view class="bottom-right">
|
|
<view class="bottom-btn" @tap="clickPrice">开单</view>
|
|
</view>
|
|
</view>
|
|
<!-- 弹出层 -->
|
|
<view>
|
|
<uni-popup ref="popup" background-color="#fff" @change="change">
|
|
<view class="popup-content">
|
|
<view class="popup-title">
|
|
<view class="popup-title-left">
|
|
<img class="img-radius" :src="goodsDetail.productPicture" alt="" v-if="goodsDetail.productPicture">
|
|
<view class="noPic" v-else>暂无图片</view>
|
|
</view>
|
|
<view class="popup-title-right">
|
|
<view class="popup-title-right-box" style="color: #088FEB;">{{goodsDetail.productName}}
|
|
</view>
|
|
<view class="popup-title-right-box">{{goodsDetail.productSn}}</view>
|
|
<view class="popup-title-right-box" style="color: darkorange;" @tap="inputDialogToggle">
|
|
<!-- <text style="margin-right:20rpx;">¥{{goodsDetail.price}}</text> -->
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="popup-container" style="position: relative;">
|
|
<view @tap="saveCheck" style="position: absolute;top: 10rpx;right: 20rpx;color: #088FEB;text-decoration: underline;">
|
|
保存已选
|
|
</view>
|
|
<ul style="border-top:20rpx;">
|
|
<li v-for="(items,index) in goodsDetail.attributeList" :key="index">
|
|
<view class="title-fur">
|
|
<view class="name">{{items.name}}</view>
|
|
</view>
|
|
<view class="attrs">
|
|
<uni-data-checkbox v-model="value" :localdata="range"
|
|
@change="change"></uni-data-checkbox>
|
|
<view class="suibian" v-for="(itemTag, index1) in items.value" :key="index1"
|
|
@tap.stop="attrNameChange(index,itemTag.value,index1) "
|
|
:class="itemTag.isChecked ? 'checkedText' : '' " style="position: relative;">
|
|
{{itemTag.value}}
|
|
<view class="kucun" v-if="itemTag.isKucun"></view>
|
|
</view>
|
|
</view>
|
|
</li>
|
|
</ul>
|
|
<view style="padding-bottom: 20rpx;">
|
|
<view class="checkList" v-for="(item,index) in temporaryList" :key="index">
|
|
<view @tap.stop="delCarData(index)" style="margin-right: 20rpx">
|
|
<uni-icons color="red" type="minus" size="26"></uni-icons>
|
|
</view>
|
|
<view class="checkList-box">
|
|
{{item.name}}
|
|
</view>
|
|
<text style="width: 25%;font-size: 22rpx;">{{item.productNum > 0 ?'有库存':"无库存"}}</text>
|
|
<uni-number-box max="100000" v-model="item.productCount" @change="temporaryChange" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
<view class="popup-bottom" v-for="(item,index) in temporaryList" :key="index">
|
|
<view class="popup-bottom-left">
|
|
<text>{{zNum}} 件</text>
|
|
<text>¥{{zPrice}}</text>
|
|
</view>
|
|
<view class="popup-bottom-right">
|
|
<view class="bottom-btn" @tap="temporaryCheck">选好了</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
</view>
|
|
<!-- 弹出输入框 -->
|
|
<uni-popup ref="inputDialog" background-color="#fff">
|
|
<!-- <cc-selectDity :show="show" @sureSelectArea="onsetCity" @hideShow="onhideShow"></cc-selectDity> -->
|
|
<view class="popup-pay-content">
|
|
<view class="popup-pay-title">
|
|
填写信息
|
|
</view>
|
|
<uni-forms ref="form" :modelValue="formData" :rules="rules" labelWidth="85px">
|
|
<uni-forms-item label="姓名" name="consigneeName">
|
|
<uni-easyinput type="text" v-model="formData.consigneeName" placeholder="请输入人员姓名" />
|
|
</uni-forms-item>
|
|
<uni-forms-item label="手机号码" name="consigneeMobile">
|
|
<uni-easyinput type="number" v-model="formData.consigneeMobile" placeholder="请输入手机号码" />
|
|
</uni-forms-item>
|
|
<uni-forms-item label="地址" name="address1">
|
|
<view class="input selectcity" @tap="openPicker">
|
|
<input placeholder="请选择省市区" disabled type="text" v-model="formData.address1"></input>
|
|
</view>
|
|
</uni-forms-item>
|
|
<uni-forms-item label="详细地址" name="address">
|
|
<uni-easyinput type="textarea" v-model="formData.address" />
|
|
</uni-forms-item>
|
|
</uni-forms>
|
|
<view class="address-btn" @tap="backPrevPage">开单</view>
|
|
</view>
|
|
</uni-popup>
|
|
<!-- 购物车弹出层 -->
|
|
<uni-popup ref="carPopup" background-color="#fff" @change="change">
|
|
<view class="popup-content">
|
|
<view v-for="(item,index) in carList" :key="index" style="position: relative;">
|
|
<view class="popup-title">
|
|
<view class="popup-title-left">
|
|
<img class="img-radius" :src="item.productPicture" alt="" v-if="item.productPicture">
|
|
<view class="noPic" v-else>暂无图片</view>
|
|
</view>
|
|
<view class="popup-title-right">
|
|
<view class="popup-title-right-box" style="color: #088FEB;">{{item.productName}}</view>
|
|
<view class="popup-title-right-box">{{item.productSn}}</view>
|
|
<view class="popup-title-right-box" style="color: darkorange;" @tap="inputDialogToggle">
|
|
<text style="margin-right:20rpx;">¥{{priceType == 1?item.wholesalePrice:item.lsprice}}</text>
|
|
<!-- <uni-icons color="#088FEB" type="compose" size="16"></uni-icons> -->
|
|
<view style="position: absolute;top: 30rpx;right: 30rpx;" @tap.stop="delShop(item)">
|
|
<uni-icons color="red" type="trash" size="26"></uni-icons>
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
</view>
|
|
<view style="padding-bottom: 100rpx;">
|
|
<view class="popup-container" v-for="(item1,index1) in item.stockLogList1" :key="index1">
|
|
<view class="checkList">
|
|
<view style="margin-right:5%;" @tap="delShopSpec(item.productId,item1.attributeList)">
|
|
<uni-icons color="red" type="minus" size="26"></uni-icons>
|
|
</view>
|
|
<view class="checkList-box">
|
|
{{item1.name}}
|
|
</view>
|
|
<uni-number-box max="100000" v-model="item1.productCount"
|
|
@change="carChange($event,index,index1)" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="popup-bottom">
|
|
<view class="popup-bottom-left">
|
|
<text>{{carType}} 款 {{carNum}} 件{{pageZongPrice}}元</text>
|
|
</view>
|
|
<view class="popup-bottom-right">
|
|
<view class="bottom-btn" @tap="this.$refs.carPopup.close()">关闭</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<!-- 查看大图弹出层 -->
|
|
<uni-popup ref="imgPopup" background-color="#fff">
|
|
<view class="img-popup-content">
|
|
<img class="img-radius" :src="bigImg" alt="" style="width: 100%;height: 100%;">
|
|
</view>
|
|
</uni-popup>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
getArea
|
|
} from '@/utils/global.js'
|
|
export default {
|
|
components: {},
|
|
data() {
|
|
return {
|
|
indexList: [],
|
|
pages: 1, //分页的页码
|
|
totalPages: 0,
|
|
shopList: [],
|
|
info: 0,
|
|
bigImg:"",
|
|
categoryId: '', //分类id
|
|
searchName: '', //搜索框输入值
|
|
shopId: '', //店铺id,
|
|
checkbox: [], //需要分享的商品id
|
|
temporaryNum: 0,
|
|
priceType: '',
|
|
yanseList:new Map(),
|
|
chimaList:new Map(),
|
|
goodsDetail: [],
|
|
attrNameList: [],
|
|
temporaryList: [],
|
|
oldTemList:[],
|
|
carList: [],
|
|
columns: [],
|
|
keyList: [],
|
|
specsList: [],
|
|
pecsList:[],
|
|
productNum: 0,
|
|
evalue: [],
|
|
productId:'',
|
|
goodsList:[],
|
|
allChangeNum:0,
|
|
attributeList: [],
|
|
zNum: 0,
|
|
pageZongPrice:0,
|
|
newTemList:[],
|
|
addressObj: {},
|
|
// show: false,
|
|
zPrice: 0,
|
|
carType: 0,
|
|
carNum: 0,
|
|
pageOldTemList:[],
|
|
dataObj :new Map(),
|
|
formData: {
|
|
consigneeMobile: '',
|
|
consigneeName: '',
|
|
address1: '',
|
|
address: '',
|
|
province: '',
|
|
city: '',
|
|
area: '',
|
|
id: ''
|
|
},
|
|
status: 'loadmore',
|
|
rules: {
|
|
consigneeName: {
|
|
rules: [{
|
|
required: true,
|
|
errorMessage: '请输入姓名',
|
|
}]
|
|
},
|
|
consigneeMobile: {
|
|
rules: [{
|
|
required: true,
|
|
errorMessage: '请输入手机号',
|
|
}, {
|
|
minLength: 11,
|
|
maxLength: 11,
|
|
errorMessage: '手机号为11个字符',
|
|
}]
|
|
},
|
|
address1: {
|
|
rules: [{
|
|
required: true,
|
|
errorMessage: '请选择地址',
|
|
}]
|
|
},
|
|
address: {
|
|
rules: [{
|
|
required: true,
|
|
errorMessage: '请输入详细地址',
|
|
}]
|
|
},
|
|
},
|
|
}
|
|
},
|
|
onReachBottom() {
|
|
if (this.pages >= this.totalPages) return;
|
|
this.status = 'loading';
|
|
this.pages = ++this.pages;
|
|
this.getShareList();
|
|
},
|
|
onLoad(options) {
|
|
this.khid = options.khid;
|
|
this.getShareList(options.khid);
|
|
},
|
|
methods: {
|
|
attrNameChange(index, data1,index1) {
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
this.goodsDetail.attributeList[index].isChecked = !this.goodsDetail.attributeList[index].isChecked;
|
|
this.goodsDetail.attributeList[index].value[index1].isChecked = !this.goodsDetail.attributeList[index].value[index1].isChecked;
|
|
if(this.goodsList[index].specs.indexOf(data1) != -1){
|
|
this.goodsList[index].specs.splice(this.goodsList[index].specs.indexOf(data1),1)
|
|
}else{
|
|
this.goodsList[index].specs.push(data1)
|
|
}
|
|
let jishuqi = 0
|
|
for(var i = 0; i < this.goodsList.length; i++){
|
|
if(this.goodsList[i].specs.length > 0){
|
|
jishuqi++
|
|
}
|
|
}
|
|
var resultList = []
|
|
if(jishuqi == this.goodsList.length){
|
|
resultList = this.combination(this.goodsList);
|
|
}
|
|
var evalue = []
|
|
var value = []
|
|
for (var m = 0; m < resultList.length; m++) {
|
|
var name = ''
|
|
let value1 = "{"
|
|
for (var j = 0; j < resultList[m].length; j++) {
|
|
if(j != resultList[m].length - 1){
|
|
name += resultList[m][j] + '/'
|
|
value1 += '"'+this.dataObj.get(resultList[m][j]) + '":"' + resultList[m][j] + '",'
|
|
}else{
|
|
name += resultList[m][j]
|
|
value1 += '"'+this.dataObj.get(resultList[m][j]) + '":"' + resultList[m][j] + '"'
|
|
}
|
|
}
|
|
value1 += "}"
|
|
value.push(value1)
|
|
evalue.push(name)
|
|
}
|
|
|
|
if(jishuqi == 0){
|
|
this.oldTemList = []
|
|
}
|
|
if(this.temporaryList.length == 0){
|
|
if(jishuqi == this.goodsList.length){
|
|
for (var i = 0; i < value.length; i++) {
|
|
this.attributeList = {
|
|
attributeList: value[i],
|
|
productCount: this.temporaryNum,
|
|
productNum:this.productNum,
|
|
name: evalue[i],
|
|
price: this.purchasePrice
|
|
}
|
|
this.temporaryList.push(this.attributeList);
|
|
}
|
|
}
|
|
}else{
|
|
let newProductCount = 0;
|
|
for (var i = 0; i < value.length; i++) {
|
|
for (var m = 0; m < this.temporaryList.length; m++) {
|
|
if(this.temporaryList[m].attributeList == value[i]){
|
|
newProductCount = this.temporaryList[m].productCount
|
|
}
|
|
}
|
|
this.attributeList = {
|
|
attributeList: value[i],
|
|
productCount: newProductCount,
|
|
productNum:this.productNum,
|
|
name: evalue[i],
|
|
price: this.purchasePrice
|
|
}
|
|
|
|
this.newTemList.push(this.attributeList);
|
|
newProductCount = 0;
|
|
}
|
|
for (var i = 0; i < this.oldTemList.length; i++) {
|
|
let oldAttributeList = '';
|
|
let oldProductCount = '';
|
|
let notChcek = true;
|
|
for (var m = 0; m < this.newTemList.length; m++) {
|
|
if(this.oldTemList[i].attributeList == this.newTemList[m].attributeList){
|
|
this.newTemList[m].productCount = this.oldTemList[i].productCount
|
|
notChcek = false;
|
|
}
|
|
}
|
|
if(this.newTemList.length > 0 && notChcek){
|
|
this.newTemList.push(this.oldTemList[i]);
|
|
}
|
|
}
|
|
|
|
for (var i = 0; i < this.pageOldTemList.length; i++) {
|
|
let oldAttributeList = '';
|
|
let oldProductCount = '';
|
|
let notChcek = true;
|
|
for (var m = 0; m < this.newTemList.length; m++) {
|
|
if(this.pageOldTemList[i].attributeList == this.newTemList[m].attributeList){
|
|
this.newTemList[m].productCount = this.pageOldTemList[i].productCount
|
|
notChcek = false;
|
|
}
|
|
}
|
|
if(this.newTemList.length > 0 && notChcek){
|
|
this.newTemList.push(this.pageOldTemList[i]);
|
|
}
|
|
}
|
|
}
|
|
this.$nextTick(()=>{
|
|
for(var i=0;i<this.temporaryList.length;i++){
|
|
for(var m=0;m<this.pecsList.length;m++){
|
|
if(this.temporaryList[i].attributeList == this.pecsList[m].attributeList){
|
|
this.temporaryList[i].productNum = this.pecsList[m].stockCount
|
|
}
|
|
}
|
|
}
|
|
})
|
|
|
|
if(jishuqi != this.goodsList.length){
|
|
if(this.oldTemList.length ==0 && this.pageOldTemList.length ==0){
|
|
this.newTemList = []
|
|
this.temporaryList = []
|
|
}
|
|
}
|
|
if(this.newTemList.length != 0 && jishuqi == this.goodsList.length){
|
|
this.temporaryList = this.newTemList;
|
|
this.oldTemList = []
|
|
this.newTemList = []
|
|
}
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 200)
|
|
},
|
|
temporaryChange(val) {
|
|
this.zNum = 0
|
|
for (var i = 0; i < this.temporaryList.length; i++) {
|
|
this.zNum += this.temporaryList[i].productCount || 0
|
|
}
|
|
this.zPrice = this.zNum * this.purchasePrice
|
|
},
|
|
//点击开单按钮,调起地址输入窗
|
|
clickPrice() {
|
|
this.$refs.inputDialog.open('bottom')
|
|
},
|
|
//获取弹出层状态
|
|
change(e) {
|
|
|
|
},
|
|
//弹出购物车或者商品规格选择弹窗
|
|
toggle(type, item) {
|
|
|
|
this.type = type
|
|
if (type == 'carPopup') {
|
|
console.log(this.carList)
|
|
this.carNum = 0
|
|
for (let i = 0; i < this.carList.length; i++) {
|
|
this.carNum += this.carList[i].num
|
|
}
|
|
this.countTotalPrice()
|
|
this.$refs.carPopup.open('bottom')
|
|
this.carType = this.carList.length
|
|
} else {
|
|
uni.showLoading({
|
|
title: '加载中...'
|
|
})
|
|
this.productId = item.id
|
|
this.goodsList = []
|
|
this.allChangeNum = 0
|
|
this.checkGoods(item);
|
|
this.$refs.popup.open('bottom')
|
|
}
|
|
|
|
},
|
|
//选择商品查询商品规格
|
|
async checkGoods(item) {
|
|
let that = this;
|
|
if (this.priceType == 1) { //批发价
|
|
this.purchasePrice = item.wholesalePrice;
|
|
} else {
|
|
this.purchasePrice = item.price;
|
|
}
|
|
console.log(item);
|
|
this.goodsDetail = item;
|
|
this.temporaryList = []
|
|
this.pageOldTemList = []
|
|
if (this.carList != '') {
|
|
this.zNum = 0
|
|
for (let i = 0; i < this.carList.length; i++) {
|
|
|
|
if (item.id == this.carList[i].productId) {
|
|
this.zNum = this.carList[i].num
|
|
this.temporaryList = this.carList[i].stockLogList1
|
|
this.pageOldTemList = this.carList[i].stockLogList1
|
|
this.oldTemList = this.carList[i].stockLogList1
|
|
}
|
|
}
|
|
|
|
}
|
|
await this.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId", "POST", {
|
|
categoryId: this.goodsDetail.categoryId
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
if (typeof(res1.result) == 'string') {
|
|
let newObj = JSON.parse(res1.result)
|
|
let newArr = []
|
|
let dataArr = []
|
|
for (let val in newObj) {
|
|
let valueObj = [];
|
|
let isTrue = false
|
|
for (var i = 0; i < newObj[val].length; i++) {
|
|
for (var m = 0; m < this.oldTemList.length; m++) {
|
|
var data = this.oldTemList[m].name.split('/')
|
|
for(var j = 0; j < data.length; j++){
|
|
if(data[j] == newObj[val][i]){
|
|
isTrue = true
|
|
}
|
|
}
|
|
}
|
|
for (var m = 0; m < this.pageOldTemList.length; m++) {
|
|
var data = this.pageOldTemList[m].name.split('/')
|
|
for(var j = 0; j < data.length; j++){
|
|
if(data[j] == newObj[val][i]){
|
|
isTrue = true
|
|
}
|
|
}
|
|
}
|
|
valueObj.push({
|
|
value: newObj[val][i],
|
|
isChecked: false
|
|
})
|
|
that.dataObj.set(newObj[val][i],val)
|
|
isTrue = false
|
|
}
|
|
newArr.push({
|
|
name: val,
|
|
value: valueObj
|
|
})
|
|
}
|
|
this.goodsDetail.attributeList = newArr;
|
|
for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
|
|
let oldCheck = false
|
|
let oldValue = []
|
|
for (var m = 0; m < this.goodsDetail.attributeList[i].value.length; m++) {
|
|
if(this.goodsDetail.attributeList[i].value[m].isChecked == true){
|
|
oldCheck = true
|
|
oldValue.push(this.goodsDetail.attributeList[i].value[m].value)
|
|
}
|
|
}
|
|
if(oldCheck){
|
|
let specs1 = {
|
|
specs:[]
|
|
}
|
|
|
|
specs1.specs = oldValue
|
|
this.goodsList.push(specs1)
|
|
}else{
|
|
let specs1 = {
|
|
specs:[]
|
|
}
|
|
this.goodsList.push(specs1)
|
|
}
|
|
oldCheck = false
|
|
oldValue = []
|
|
}
|
|
}
|
|
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
this.getKCList(item.id);
|
|
},
|
|
//库存商品详情
|
|
getKCList(id) {
|
|
this.yanseList = new Map()
|
|
this.chimaList = new Map()
|
|
this.tui.request("/app/stock/productCount", "GET", {
|
|
productId: id
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
this.pecsList = res.result
|
|
|
|
for(let i=0;i<res.result.length;i++){
|
|
let attributeList = JSON.parse(res.result[i].attributeList)
|
|
Object.keys(attributeList).forEach(key => {
|
|
if(key == '颜色'){
|
|
if(this.yanseList.has(attributeList[key]) != true){
|
|
this.yanseList.set(attributeList[key],attributeList[key])
|
|
}
|
|
|
|
}else{
|
|
if(this.chimaList.has(attributeList[key]) != true){
|
|
this.chimaList.set(attributeList[key],attributeList[key])
|
|
}
|
|
}
|
|
})
|
|
}
|
|
for(let i=0;i<this.goodsDetail.attributeList[0].value.length;i++){ //颜色
|
|
if(this.yanseList.has(this.goodsDetail.attributeList[0].value[i].value) == true){
|
|
this.goodsDetail.attributeList[0].value[i].isKucun = true
|
|
}
|
|
}
|
|
for(let i=0;i<this.goodsDetail.attributeList[1].value.length;i++){ //尺码
|
|
if(this.chimaList.has(this.goodsDetail.attributeList[1].value[i].value) == true){
|
|
this.goodsDetail.attributeList[1].value[i].isKucun = true
|
|
}
|
|
}
|
|
console.log('颜色',this.yanseList)
|
|
console.log('尺码',this.chimaList)
|
|
console.log('颜色',this.goodsDetail)
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
setTimeout(res => {
|
|
uni.hideLoading();
|
|
}, 200)
|
|
},
|
|
//顶部搜索框
|
|
search(res) {
|
|
this.pages = 1
|
|
this.searchName = res.value
|
|
this.getShareList()
|
|
},
|
|
//清空搜索条件
|
|
clearSearch(){
|
|
this.pages = 1
|
|
this.searchName = ''
|
|
this.getShareList()
|
|
},
|
|
inputDialogToggle() {
|
|
this.$refs.inputDialog.open()
|
|
},
|
|
carChange(e, index, index1) {
|
|
this.carNum = 0
|
|
this.pageZongPrice = 0
|
|
for (let i = 0; i < this.carList.length; i++) {
|
|
this.carList[i].num = 0
|
|
for (let m = 0; m < this.carList[i].stockLogList1.length; m++) {
|
|
this.carList[i].num += this.carList[i].stockLogList1[m].productCount
|
|
this.pageZongPrice += this.carList[i].stockLogList1[m].productCount * this.carList[i].stockLogList1[m].price
|
|
}
|
|
this.carNum += this.carList[i].num
|
|
}
|
|
},
|
|
//弹窗选择规格后,点击弹窗中选好了按钮
|
|
temporaryCheck() {
|
|
for (var i = 0; i < this.temporaryList.length; i++) {
|
|
if (this.temporaryList[i].productCount <= 0) {
|
|
this.tui.toast("商品数量不能为零!")
|
|
return;
|
|
}
|
|
}
|
|
let data = {
|
|
productId: this.goodsDetail.id,
|
|
price: this.zPrice,
|
|
num: this.zNum,
|
|
categoryId:this.goodsDetail.categoryId,
|
|
productName: this.goodsDetail.productName,
|
|
productSn: this.goodsDetail.productSn,
|
|
productPicture: this.goodsDetail.productPicture,
|
|
supplierName: this.goodsDetail.supplierName,
|
|
stockLogList1: this.temporaryList,
|
|
saleDetailQueryDTO1: [],
|
|
wholesalePrice: this.goodsDetail.wholesalePrice,
|
|
lsprice: this.goodsDetail.price
|
|
}
|
|
if (this.carList.length == 0) {
|
|
this.carList.push(data)
|
|
} else {
|
|
let aa = true;
|
|
for (let i = 0; i < this.carList.length; i++) {
|
|
if (this.carList[i].productId == data.productId) {
|
|
this.carList[i] = data
|
|
aa = false
|
|
}
|
|
}
|
|
if (aa) {
|
|
this.carList.push(data)
|
|
}
|
|
}
|
|
|
|
|
|
for (let i = 0; i < this.carList.length; i++) {
|
|
this.carList[i].num = 0
|
|
for (let m = 0; m < this.carList[i].stockLogList1.length; m++) {
|
|
this.carList[i].num += this.carList[i].stockLogList1[m].productCount
|
|
}
|
|
}
|
|
|
|
this.temporaryList = []
|
|
this.oldTemList = []
|
|
this.purchasePrice = ''
|
|
this.zPrice = ''
|
|
this.zNum = ''
|
|
for (let i = 0; i < this.goodsDetail.attributeList.length; i++) {
|
|
this.goodsDetail.attributeList[i].isChecked = false;
|
|
for (let m = 0; m < this.goodsDetail.attributeList[i].value.length; m++) {
|
|
this.goodsDetail.attributeList[i].value[m].isChecked = false
|
|
}
|
|
}
|
|
this.$refs.popup.close()
|
|
|
|
},
|
|
//删除整条商品
|
|
delShop(item) {
|
|
var that = this;
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "确定删除此条商品吗?",
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
for (let i = 0; i < that.carList.length; i++) {
|
|
if (that.carList[i].productId == item.productId) {
|
|
that.carNum -= that.carList[i].num
|
|
that.carList.splice(i, 1)
|
|
}
|
|
}
|
|
that.carType = that.carList.length
|
|
}
|
|
that.$forceUpdate()
|
|
that.countTotalPrice()
|
|
}
|
|
})
|
|
},
|
|
countTotalPrice(){
|
|
this.pageZongPrice = 0
|
|
for(let i=0;i<this.carList.length;i++){
|
|
for(let m=0;m<this.carList[i].stockLogList1.length;m++){
|
|
this.pageZongPrice += this.carList[i].stockLogList1[m].productCount * this.carList[i].stockLogList1[m].price
|
|
}
|
|
}
|
|
|
|
},
|
|
//查看大图
|
|
largeImg(img) {
|
|
this.bigImg = img
|
|
this.$refs.imgPopup.open()
|
|
},
|
|
//选商品的时候能删除规格
|
|
delCarData(index) {
|
|
this.temporaryList.splice(index, 1);
|
|
this.temporaryChange()
|
|
},
|
|
//删除商品下的某一个规格
|
|
delShopSpec(index, index1) {
|
|
var that = this;
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "确定删除此条商品吗?",
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
for (let i = 0; i < that.carList.length; i++) {
|
|
if (that.carList[i].productId == index) {
|
|
for (let m = 0; m < that.carList[i].stockLogList1.length; m++) {
|
|
|
|
if (that.carList[i].stockLogList1[m].attributeList == index1) {
|
|
that.carList[i].num -= that.carList[i].stockLogList1[m]
|
|
.productCount
|
|
that.carNum -= that.carList[i].stockLogList1[m].productCount
|
|
that.carList[i].stockLogList1.splice(m, 1)
|
|
continue;
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
if (that.carList[i].stockLogList1.length == 0) {
|
|
that.carList.splice(i, 1)
|
|
}
|
|
}
|
|
that.carType = that.carList.length
|
|
|
|
}
|
|
that.$forceUpdate()
|
|
that.countTotalPrice()
|
|
}
|
|
})
|
|
},
|
|
//点击底部下单按钮
|
|
backPrevPage() {
|
|
let that = this;
|
|
this.$refs.form.validate().then(res => {
|
|
let obj = {
|
|
mobile: that.formData.consigneeMobile,
|
|
username: that.formData.consigneeName,
|
|
oldSaleId: this.khid,
|
|
sale: {
|
|
area: this.formData.area,
|
|
city: this.formData.city,
|
|
province: this.formData.province,
|
|
receiveAddress: that.formData.address,
|
|
totalAmount: that.zPrice, //应付金额
|
|
shopId: this.shopId,
|
|
},
|
|
saleDetailList: this.carList
|
|
}
|
|
this.tui.request("/app/sale/savePresale", "post", obj, false, false).then((res) => {
|
|
if (res.code == 200) {
|
|
this.tui.toast("下单成功,待商家配货")
|
|
setTimeout(() => {
|
|
uni.reLaunch({
|
|
url: `/pages/login/login`
|
|
})
|
|
}, 2000)
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
})
|
|
}).catch(err => {
|
|
|
|
})
|
|
},
|
|
openPicker() {
|
|
let that = this;
|
|
uni.chooseLocation({
|
|
success: function(res) {
|
|
if (res.name != '') {
|
|
let aaa = getArea(res.address)
|
|
that.formData.province = aaa.province
|
|
that.formData.city = aaa.city
|
|
that.formData.area = aaa.country
|
|
that.formData.address = aaa.address + '-' + res.name
|
|
that.formData.address1 = aaa.province + aaa.city + aaa.country
|
|
} else {
|
|
that.tui.toast("微信地址选择器调用失败,请重新选择!")
|
|
}
|
|
},
|
|
fail: function(res) {
|
|
|
|
}
|
|
});
|
|
// this.show = true
|
|
},
|
|
// onhideShow() {
|
|
// this.show = false
|
|
// },
|
|
//选中省市区
|
|
// onsetCity(e) {
|
|
// let data = e.detail.target.dataset;
|
|
// let address = data.province + data.city + data.area;
|
|
// this.show = false
|
|
// this.formData.address1 = address;
|
|
// this.addressObj = {
|
|
// province: data.province,
|
|
// city: data.city,
|
|
// area: data.area,
|
|
// }
|
|
// },
|
|
//点击分类获取商品列表
|
|
getShareList(id) {
|
|
this.status = 'loading';
|
|
// this.shopList = []
|
|
this.tui.request("/app/productShare/getShareList", "POST", {
|
|
searchStr: this.searchName,
|
|
id: this.khid,
|
|
pageNum: this.pages,
|
|
pageSize: '10'
|
|
}, false, true).then((res) => {
|
|
this.status = 'nomore';
|
|
if (res.code == 200) {
|
|
uni.setNavigationBarTitle({
|
|
title: res.result.share.shopName
|
|
});
|
|
this.priceType = res.result.share.priceType
|
|
this.shopId = res.result.shareList.records[0].shopId
|
|
if (this.pages == 1) {
|
|
this.shopList = res.result.shareList.records
|
|
} else {
|
|
this.shopList = [...this.shopList, ...res.result.shareList.records]
|
|
}
|
|
for (var i = 0; i < this.shopList.length; i++) {
|
|
if (res.result.share.priceType == 1) { //批发价
|
|
this.shopList[i].discountAmount = this.shopList[i].wholesalePrice
|
|
} else { //零售
|
|
this.shopList[i].discountAmount = this.shopList[i].price
|
|
}
|
|
}
|
|
this.totalPages = res.result.shareList.pages
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
combination(arr) {
|
|
let result = [
|
|
[]
|
|
]
|
|
|
|
arr.map(x => {
|
|
var res = []
|
|
result.map(y => {
|
|
x.specs.map(z => {
|
|
res.push([...y, z])
|
|
})
|
|
})
|
|
result = res
|
|
})
|
|
return result;
|
|
},
|
|
//保存已选
|
|
saveCheck(){
|
|
this.pageOldTemList = this.temporaryList
|
|
for(var i=0;i<this.goodsDetail.attributeList.length;i++){
|
|
this.goodsList[i].specs = []
|
|
for(var m=0;m<this.goodsDetail.attributeList[i].value.length;m++){
|
|
this.goodsDetail.attributeList[i].value[m].isChecked = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page {
|
|
height: 100%;
|
|
}
|
|
|
|
.page1 {
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 92%;
|
|
}
|
|
|
|
.uni-tab__dot {
|
|
padding: 0 4px;
|
|
line-height: 15px;
|
|
color: #ffffff;
|
|
text-align: center;
|
|
font-size: 12px;
|
|
background-color: #ff0000;
|
|
border-radius: 15px;
|
|
}
|
|
|
|
.address-btn {
|
|
width: 100%;
|
|
height: 80rpx;
|
|
background: #088FEB;
|
|
color: #fff;
|
|
font-size: 36rpx;
|
|
text-align: center;
|
|
line-height: 80rpx;
|
|
border-radius: 10px;
|
|
}
|
|
|
|
.popup-content {
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 15px;
|
|
height: 1200rpx;
|
|
background-color: #fff;
|
|
margin-bottom: 80rpx;
|
|
overflow: scroll;
|
|
}
|
|
|
|
.popup-title-right-box {
|
|
height: 50rpx;
|
|
line-height: 50rpx;
|
|
}
|
|
|
|
.popup-title-right {
|
|
width: 400rpx;
|
|
margin-left: 30rpx;
|
|
}
|
|
|
|
.popup-title-left {
|
|
width: 150rpx;
|
|
height: 150rpx;
|
|
}
|
|
|
|
.popup-title-left image {
|
|
width: 150rpx;
|
|
height: 150rpx;
|
|
|
|
}
|
|
|
|
.popup-title {
|
|
display: flex;
|
|
height: 180rpx;
|
|
border-bottom: 1px solid #eee;
|
|
margin-top: 20rpx;
|
|
}
|
|
|
|
.popup-container {
|
|
width: 100%;
|
|
background: #fff;
|
|
height: 50rpx;
|
|
}
|
|
|
|
.uni-tab__text {
|
|
font-size: 12px;
|
|
color: #646566;
|
|
}
|
|
|
|
.popup-pay-title {
|
|
height: 100rpx;
|
|
line-height: 100rpx;
|
|
text-align: center;
|
|
font-weight: bold;
|
|
font-size: 32rpx;
|
|
}
|
|
|
|
.title-box {
|
|
background: #fff;
|
|
}
|
|
|
|
.popup-pay-content {
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 0 15px 15px 15px;
|
|
width: 95%;
|
|
margin: 0 auto;
|
|
height: auto;
|
|
background-color: #fff;
|
|
}
|
|
|
|
.bottom-box {
|
|
width: 100%;
|
|
height: 120rpx;
|
|
position: fixed;
|
|
bottom: 0;
|
|
display: flex;
|
|
background: #fff;
|
|
z-index: 99;
|
|
}
|
|
|
|
.bottom-left {
|
|
width: 15%;
|
|
position: relative;
|
|
}
|
|
|
|
.bottom-right {
|
|
width: 85%;
|
|
|
|
.bottom-btn {
|
|
width: 85%;
|
|
line-height: 35px;
|
|
height: 70rpx;
|
|
text-align: center;
|
|
margin-top: 10rpx;
|
|
color: #fff;
|
|
font-size: 28rpx;
|
|
margin: 0 auto;
|
|
background: linear-gradient(90deg, #60F3FF, #088FEB);
|
|
border-radius: 70rpx;
|
|
}
|
|
}
|
|
|
|
.bottom-left-box {
|
|
display: flex;
|
|
flex-direction: column;
|
|
text-align: center;
|
|
}
|
|
|
|
.content-box {
|
|
background: #fff;
|
|
flex: 1;
|
|
display: flex;
|
|
}
|
|
|
|
.content-left {
|
|
width: 170rpx;
|
|
background: #eee;
|
|
height: 100%;
|
|
}
|
|
|
|
.left-box {
|
|
width: 100%;
|
|
height: 90rpx;
|
|
font-size: 30rpx;
|
|
text-align: center;
|
|
line-height: 90rpx;
|
|
border-bottom: 1px solid #fff;
|
|
}
|
|
|
|
.left-box-hover {
|
|
width: 100%;
|
|
height: 90rpx;
|
|
font-size: 30rpx;
|
|
text-align: center;
|
|
line-height: 90rpx;
|
|
border-bottom: 1px solid #fff;
|
|
background-color: #fff;
|
|
}
|
|
|
|
.red {
|
|
border-right: 3px solid red;
|
|
}
|
|
|
|
.content-right {
|
|
width: 100%;
|
|
overflow-y: scroll;
|
|
margin-bottom: 150rpx;
|
|
}
|
|
|
|
.right-box {
|
|
width: 100%;
|
|
height: 220rpx;
|
|
display: flex;
|
|
border-bottom: 1px solid #eee;
|
|
position: relative;
|
|
}
|
|
|
|
.box-left {
|
|
width: 170rpx;
|
|
height: 170rpx;
|
|
background-size: 100%;
|
|
margin: 25rpx;
|
|
border-radius: 20rpx;
|
|
}
|
|
|
|
.box-left img {
|
|
width: 100%;
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
.box-right {
|
|
margin-top: 17rpx;
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.box-right-name {
|
|
font-size: 30rpx;
|
|
font-weight: bold;
|
|
padding-left: 20rpx;
|
|
height: 30%;
|
|
}
|
|
|
|
.box-right-num {
|
|
padding: 5rpx 0;
|
|
color: #777;
|
|
padding-left: 20rpx;
|
|
height: 30%;
|
|
}
|
|
|
|
.box-right-price {
|
|
display: flex;
|
|
font-size: 25rpx;
|
|
}
|
|
|
|
.checkbox {
|
|
width: 40rpx;
|
|
height: 40rpx;
|
|
position: absolute;
|
|
top: 20rpx;
|
|
right: 30rpx;
|
|
}
|
|
|
|
.price-box {
|
|
flex: 1;
|
|
text-align: left;
|
|
display: flex;
|
|
flex-direction: column;
|
|
margin-right: 20rpx;
|
|
}
|
|
|
|
.price-box text:first-child {
|
|
color: #ffa200
|
|
}
|
|
|
|
.uni-tab__cart-button-right,
|
|
.uni-tab__cart-sub-right {
|
|
display: none;
|
|
flex: none;
|
|
}
|
|
|
|
.title-fur {
|
|
width: 95%;
|
|
height: 50rpx;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.name {
|
|
font-size: 30rpx;
|
|
width: 50%;
|
|
float: left;
|
|
height: 50rpx;
|
|
line-height: 70rpx;
|
|
}
|
|
|
|
.content-fur {
|
|
padding-bottom: 25rpx;
|
|
}
|
|
.noPic{
|
|
width: 150rpx;
|
|
height: 150rpx;
|
|
border-radius: 10px;
|
|
text-align: center;
|
|
line-height: 140rpx;
|
|
color: #777;
|
|
background: #eee;
|
|
}
|
|
.content-low {
|
|
width: auto;
|
|
border: 1px solid #eee;
|
|
display: inline-block;
|
|
min-width: 90rpx;
|
|
padding: 5rpx;
|
|
font-size: 35rpx;
|
|
text-align: center;
|
|
color: #777;
|
|
margin: 20rpx 0 0 20rpx;
|
|
}
|
|
|
|
.content-low:hover {
|
|
background: #eee;
|
|
}
|
|
|
|
.checkList {
|
|
display: flex;
|
|
height: 50rpx;
|
|
font-size: 28rpx;
|
|
line-height: 50rpx;
|
|
margin: 20rpx 0;
|
|
}
|
|
|
|
.checkList-box {
|
|
height: 50rpx;
|
|
width: 60%;
|
|
}
|
|
|
|
.popup-bottom {
|
|
width: 95%;
|
|
height: 100rpx;
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 2.5%;
|
|
display: flex;
|
|
z-index: 99;
|
|
background: #fff;
|
|
}
|
|
|
|
.popup-bottom-left {
|
|
width: 50%;
|
|
line-height: 80rpx;
|
|
}
|
|
|
|
.popup-bottom-right {
|
|
width: 50%;
|
|
line-height: 100rpx;
|
|
|
|
.bottom-btn {
|
|
width: 70%;
|
|
line-height: 35px;
|
|
height: 70rpx;
|
|
text-align: center;
|
|
/* margin-top: 10rpx; */
|
|
color: #fff;
|
|
font-size: 28rpx;
|
|
margin: 0 auto;
|
|
background: linear-gradient(90deg, #60F3FF, #088FEB);
|
|
border-radius: 70rpx;
|
|
}
|
|
}
|
|
|
|
.attrs {
|
|
.suibian {
|
|
display: inline-block;
|
|
border: 1px solid #5fd9ee;
|
|
margin: 20rpx;
|
|
margin-bottom: 0;
|
|
margin-left: 0;
|
|
background-color: #fff;
|
|
color: #5fd9ee;
|
|
padding: 0 10px;
|
|
min-width: 100rpx;
|
|
line-height: 35px;
|
|
height: 70rpx;
|
|
text-align: center;
|
|
border-radius: 20rpx;
|
|
}
|
|
|
|
.checkedText {
|
|
background-color: #5fd9ee;
|
|
color: #fff;
|
|
border-radius: 20rpx;
|
|
}
|
|
}
|
|
.kucun{
|
|
background: url(https://jewel-shop.oss-cn-beijing.aliyuncs.com/9428d632981647728829da336a1d24b3.png) no-repeat;
|
|
width: 50rpx;
|
|
height: 25rpx;
|
|
position: absolute;
|
|
top: -14rpx;
|
|
right: -15rpx;
|
|
background-size: 100%;
|
|
}
|
|
.img-popup-content {
|
|
width: 500rpx;
|
|
height: 500rpx;
|
|
}
|
|
</style>
|