1.对接调货大厅等接口 2.优化调货、委托界面

This commit is contained in:
jia 2023-08-14 18:03:57 +08:00
parent 6e2aafcb4f
commit 4ad08f699d
12 changed files with 810 additions and 304 deletions

View File

@ -121,7 +121,7 @@
.release_content_left {
display: flex;
}
.release_content_right {
@ -135,7 +135,7 @@
height: 96rpx;
margin-top: 21rpx;
margin-right: 19rpx;
margin-left: -15rpx;
image {
width: 111rpx;
@ -144,11 +144,12 @@
}
.release_imga {
width: 76rpx;
height: 113rpx;
margin-left: 21rpx;
margin-top: 5rpx;
margin-right: 19rpx;
margin-right: 50rpx;
image {
width: 76rpx;

View File

@ -31,34 +31,39 @@
<view class='text'>
<view class='line2 name'>{{item.store_name}}</view>
<view class="picTxt_one">
<view class="uni-form-item uni-column" v-if="item.attrValue.length>0">
<picker class="slecte" @change="bindPickerChange($event,item.attrValue)"
:value="index" :range="item.attrValue" :range-key="'sku'">
<view class="uni-input">{{item.attrValue[index].sku}}</view>
</picker>
</view>
<view class="picTxt_one" v-if="item.attrValue.length>0">
<picker class="slecte" @change="bindPickerChange($event,item.attrValue,i)"
:value="index" :range="item.attrValue" :range-key="'sku'">
<view class="uni-input">{{item.attrValue[index].sku}}</view>
</picker>
<view class="" style="margin-top: 10rpx;">
库存:{{item.stock}}
库存:{{item.attrValue[index].stock}}
</view>
</view>
</view>
<view class="picTxt_price">
<view class="price">
<span>出售价格</span>
<input type="text" value="" placeholder="输入出售价格" placeholder-style="color: #CCCCCC;"/>
<input type="text" :value="item.price" placeholder="输入出售价格"
placeholder-style="color: #CCCCCC;" />
</view>
<view class="price_num">
<span>出售数量</span>
<subtractive style="margin-top: 10rpx;margin-left: 20rpx;" class="step" :min="1" :max="100"
:value="peicenumber" :isMax="true" :isMin="true" index="11"
@eventChange="numberChange"></subtractive>
<subtractive v-if='item.num==0' style="margin-top: 10rpx;margin-left: 20rpx;" class="step" :min="1"
:max="item.attrValue[index].stock" :value="peicenumber" :isMax="true" :isMin="true" index="11"
@eventChange="numberChange($event,i)"></subtractive>
<subtractive v-else style="margin-top: 10rpx;margin-left: 20rpx;" class="step" :min="1"
:max="item.attrValue[index].stock" :value="item.num" :isMax="true" :isMin="true" index="11"
@eventChange="numberChange($event,i)"></subtractive>
</view>
</view>
</view>
@ -140,8 +145,8 @@
IfProductId: 0,
}],
index: 0,
pickerData: '请选择'
pickerData: '请选择',
itstock: '',
};
},
@ -157,16 +162,13 @@
mounted() {
this.checkedArr = this.checkedObj
this.getBounht();
},
methods: {
// picker
bindPickerChange: function(e, storage) {
console.log(e)
console.log(storage)
// this.index = e.target.value
bindPickerChange: function(e, storage, num) {
this.bought[num].attrValue[this.index].stock=storage[e.detail.value].stock
this.bought[num].product_attr_unique=storage[e.detail.value].unique
this.pickerData = storage[this.index] //
},
@ -174,8 +176,10 @@
close() {
this.$emit('close');
},
numberChange(data) {
numberChange(data,i) {
this.peicenumber = data.number;
this.bought[i].num=data.number
},
tabs(index) {
this.isActive = index
@ -203,7 +207,7 @@
},
searchBut() {
this.whereb.page = this.wherec.page = this.wheres.page =
this.bought = []
this.bought = []
this.isActive == 0 ? this.getBounht() : ''
},
getBounht() {
@ -213,7 +217,6 @@
getCommunitygetOrderList(that.whereb).then(
res => {
that.loadingb = false;
that.loadedb = res.data.list.length < that.whereb.limit;
that.bought.push.apply(that.bought, res.data.list);
@ -237,9 +240,14 @@
that.checkedArr.forEach((val, i) => {
if (item.product_id == val.product_id) {
that.$set(item, 'check', true);
that.$set(item, 'num', val.num);
}else{
that.$set(item, 'num', 0);
}
})
})
},
/*已选中的商品打钩*/
getCheckedGoods() {
@ -250,10 +258,19 @@
},
/*点击选中与否*/
goodsCheck(item) {
this.$set(item, 'check', !item.check);
console.log(item, 'check', !item.check)
this.$set(item, 'check', !item.check);
if (item.check) {
if(this.peicenumber>0){
item.num=this.peicenumber
}else{
item.num=1
}
if(!item.product_attr_unique){
item.product_attr_unique=item.attrValue[0].unique
}
this.checkedArr.push(item)
} else {
this.checkedArr.splice(this.checkedArr.findIndex(itemn => ((itemn.spu_id == item.spu_id) || (item
.spu_id == (
@ -263,8 +280,9 @@
},
/*确定提交*/
submit() {
this.$emit('getProduct', this.checkedArr);
console.log(this.checkedArr)
},
}
}
@ -408,7 +426,7 @@
.price {
display: flex;
margin-right: 15rpx;
margin-right: 15rpx;
input {
width: 210rpx;
@ -419,9 +437,9 @@
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
margin-left: 20rpx;
}
}

View File

@ -6,7 +6,7 @@
<cxNavTitle :tabs="tabs" :activeItem="activeItem" @tabClick="tabClick" :show='false'></cxNavTitle>
</view>
<!-- 审核通过 打折的拒绝同意功能 调货不需要功能 -->
<view class="content-content" v-for="(item,i) in list" :key="i" @click="nav(item)">
<view class="content-content" v-for="(item,i) in list" :key="i" >
<view class="content-one">
<view class="content-one-img">
@ -43,12 +43,12 @@
<view class="content-two_oneq" v-if="item.type==2">
<view class="content-two-editb" @click="soldEdit">
<view class="content-two-editb" @click="accepted">
已接受
</view>
<view class="contentgn">
<view class="contentgn_a">
<view class="contentgn_a" @click="closingorder">
结束委托
</view>
<span></span>
@ -60,7 +60,7 @@
<view class="content-two_one" v-if="item.type==3">
<view class="content-two-editc" @click="soldEdit">
<view class="content-two-editc" @click="declined">
已拒绝
</view>
<view class="contentgn">
@ -94,7 +94,7 @@
<view v-if="orderList.length == 0 && this.where.page > 1">
<emptyPage title="暂无订单~"></emptyPage>
</view>
<!-- <uni-popup ref="bindmobile" type="center" @click="close">
<uni-popup ref="bindmobile" type="center" @click="close">
<view class="" style="position: relative;">
<view class="entrust">
@ -114,10 +114,10 @@
<view class="bg-content-c">
利息比例: <span>0.05%</span>
</view>
<view class="entrust_bga_btn">
<view class="cancellation">
拒绝
拒绝
</view>
<view class="determine">
接受
@ -127,8 +127,8 @@
</view>
</view>
</view>
</uni-popup> -->
<!-- <uni-popup ref="bindmobile" type="center" @click="close">
</uni-popup>
<uni-popup ref="bindmobile1" type="center" @click="close">
<view class="" style="position: relative;">
<view class="entrust">
@ -155,43 +155,42 @@
</view>
</view>
</uni-popup> -->
</uni-popup>
<uni-popup ref="bindmobile2" type="center" @click="close">
<!-- <uni-popup ref="bindmobile" type="center" @click="close">
<view class="" style="position: relative;">
<view class="entrust">
<view class="entrust_close" @click="close">
<image src="@/static/images/wt_close.png" mode=""></image>
</view>
<view class="entrust_bg">
<view class="entrust_bg-content">
<view class="bg-content-a" style="margin-left: 207rpx;">
<view class="" style="position: relative;">
<view class="entrust">
<view class="entrust_close" @click="close">
<image src="@/static/images/wt_close.png" mode=""></image>
</view>
<view class="entrust_bg">
<view class="entrust_bg-content">
<view class="bg-content-a" style="margin-left: 207rpx;">
结束委托申请处理
</view>
<view class="bg-content-b">
结算周期: <span>30</span>
</view>
<view class="bg-content-c">
利息比例: <span>0.05%</span>
</view>
<view class="entrust_bga_btn">
<view class="cancellation">
</view>
<view class="bg-content-b">
结算周期: <span>30</span>
</view>
<view class="bg-content-c">
利息比例: <span>0.05%</span>
</view>
<view class="entrust_bga_btn">
<view class="cancellation">
拒绝
</view>
<view class="determine">
接受
</view>
</view>
<view class="determine">
接受
</view>
</view>
</view>
</view>
</view>
</uni-popup> -->
<uni-popup ref="bindmobile" type="center" @click="close">
</view>
</uni-popup>
<uni-popup ref="bindmobile3" type="center" @click="close">
<view class="" style="position: relative;">
<view class="entrust">
@ -211,17 +210,16 @@
<view class="bg-content-c">
利息比例: <span>0.05%</span>
</view>
<view class="bg-content-c" >
<view class="bg-content-c">
拒绝原因
<view class="" style="margin-top: 21rpx;">
<textarea value="" placeholder="输入拒绝原因" class="bg-content_textarea"/>
<textarea value="" placeholder="输入拒绝原因" class="bg-content_textarea" />
</view>
</view>
<view class="entrust_bga_btn">
<view class="determine">
接受
</view>
@ -302,13 +300,13 @@
},
mounted() {
this.$refs.bindmobile.open()
},
methods: {
nav(item) {
uni.navigateTo({
url: '/pages/commissionedSales/delegation_details/index'
})
// uni.navigateTo({
// url: '/pages/commissionedSales/delegation_details/index'
// })
},
tabClick(e) { //
this.activeItem = e.name; //class
@ -318,27 +316,30 @@
close() {
console.log('1111111')
this.$refs.bindmobile.close()
this.$refs.bindmobile1.close()
this.$refs.bindmobile2.close()
this.$refs.bindmobile3.close()
},
//
//
soldEdit() {
console.log('111111')
this.$refs.bindmobile.open()
},
//
pendingDeletion() {
//
accepted() {
this.$refs.bindmobile1.open()
},
//
editReviewe() {
//
closingorder() {
this.$refs.bindmobile3.open()
},
//
auditDelete() {
//
declined() {
this.$refs.bindmobile2.open()
},
//
@ -581,8 +582,6 @@
.entrust {
width: 694rpx;
height: 676rpx;
.entrust_close {
width: 44rpx;
@ -738,10 +737,10 @@
.entrust_bgb {
width: 694rpx;
height: 994rpx;
background: url('@/static/images/wtbg3.png') no-repeat;
background: url('@/static/images/wtbg5.png') no-repeat;
background-size: 100% 100%;
position: relative;
margin-top: -190rpx;
.entrust_bg-content {
position: absolute;
@ -788,11 +787,12 @@
margin-left: 18rpx;
}
}
.bg-content_textarea{
.bg-content_textarea {
width: 624rpx;
height: 152rpx;
padding: 25rpx 18rpx;
background: #F5F5F5;
}
}
@ -801,7 +801,7 @@
display: flex;
margin-top: 33rpx;
.determine {
margin-left: 188rpx;
width: 249rpx;

View File

@ -43,12 +43,12 @@
<view class="content-two_oneq" v-if="item.type==2">
<view class="content-two-editb" @click="soldEdit">
<view class="content-two-editb" @click="accepted">
已接受
</view>
<view class="contentgn">
<view class="contentgn_a">
<view class="contentgn_a" @click="closingorder">
结束委托
</view>
<span></span>
@ -60,7 +60,7 @@
<view class="content-two_one" v-if="item.type==3">
<view class="content-two-editc" @click="soldEdit">
<view class="content-two-editc" @click="declined">
已拒绝
</view>
<view class="contentgn">
@ -114,6 +114,116 @@
<view class="bg-content-c">
利息比例: <span>0.05%</span>
</view>
<view class="entrust_bga_btn">
<view class="cancellation">
拒绝
</view>
<view class="determine">
接受
</view>
</view>
</view>
</view>
</view>
</view>
</uni-popup>
<uni-popup ref="bindmobile1" type="center" @click="close">
<view class="" style="position: relative;">
<view class="entrust">
<view class="entrust_close" @click="close">
<image src="@/static/images/wt_close.png" mode=""></image>
</view>
<view class="entrust_bga">
<view class="entrust_bg-content">
<view class="bg-content-a">
确定结束委托?
</view>
<view class="entrust_bga_btn">
<view class="cancellation">
取消
</view>
<view class="determine">
确定
</view>
</view>
</view>
</view>
</view>
</view>
</uni-popup>
<uni-popup ref="bindmobile2" type="center" @click="close">
<view class="" style="position: relative;">
<view class="entrust">
<view class="entrust_close" @click="close">
<image src="@/static/images/wt_close.png" mode=""></image>
</view>
<view class="entrust_bg">
<view class="entrust_bg-content">
<view class="bg-content-a" style="margin-left: 207rpx;">
结束委托申请处理
</view>
<view class="bg-content-b">
结算周期: <span>30</span>
</view>
<view class="bg-content-c">
利息比例: <span>0.05%</span>
</view>
<view class="entrust_bga_btn">
<view class="cancellation">
拒绝
</view>
<view class="determine">
接受
</view>
</view>
</view>
</view>
</view>
</view>
</uni-popup>
<uni-popup ref="bindmobile3" type="center" @click="close">
<view class="" style="position: relative;">
<view class="entrust">
<view class="entrust_close" @click="close">
<image src="@/static/images/wt_close.png" mode=""></image>
</view>
<view class="entrust_bgb">
<view class="entrust_bg-content">
<view class="bg-content-a" style="margin-left: 207rpx;">
结束委托申请处理
</view>
<view class="bg-content-b">
结算周期: <span>30</span>
</view>
<view class="bg-content-c">
利息比例: <span>0.05%</span>
</view>
<view class="bg-content-c">
拒绝原因
<view class="" style="margin-top: 21rpx;">
<textarea value="" placeholder="输入拒绝原因" class="bg-content_textarea" />
</view>
</view>
<view class="entrust_bga_btn">
<view class="determine">
接受
</view>
</view>
</view>
</view>
</view>
@ -190,13 +300,13 @@
},
mounted() {
this.$refs.bindmobile.open()
},
methods: {
nav(item){
uni.navigateTo({
url:'/pages/commissionedSales/delegation_details/index'
})
nav(item) {
uni.navigateTo({
url: '/pages/commissionedSales/delegation_details/index'
})
},
tabClick(e) { //
this.activeItem = e.name; //class
@ -206,27 +316,30 @@
close() {
console.log('1111111')
this.$refs.bindmobile.close()
this.$refs.bindmobile1.close()
this.$refs.bindmobile2.close()
this.$refs.bindmobile3.close()
},
//
//
soldEdit() {
console.log('111111')
this.$refs.bindmobile.open()
},
//
pendingDeletion() {
//
accepted() {
this.$refs.bindmobile1.open()
},
//
editReviewe() {
//
closingorder() {
this.$refs.bindmobile3.open()
},
//
auditDelete() {
//
declined() {
this.$refs.bindmobile2.open()
},
//
@ -469,8 +582,6 @@
.entrust {
width: 694rpx;
height: 676rpx;
.entrust_close {
width: 44rpx;
@ -480,6 +591,7 @@
width: 100%;
height: 100%;
}
z-index: 99999;
position: absolute;
right: 0;
@ -494,7 +606,6 @@
.entrust_bg-content {
position: absolute;
top: 284rpx;
.bg-content-a {
@ -540,6 +651,174 @@
}
}
.entrust_bga_btn {
display: flex;
margin-top: 53rpx;
.cancellation {
height: 95rpx;
line-height: 95rpx;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 400;
color: #999999;
margin-left: 121rpx;
margin-right: 49rpx;
}
.determine {
width: 249rpx;
height: 95rpx;
line-height: 95rpx;
text-align: center;
font-size: 32rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #FFFFFF;
background: linear-gradient(180deg, #F98649 0%, #F34E45 100%);
border-radius: 47rpx 47rpx 47rpx 47rpx;
}
}
}
.entrust_bga {
width: 694rpx;
height: 520rpx;
background: url('@/static/images/wtbg4.png') no-repeat;
background-size: 100% 100%;
position: relative;
.entrust_bg-content {
position: absolute;
top: 284rpx;
.bg-content-a {
margin-left: 242rpx;
font-size: 35rpx;
font-family: PingFang SC;
font-weight: 500;
color: #333333;
}
.entrust_bga_btn {
display: flex;
margin-top: 53rpx;
.cancellation {
height: 95rpx;
line-height: 95rpx;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 400;
color: #999999;
margin-left: 121rpx;
margin-right: 49rpx;
}
.determine {
width: 249rpx;
height: 95rpx;
line-height: 95rpx;
text-align: center;
font-size: 32rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #FFFFFF;
background: linear-gradient(180deg, #F98649 0%, #F34E45 100%);
border-radius: 47rpx 47rpx 47rpx 47rpx;
}
}
}
}
.entrust_bgb {
width: 694rpx;
height: 994rpx;
background: url('@/static/images/wtbg5.png') no-repeat;
background-size: 100% 100%;
position: relative;
.entrust_bg-content {
position: absolute;
top: 404rpx;
.bg-content-a {
margin-left: 242rpx;
font-size: 35rpx;
font-family: PingFang SC;
font-weight: 500;
color: #333333;
}
.bg-content-b {
margin-left: 35rpx;
font-size: 32rpx;
font-family: PingFang SC;
font-weight: 500;
color: #333333;
margin-top: 32rpx;
span {
font-size: 32rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #F84221;
margin-left: 18rpx;
}
}
.bg-content-c {
margin-left: 35rpx;
font-size: 35rpx;
font-family: PingFang SC;
font-weight: 500;
color: #333333;
margin-top: 22rpx;
span {
font-size: 32rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #F84221;
margin-left: 18rpx;
}
}
.bg-content_textarea {
width: 624rpx;
height: 152rpx;
padding: 25rpx 18rpx;
background: #F5F5F5;
}
}
.entrust_bga_btn {
display: flex;
margin-top: 33rpx;
.determine {
margin-left: 188rpx;
width: 249rpx;
height: 95rpx;
line-height: 95rpx;
text-align: center;
font-size: 32rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #FFFFFF;
background: linear-gradient(180deg, #F98649 0%, #F34E45 100%);
border-radius: 47rpx 47rpx 47rpx 47rpx;
}
}
}
}
</style>

View File

@ -3,7 +3,7 @@
<view class="content_top">
<!--选项卡滑动切换-->
<cxNavTitle :tabs="tabs" :activeItem="activeItem" @tabClick="tabClick"></cxNavTitle>
<cxNavTitle :tabs="tabs" :activeItem="activeItem" :show="false" @tabClick="tabClick"></cxNavTitle>
</view>
<!-- 审核通过 打折的拒绝同意功能 调货不需要功能 -->
<view class="content-content">
@ -187,10 +187,16 @@
],
}
},
onLoad() {
this.tabTitle = this.tabs[0].name
onLoad(num) {
this.tabTitle = this.tabs[0].name
if(num.key=='2'){
this.activeItem='tabThree'
}
// -- :
console.log(this.tabs[0])
// console.log(this.tabs[0])
},
methods: {
tabClick(e) { //

View File

@ -3,14 +3,14 @@
<view class="content_top">
<view class="content_top-one">
<view class="content_symbol">
<image src="@/static/images/f.png" mode="aspectFit"></image>
<image :src="listobj.mer_avatar" mode="aspectFit"></image>
</view>
<view class="content_title" v-if="listobj.author">
<view class="title_one">
{{listobj.author.nickname}}
{{listobj.mer_name}}
</view>
<view class="title_two">
100+人关注 100+销量
{{listobj.care_count>0?listobj.care_count:0}}人关注 {{listobj.sales>0?listobj.sales:0}}销量
</view>
</view>
<view class="content_titimg">
@ -30,7 +30,7 @@
<view class="">
<image :src="item" mode=""></image>
</view>
</view>
@ -70,10 +70,16 @@
<view class="content_enter-one">
类型
</view>
<view class="content_enter-two">
<view class="content_enter-two" v-if="listobj.is_type==3">
调货
</view>
<view class="content_enter-two" v-else>
打折
</view>
</view>
<view class="content_bootm" v-if="listobj.relevance.length>0">
<view class="content_bootm_txt">
查看TA提到的宝贝({{listobj.relevance.length}})

View File

@ -75,9 +75,8 @@
</view>
</view>
<view class="textarea">
<textarea placeholder='请输入商品描述' name="comment"
placeholder-class='placeholder' v-model="formData.content"
maxlength="600"></textarea>
<textarea placeholder='请输入商品描述' name="comment" placeholder-class='placeholder'
v-model="formData.content" maxlength="600"></textarea>
</view>
</view>
<view class="release_item">
@ -96,8 +95,10 @@
</view>
</view>
<view class='item acea-row row-between-wrapper'>
<view class='name' style="font-size: 28rpx;rfont-family: PingFang SC;font-weight: 400;color: #F84221;">价格{{price}}</view>
<view class="select">
<view class='name'
style="font-size: 28rpx;rfont-family: PingFang SC;font-weight: 400;color: #F84221;">
价格{{price}}</view>
<!-- <view class="select">
<view class="select_count" @click="addprice">
<text v-if="!isshow" class="text1">点击输入价格</text>
<view v-else >
@ -106,7 +107,7 @@
</view>
</view>
</view>
</view> -->
</view>
</view>
</view>
@ -136,13 +137,7 @@
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse">
</authorize>
<!-- <m-tabbar native>
<template v-slot:tabbar_index_2>
<view class="custom_style">
<view class="custom_style_icon"></view>
</view>
</template>
</m-tabbar> -->
</view>
</template>
@ -154,7 +149,7 @@
import authorize from '@/components/Authorize';
import avatar from "@/components/yq-avatar/yq-avatar.vue";
import associated from '@/components/shoppinglist/shoppinglist.vue';
import {
TOKENNAME,
HTTP_REQUEST_URL
@ -173,6 +168,9 @@
import {
configMap
} from '@/utils';
import {
getCommunitycreate
} from '@/api/trading-floor.js'
import store from '@/store';
export default {
components: {
@ -187,11 +185,13 @@
formData: {
image: [],
content: "",
topic_id: "",
spu_id: [],
video_link: ''
topic_id: 0,
category_id: 0,
video_link: '',
is_type: 3,
product_info: []
},
price:0,
price: 0,
imageSrc: '',
productList: [],
topicName: {},
@ -222,7 +222,9 @@
video_link: "",
showVideo: false,
videoplay: false,
videoContext: ''
videoContext: '',
};
},
computed: {
@ -251,8 +253,7 @@
onLoad(options) {
// uni.hideTabBar()
this.id = options.id;
this.order_id = options.order_id;
// console.log("options.order_id", options.order_id)
this.tabActive = options.type || 1;
if (this.community_app_switch.length == 1) {
this.tabActive = this.community_app_switch[0]
@ -261,16 +262,8 @@
this.isAuto = true;
this.isShowAuth = true
} else {
if (this.id) {
this.getDetail()
} else {
// const data = getStorage('addPlant');
// if(data){
// this.formData.content = data.content || '';
// this.formData.image = data.image || [];
// }
}
if (this.order_id) this.getOrderGoods()
}
this.videoContext = uni.createVideoContext("myvideo", this);
},
@ -279,7 +272,8 @@
this.formData.content = ''
this.formData.image = []
this.formData.topic_id = ''
this.formData.spu_id = ''
this.formData.video_link = ''
this.productList = []
this.topicName = {}
@ -293,31 +287,7 @@
authColse: function(e) {
this.isShowAuth = e;
},
/*获取图文详情*/
getDetail() {
let that = this
plantDetailApi(that.id).then(res => {
that.formData = res.data
that.productList = res.data.relevance || []
that.topicName = res.data.topic || {}
}).catch(err => {
return that.$util.Tips({
title: err
});
})
},
/*获取关联订单商品*/
getOrderGoods() {
let that = this
orderAssociatePlantApi(that.order_id).then(res => {
that.productList = res.data || []
that.formData.spu_id = res.data.map(val => val.spu_id)
}).catch(err => {
return that.$util.Tips({
title: err
});
})
},
/*点击输入价格*/
addprice() {
this.isshow = true
@ -485,7 +455,7 @@
close() {
this.$refs.associated.close();
},
/*查看视频*/
videoshow() {
@ -508,8 +478,23 @@
},
/*获取选中的宝贝*/
getProduct(data) {
this.productList = data;
this.formData.spu_id = data.map(val => val.spu_id)
if (data.length > 0) {
this.productList = data;
for (let i in data) {
this.price = Number(this.price) + (Number(data[i].num) * Number(data[i].price))
this.formData.product_info.push({
product_attr_unique: data[i].product_attr_unique,
number: Number(data[i].num),
price: data[i].price
})
}
} else {
this.price = 0
}
this.$refs.associated.close();
},
@ -517,128 +502,62 @@
* 提交数据
*/
formSubmit: function(e) {
console.log(this.id)
let that = this,
value = that.formData;
if (value.image.length == 0) return that.$util.Tips({
title: '请添加话题图片'
title: '请添加图文图片'
});
if (value.product_info.length == 0) return that.$util.Tips({
title: '请选择产品'
});
if (!value.content) return that.$util.Tips({
title: '请分享使用心得和体会'
title: '请添加商品描述'
});
if (that.tabActive == 2 && !value.video_link) {
return that.$util.Tips({
title: '请添加话题视频'
});
}
if (!value.category_id || !value.topic_id) {
return that.$util.Tips({
title: '请选择话题'
})
}
if (that.id) {
if (value.relevance.length) {
value.spu_id = value.relevance.map(val => (val.spu && val.spu.spu_id) || val.spu_id)
}
}
value.order_id = that.order_id
value.is_type = that.tabActive
uni.showLoading({
title: '保存中',
mask: true
})
that.id ? updatePlantApi(that.id, value).then(res => {
uni.hideLoading()
that.$util.Tips({
title: res.messge,
icon: 'success'
});
setTimeout(function() {
if (that.tabActive == 2) {
uni.navigateTo({
//#ifdef APP
url: '/pages/short_video/appSwiper/index?id=' + res.data
.community_id + '&user=1&uid=' +
that.uid
//#endif
//#ifndef APP
url: '/pages/short_video/nvueSwiper/index?id=' + res.data
.community_id + '&user=1&uid=' +
that.uid
//#endif
});
} else {
uni.navigateTo({
url: '/pages/plantGrass/plant_detail/index?id=' + res.data
.community_id + '&type=' + that
.tabActive
})
}
/**
* 将对象所有值为空
* */
/**
* 将对象所有值为空
* */
getCommunitycreate(value).then(res => {
if (res.status == '200') {
uni.hideLoading()
that.$util.Tips({
title: '发布成功',
icon: 'success'
});
that.formData = {
image: [],
content: "",
topic_id: "",
spu_id: [],
video_link: "",
}
that.topicName = {}
}, 1000);
}).catch(err => {
return that.$util.Tips({
title: err
});
}) : createPlantApi(value).then(res => {
uni.hideLoading()
that.$util.Tips({
title: res.messge,
icon: 'success'
});
setStorage('addPlant', '');
setTimeout(function() {
if (that.tabActive == 2) {
uni.navigateTo({
//#ifdef APP
url: '/pages/short_video/appSwiper/index?id=' + res.data
.community_id + '&user=1&uid=' +
that.uid
//#endif
//#ifndef APP
url: '/pages/short_video/nvueSwiper/index?id=' + res.data
.community_id + '&user=1&uid=' +
that.uid
//#endif
});
} else {
uni.navigateTo({
url: '/pages/plantGrass/plant_detail/index?id=' + res.data
.community_id + '&type=' + that
.tabActive
})
}
/**
* 将对象所有值为空
* */
that.formData = {
image: [],
content: "",
topic_id: "",
spu_id: [],
video_link: "",
topic_id: 0,
category_id: 0,
video_link: '',
is_type: 3,
product_info: []
}
uni.navigateTo({
url: '/pages/releaseManagement/index?key=' + 2
})
}, 1000);
} else {
that.$util.Tips({
title: res.messge,
icon: 'success'
});
}
}).catch(err => {
// console.log('aaa', value)
return that.$util.Tips({
title: err
});
})
}
}
}

View File

@ -21,7 +21,7 @@
<view class='nav acea-row row-around'>
<view class='item' :class='orderStatus==-1 ? "on": ""' @click="statusClick(-1)">
<view>全部</view>
<view class='num'>{{orderData.all || 0}}</view>
<view class='num'>{{orderData.orderCount || 0}}</view>
</view>
<view class='item' :class='orderStatus==0 ? "on": ""' @click="statusClick(0)">
<view>待付款</view>
@ -493,7 +493,7 @@
*/
getOrderData: function() {
let that = this;
orderData().then(res => {
orderData({product_type:0}).then(res => {
that.$set(that, 'orderData', res.data);
})
},

View File

@ -21,7 +21,7 @@
<view class='nav acea-row row-around'>
<view class='item' :class='orderStatus==-1 ? "on": ""' @click="statusClick(-1)">
<view>全部</view>
<view class='num'>{{orderData.all || 0}}</view>
<view class='num'>{{orderData.orderCount || 0}}</view>
</view>
<view class='item' :class='orderStatus==0 ? "on": ""' @click="statusClick(0)">
<view>待付款</view>
@ -493,8 +493,10 @@
*/
getOrderData: function() {
let that = this;
orderData().then(res => {
console.log(res.data)
orderData({
product_type:98
}).then(res => {
// console.log(res.data)
that.$set(that, 'orderData', res.data);
})
},

View File

@ -17,8 +17,10 @@
</view>
<view class="recom">
<view class="recom_bnt">
<rudon-rowMenuDotDotDot :localdata="options" @change="menuAction($event)">
{{this.recomname}}
<rudon-rowMenuDotDotDot :localdata="options" @change="menuAction($event)" style="color: #000000;">
<view class="" style="color: #F84221;">
{{this.recomname}}
</view>
<view class="recom_sym">
<image src='@/static/images/arrow-bottom.png' mode="aspectFit"></image>
</view>
@ -41,16 +43,16 @@
<view class="item_text">
<span v-if='item.is_type==3'>调货</span>
<span v-else>委托销售</span>
{{item.name}}
{{item.title}}
</view>
<view class="item_prices">
<span></span>{{item.total_price}}
</view>
<view class="item_name">
<image class="avater" :src="item.author.avatar" mode="aspectFit"></image>
<image class="avater" :src="item.mer_avatar" mode="aspectFit"></image>
<view class="item_name_text">
{{item.author.nickname}}
{{item.mer_name}}
</view>
</view>
</view>
@ -164,7 +166,7 @@
},
getlist(index) {
console.log(this.num)
if (this.num == 0) {
this.where = {
page: 1,
@ -222,8 +224,10 @@
this.visible = false
},
menuAction(action, rowId) {
console.log(action);
// console.log(action);
//
this.num=action
this.getlist(action)
if (action === '') {
this.recomname = this.options[0].text
} else {
@ -305,7 +309,7 @@
font-size: 32rpx;
font-family: 'PingFang SC';
font-weight: 400;
color: #F84221;
.recom_sym {
width: 28rpx;
@ -361,10 +365,11 @@
}
.list {
width: 100%;
width: 694.74rpx;
margin: 0 auto;
display: flex;
justify-content: flex-start;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
@ -374,7 +379,7 @@
height: 561rpx;
background-color: #fff;
margin-top: 21rpx;
margin-left: 25rpx;
border-radius: 14rpx 14rpx 0 0;
.shopimg {
@ -403,6 +408,7 @@
font-weight: 400;
color: #FFFFFF;
font-size: 25rpx;
margin-right: 15rpx;
}
}

269
plugin/voice/voice.js Normal file
View File

@ -0,0 +1,269 @@
/**
* Notes: APP语音播报
* @author WJD
* @version 1.0.0
* @Date 2022-01-26
*/
// import store from '../store'
// 是否播放中
let isPlaying = false;
// 播放列表
let currentAudio = ['/static/audio/order.mp3'];
// 播放顺序
let playIndex = 0
// 播放器
let audioPlayer = null;
// 平台
let platform = 'iOS';
// 定时器
let timer = null;
// socket地址
const socketUrl = "wss://gateworker.yngod.cn:8686";
const voice = {
// 创建播放器
init: () => {
// platform = plus.os.name;
// if (platform == 'Android') {
// let MediaPlayer = plus.android.importClass("android.media.MediaPlayer");
// audioPlayer = new MediaPlayer()
// }
// if (platform == "iOS") {
// let AVAudioPlayer = plus.ios.importClass("AVAudioPlayer");
// audioPlayer = new AVAudioPlayer();
// }
console.log('创建播放器成功');
// voice.playAudio();
},
// 连接socket
connectSocketGlobal: () => {
uni.connectSocket({
url: socketUrl,
success: (res) => {
console.log('连接成功');
}
})
uni.onSocketOpen((success) => {
console.log('WebSocket连接已打开');
let storeIds = store.state.storeIds;
if (storeIds.length > 0) {
storeIds.forEach(sid => {
uni.sendSocketMessage({
data: sid.toString(),
success: (s) => {
console.log('成功');
}
});
})
}
store.commit('setData', {
key: 'socketIsOpen',
val: true
});
})
uni.onSocketError(function(error) {
console.log('WebSocket连接打开失败请检查');
});
uni.onSocketMessage((res) => {
console.log('接收播报数据', res)
//按接收的内容播放信息
try {
if (typeof res == 'string') {
res = JSON.parse(res);
}
if (typeof res.data == 'string') {
res.data = JSON.parse(res.data);
}
if(res.data?.Hearbeat) {
uni.sendSocketMessage({
data: "hearbeat",
success: (s) => {
console.log('成功');
}
});
return ;
}
if (res.data.needPlay) {
try {
// var parseStr = voice.parseAudioData(res.data);
} catch (e) {
// console.log('解析出错', e)
}
// console.log('解析数据', parseStr)
// voice.addAudioQueue(parseStr);
}
} catch (e) {}
})
},
//解析服务器数据
parseAudioData: function(serverData) {
let audio = [];
//头部
//处理中间数字
serverData.data = parseFloat(serverData.data).toString();
//如果当前数字中没有小数点,则用.00补足
if (serverData.data.indexOf('.') == -1) serverData.data += '.00';
let dot = serverData.data.indexOf('.');
let l = serverData.data.length;
for (let n = 0; n < l; n++) {
//如果上一位是0则不加入
if (audio[audio.length - 1] != 0 || serverData.data.substr(n, 1) != '0') {
audio.push(serverData.data.substr(n, 1));
//根据当前数字的位置与dot的位置决定后缀并且当前不是小数点
if (serverData.data.substr(n, 1) != '.' && serverData.data.substr(n, 1) != '0') {
if (dot - n == 2) {
audio.push('ten');
} else if (dot - n == 3) {
audio.push('hundred');
} else if (dot - n == 4) {
audio.push('thousand');
} else if (dot - n == 5) {
audio.push('ten_thousand');
}
}
}
}
//如果出现1shi则去掉1
let _audio = audio.join('&');
if (audio[0] == 1) {
_audio = _audio.replace('1&shi', 'shi'); //应对一十元问题
}
if (audio[0] != 0) {
_audio = _audio.replace('0&.', '.'); //应对一十点问题
}
if (_audio.indexOf('.&0') == _audio.length - 2 - 1) { //应对末尾是.0
_audio = _audio.substr(0, _audio.length - 2 - 2);
}
//加入前缀
if (_audio) {
_audio = 'header_' + serverData.header.toString() + '&' + _audio;
} else {
_audio = 'header_' + serverData.header.toString();
}
audio = _audio.split("&");
//如果有金额
if (l) {
audio.push('yuan');
}
//底部
if (serverData.footer) {
audio.push('footer');
}
let result = [];
audio.map(item => {
if (item != '.')
result.push(`/static/audio/tts_${item}.mp3`);
else
result.push(`/static/audio/tts_dot.mp3`);
})
return result;
},
// 随机数
getRandomKey: () => {
var max = 99999;
var min = 1;
return (Date.parse(new Date()) + '' + parseInt(Math.random() * (max - min + 1) + min, 10)).toString();
},
// 语言播报语音数据 加入到队列里面
addAudioQueue: (parseStr) => {
let audioList = store.state.audioList;
audioList[voice.getRandomKey()] = parseStr;
store.commit('setData', {
key: 'audioList',
val: audioList
});
},
// 重置播放列表
resetPlayList: () => {
playIndex = 0;
currentAudio = ['/static/audio/order.mp3'];
},
clearTimer: () => {
if (timer) {
clearInterval(timer);
timer = null;
}
},
// 播放音频
playAudio: () => {
if (isPlaying) {
console.log('播放中,请等待...')
return false;
}
if (audioPlayer == null) {
console.log('未启动音频播放器');
return false;
}
let audioList = currentAudio;
if (currentAudio.length == 0) {
const keys = Object.keys(audioList)
if (keys.length) {
currentAudio = Object.values(audioList)[0]
delete audioList[keys[0]]
playIndex = 0
// store.commit('setData', {
// key: 'audioList',
// val: audioList
// });
} else {
voice.resetPlayList();
}
}
console.log('正在播报:', currentAudio[playIndex]);
let path = plus.io.convertLocalFileSystemURL(currentAudio[playIndex]);
let currentTime = 0; // 当前流媒体的播放的位置,单位是秒
let currentDuration = 0; // 当前文件时长
if (platform == 'iOS') {
let NSData = plus.ios.importClass("NSData");
let AVAudioPlayer = plus.ios.importClass("AVAudioPlayer");
let pathFileData = NSData.dataWithContentsOfFile(path);
audioPlayer.initWithDataerror(pathFileData, null);
// audioPlayer.setNumberOfLoops(-1); //-1无限循环
audioPlayer.prepareToPlay(); //初始化播放器
audioPlayer.play();
isPlaying = audioPlayer.isPlaying();
// 当前播放进度 currentTime 秒
} else {
let MediaPlayer = plus.android.importClass("android.media.MediaPlayer");
audioPlayer.setDataSource(path); //指定音频文件路径
// audioPlayer.setLooping(true); //设置为循环播放
audioPlayer.prepare(); //初始化播放器MediaPlayer
audioPlayer.start();
isPlaying = audioPlayer.isPlaying();
// 获取音乐的总时长
// console.log(audioPlayer.getDuration());
// 当前播放进度 getCurrentPosition 毫秒
}
timer = setInterval(function() {
currentTime = platform == 'iOS' ? audioPlayer.currentTime() : audioPlayer
.getCurrentPosition() / 1000;
currentDuration = platform == 'iOS' ? audioPlayer.duration() : audioPlayer
.getDuration() / 1000;
if (currentTime == currentDuration || currentTime == 0) {
isPlaying = false;
voice.clearTimer();
if (playIndex < currentAudio.length - 1) {
playIndex++
} else {
currentAudio = [];
playIndex = 0;
}
if (Object.keys(audioList).length == 0 && currentAudio.length == 0) {
voice.resetPlayList();
}
voice.playAudio();
}
}, 200);
}
}
export default voice

BIN
static/audio/order.mp3 Normal file

Binary file not shown.