交易大厅接口对接及界面优化

This commit is contained in:
jia 2023-08-16 17:59:23 +08:00
parent 4ad08f699d
commit 5885261a60
14 changed files with 735 additions and 513 deletions

16
App.vue
View File

@ -22,6 +22,7 @@ import {
history
} from '@/api/public.js'
import Routine from './libs/routine.js';
import voice from'./plugin/voice/voice.js'
export default {
globalData: {
spid: 0,
@ -119,8 +120,7 @@ import {
// #endif
that.getConfigData()
//#ifdef APP-PLUS
//#ifdef APP-PLUS
jpushModule.setLoggerEnable(true);
jpushModule.initJPushService()
jpushModule.addConnectEventListener(result=>{
@ -152,6 +152,14 @@ import {
let extras = result.extras
console.log("通知", result)
// if(result.content==""){
// console.log("", '11111111')
// voice.init()
// }
if(result.extras.type=='ORDER_CREATE'){
voice.init()
}
//
if (notificationEventType == 'notificationOpened') {
uni.navigateTo({
@ -173,6 +181,10 @@ import {
},
onShow() {
// console.log(voice.in)
// voice.connectSocketGlobal()
let that = this
// H5
if (this.$store.state.app.token) {

View File

@ -24,7 +24,7 @@ export function getCommunityList(data) {
*/
export function getCommunityshow(data) {
return request.get('community/show/'+data,{}, {
return request.get('community/show/' + data, {}, {
noAuth: true
});
}
@ -43,23 +43,35 @@ export function getCommunitygetOrderList(data) {
* 发起转售
*
*/
export function getCommunitycreate( data) {
return request.post(`community/create`, data, { login: true });
export function getCommunitycreate(data) {
return request.post(`community/create`, data, {
login: true
});
}
/**
* 修改转售
*
*/
export function getCommunityUpdate( data) {
return request.post(`community/update`, data, { login: true });
export function getCommunityUpdate(data) {
return request.post(`community/update`, data, {
login: true
});
}
/**
* 加入购物车
*
*/
export function getCommunityaddCart(data) {
return request.get('community/addCart', data, {
return request.post('community/addCart', data, {
noAuth: true
});
}
//商品宝贝详情
export function getProductDetail(id) {
return request.get('store/product/detail/' + id, {
noAuth: true
});
}

View File

@ -158,7 +158,7 @@
}
.title {
margin-top: 21rpx;
margin-top: 23rpx;
}
.title1 {
@ -173,7 +173,7 @@
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
margin-top: 9rpx;
margin-top: 11rpx;
}
}

View File

@ -13,7 +13,7 @@
</view>
</view>
<view class="main">
<scroll-view scroll-y="true">
<scroll-view scroll-y="true" @touchmove.stop>
<block>
<view v-if="bought.length" @touchmove="onTouchmove" id="goods" class="goods">
<view class="picTxt acea-row" v-for="(item, i) in bought" :key="i">
@ -33,10 +33,12 @@
<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'">
<picker class="slecte" v-if="item.attrValue.length>1"
@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.attrValue[index].stock}}
</view>
@ -53,17 +55,19 @@
<view class="price">
<span>出售价格</span>
<input type="text" :value="item.price" placeholder="输入出售价格"
@input="producrprice($event,i)" adjust-position=""
placeholder-style="color: #CCCCCC;" />
</view>
<view class="price_num">
<span>出售数量</span>
<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>
<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>
@ -164,22 +168,33 @@
this.getBounht();
},
methods: {
//
producrprice(e, i) {
this.bought[i].price = e.detail.value
},
// picker
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
bindPickerChange: function(e, storage, num) {
this.bought[num].attrValue[this.index].sku = storage[e.detail.value].sku
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] //
if (this.bought[num].attrValue[this.index].stock == 0) {
this.$util.Tips({
title: '库存不足'
});
}
},
//
close() {
this.$emit('close');
},
numberChange(data,i) {
numberChange(data, i) {
this.peicenumber = data.number;
this.bought[i].num=data.number
this.bought[i].num = data.number
},
tabs(index) {
this.isActive = index
@ -207,7 +222,7 @@
},
searchBut() {
this.whereb.page = this.wherec.page = this.wheres.page =
this.bought = []
this.bought = []
this.isActive == 0 ? this.getBounht() : ''
},
getBounht() {
@ -241,13 +256,11 @@
if (item.product_id == val.product_id) {
that.$set(item, 'check', true);
that.$set(item, 'num', val.num);
}else{
that.$set(item, 'num', 0);
that.$set(item, 'price', val.price);
}
})
})
},
/*已选中的商品打钩*/
getCheckedGoods() {
@ -258,19 +271,18 @@
},
/*点击选中与否*/
goodsCheck(item) {
this.$set(item, 'check', !item.check);
this.$set(item, 'check', !item.check);
console.log( item.num)
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
if (this.peicenumber > 0) {
item.num = this.peicenumber
}
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 == (
@ -280,9 +292,8 @@
},
/*确定提交*/
submit() {
this.$emit('getProduct', this.checkedArr);
},
}
}
@ -331,6 +342,7 @@
.iconclose {
width: 44rpx;
height: 44rpx;
line-height: 44rpx;
border: 2rpx solid #fff;
border-radius: 50%;
text-align: center;
@ -393,27 +405,29 @@
position: relative;
align-items: center;
justify-content: space-between;
margin-bottom: 10rpx;
border-top: 2rpx solid #E7E6E4;
.picTxt_one {
display: flex;
margin-top: 20rpx;
.slecte {
margin-right: 30rpx;
width: 140rpx;
width: 280rpx;
height: 60rpx;
line-height: 50rpx;
line-height: 60rpx;
text-align: center;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #CCCCCC;
color: #959595;
background-color: #E7E6E4;
border-radius: 10rpx 10rpx 10rpx 10rpx;
white-space: nowrap;
overflow: hidden;
border: 1px solid #CCCCCC;
}
}

View File

@ -53,9 +53,9 @@
</view>
</view>
</view>
</view>
<view class="content_center-one">
<view class="content_center-one">
<view class="center-one">
<view class="center-one-img">
<image src="../../annex/static/left.png" mode=""></image>
@ -74,7 +74,7 @@
</view>
</view>
</view>
</view>
</view>
<button class="release_btn button" form-type="submit">发布</button>
@ -154,7 +154,8 @@
padding: 0 28rpx;
margin-top: 28rpx;
.content_center-one {
.content_center-one {
display: flex;
padding: 0 28rpx;
@ -200,6 +201,7 @@
}
}
.release_item {
background: #ffffff;
padding: 0 30rpx;
@ -389,7 +391,6 @@
font-weight: 500;
color: #FFFFFF;
}
.release_btn {
margin-top: 100rpx;
}

View File

@ -127,12 +127,12 @@
</image>
<text class="text">交易大厅</text>
</view>
<view class="examine" @click="navigator(`/pages/commissionedSales/index/index`)">
<view class="examine" @click="navigator(`/pages/commissionedSales/index/index?mer_id=${mer_id}`)">
<image class="icon_img" src="@/static/images/weituo.png" mode="aspectFill">
</image>
<text class="text">委托销售</text>
</view>
<view class="examine" @click="navigator(`/pages/releaseManagement/index`)">
<view class="examine" @click="navigator(`/pages/releaseManagement/index?mer_id=${mer_id}`)">
<image class="icon_img" src="@/static/images/fabu.png" mode="aspectFill">
</image>
<text class="text">发布管理</text>
@ -313,10 +313,11 @@
this.isShow = true
this.mer_id = res.data.service.mer_id
}
if (!res.data.mer_info) {
that.$set(this, 'jurisdiction', false);
}
console.log(that.userInfoData);
// console.log(that.userInfoData);
});
}
}

View File

@ -188,13 +188,13 @@
}
},
onLoad(num) {
this.tabTitle = this.tabs[0].name
if(num.key=='2'){
this.activeItem='tabThree'
this.tabTitle = this.tabs[0].name
if (num.key == '2') {
this.activeItem = 'tabThree'
}
// -- :
// console.log(this.tabs[0])
},

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,18 +95,60 @@
</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 >
<view v-else >
<input type="number" value="" v-model="price" placeholder="请输入价格"
style="text-align: right;font-size: 28rpx;" />
</view>
</view>
</view>
</view> -->
</view>
<view class="popup_group">
<view class="radio" v-if="this.formData.product_info.length>0">
<view class="radio_label ">送货方式</view>
<checkbox-group class="select_group flex_start" @change="deliveryWayChange">
<label class="radio_select" v-for="(val, i) in deliveryFreeList"
:key="val.value">
<view>
<checkbox :value="val.value"
:checked="delivery_way.includes(val.value)" />
</view>
<view>{{ val.name }}</view>
</label>
</checkbox-group>
</view>
<!-- <view class="popup_group_item" v-if="delivery_way.includes('2')">
<view class="popup_group_item_label">是否包邮</view>
<view class="popup_group_item_value">
<view class="popup_group_item_message">
<switch :checked="delivery_free == '1'" color="#E93323"
style="transform:scale(0.8)" @change="deliveryFreeChange" />
</view>
</view>
</view> -->
<!-- <view class="popup_group_item" v-if="delivery_way.includes('2') && delivery_free == 0"
@click="tempIdSelect">
<view class="popup_group_item_label">运费模板</view>
<view class="popup_group_item_value">
<view class="popup_group_item_message">
<span v-if="setFormData.tempName"
class="popup_group_item_message_value">{{ setFormData.tempName }}</span>
<span v-else>请选择运费模板</span>
</view>
<view><span class="iconfont">&#xe6bd;</span></view>
</view>
</view> -->
</view>
</view>
</view>
<button class="release_btn button" form-type="submit">发布</button>
@ -136,29 +177,20 @@
<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>
<script>
import mTabbar from '@/components/m-tabbar/m-tabbar.vue'
import {
mapGetters
} from "vuex";
import {
getCommunitygetOrderList
} from '@/api/trading-floor.js'
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
@ -177,26 +209,47 @@
import {
configMap
} from '@/utils';
import {
getCommunitycreate,
} from '@/api/trading-floor.js'
import {
getUserInfo
} from '@/api/user.js'
import store from '@/store';
export default {
components: {
avatar,
associated,
authorize,
easyLoadimage,
mTabbar
mTabbar,
},
data() {
return {
formData: {
image: [],
content: "",
topic_id: "",
spu_id: [],
video_link: ''
topic_id: 0,
category_id: 0,
video_link: '',
is_type: 3,
resale_type:2,
product_info: []
},
price:0,
price: 0,
deliveryFreeList: [{
value: '1',
name: '到店核销'
},
{
value: '2',
name: '快递配送'
}
],
imageSrc: '',
productList: [],
topicName: {},
@ -227,7 +280,16 @@
video_link: "",
showVideo: false,
videoplay: false,
videoContext: ''
videoContext: '',
delivery_free: 1,
templateListPage: {
page: 1,
limit: 10000
},
merId: '',
delivery_way: [], // 1 2
};
},
computed: {
@ -252,13 +314,12 @@
// #ifndef APP-PLUS
this.videoContext = uni.createVideoContext('myVideo', this);
// #endif
this.getUserInfo()
},
onLoad(options) {
this.list()
// 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]
@ -267,16 +328,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);
},
@ -285,18 +338,50 @@
this.formData.content = ''
this.formData.image = []
this.formData.topic_id = ''
this.formData.spu_id = ''
this.formData.video_link = ''
this.productList = []
this.topicName = {}
},
methods: {
list(){
getCommunitygetOrderList().then(res=>{
console.log(res.data)
getUserInfo: function() {
let that = this;
getUserInfo().then(res => {
this.merId = res.data.service.mer_id
})
},
//
deliveryFreeChange(val) {
if (val.detail.value) {
this.delivery_free = '1';
} else {
this.delivery_free = '0';
}
},
//
deliveryWayChange(obj) {
this.delivery_way = obj.detail.value;
if(this.formData.product_info.length>0){
for(let i in this.formData.product_info){
this.formData.product_info[i].deliver_method = obj.detail.value.toString();
}
}else{
this.$util.Tips({
title: '请选择产品,再选择送货方式'
});
}
},
onLoadFun() {
this.isShowAuth = false;
},
@ -304,31 +389,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
@ -491,12 +552,13 @@
},
/*添加宝贝*/
addProduct() {
this.$refs.associated.open();
},
close() {
this.$refs.associated.close();
},
/*查看视频*/
videoshow() {
@ -519,8 +581,25 @@
},
/*获取选中的宝贝*/
getProduct(data) {
this.productList = data;
this.formData.spu_id = data.map(val => val.spu_id)
this.productList=[]
this.price = 0
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();
},
@ -528,128 +607,64 @@
* 提交数据
*/
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
});
})
}
}
}
@ -986,4 +1001,99 @@
height: 500rpx;
}
}
.popup_group {
background: #fff;
margin: 31rpx auto;
width: 710rpx;
font-size: 30rpx;
border-radius: 10rpx;
.popup_group_item {
padding: 32rpx 30rpx;
display: flex;
align-items: center;
justify-content: space-between;
.popup_group_item_value {
display: flex;
align-items: center;
.popup_group_item_message {
margin-right: 15rpx;
color: #bbbbbb;
max-width: 400rpx;
&_value {
display: inline-block;
max-width: 400rpx;
color: #000;
}
}
.iconfont {
color: #bbbbbb;
}
input {
text-align: right;
}
}
}
>view:not(:last-child) {
border-bottom: 1px solid #eeeeee;
}
}
.radio {
padding: 30rpx;
&_label {
padding-left: 10rpx;
color: #333333;
font-size: 30rpx;
display: flex;
align-items: center;
.select_check {
display: flex;
align-items: center;
justify-content: center;
width: 40rpx;
height: 40rpx;
border: 1px solid #cccccc;
border-radius: 50%;
margin-right: 20rpx;
.iconfont {
font-size: 24rpx;
}
}
.select {
background: #e93323;
border: none;
.iconfont {
color: #fff;
}
}
}
.select_group {
display: flex;
}
.flex_start {
padding: 0 10rpx;
margin-top: 40rpx;
justify-content: flex-start;
}
&_select {
display: flex;
margin-right: 110rpx;
}
}
</style>

View File

@ -8,6 +8,7 @@
<view class="content_title" v-if="listobj.author">
<view class="title_one">
{{listobj.mer_name}}
</view>
<view class="title_two">
{{listobj.care_count>0?listobj.care_count:0}}人关注 {{listobj.sales>0?listobj.sales:0}}销量
@ -20,10 +21,11 @@
<view view class="content_top-two">
<view class="price">
{{listobj.total_price}}
<!-- <input type="text" :value="listobj.total_price" v-model="listobj.total_price" /> -->
</view>
<view class="top-two_content">
{{listobj.content}}
<textarea :value="listobj.content" placeholder="" style="height: auto;" />
</view>
<view class="top-two_img" v-for="(item,index) in listobj.image">
@ -42,20 +44,20 @@
<view class="content_middle">
<view class="middle-one" v-for="(item,b) in listobj.resale" :key='b'>
<view class="midding-img">
<image :src="item.spu.image" mode=""></image>
<image :src="item.image" mode=""></image>
</view>
<view class="middle-one_text">
<view class="one_text_a">
{{item.spu.store_name}}
{{item.store_name}}
</view>
<view class="one_text_b">
{{item.price}}
</view>
<view class="one_text_c">
<view class="">
采购价:{{item.spu.price}}
</view>
<!-- <view class="">
采购价:{{item.price}}
</view> -->
<view class="">
数量: {{item.number}}
</view>
@ -76,38 +78,31 @@
<view class="content_enter-two" v-else>
打折
</view>
</view>
<view class="content_bootm" v-if="listobj.relevance.length>0">
<view class="content_bootm" v-if='listobj.resale'>
<view class="content_bootm_txt">
查看TA提到的宝贝({{listobj.relevance.length}})
查看TA提到的宝贝({{listobj.resale.length}})
</view>
<view class="content_bootm_one" v-for="(items,i) in listobj.relevance" :key='i'>
<view class="content_bootm_one" v-for="(items,i) in listobj.resale" :key='i' @click="Merchbaby(items)">
<view class="bootm_oneimg">
<image :src="items.spu.image" mode=""></image>
<image :src="items.image" mode=""></image>
</view>
<view class="">
{{items.spu.store_name}}
<view class="" style="margin-top: 15rpx;">
{{items.store_name}}
</view>
</view>
<!-- <view class="content_bootm_one">
<view class="bootm_oneimg">
<image src="@/static/images/bg2.png" mode=""></image>
</view>
<view class="">
良品铺子肉松饼1000g/ 面包糕...
</view>
</view> -->
</view>
<view class="pay" v-if="this.detail.type==1">
<view class="pay" v-if="this.detail.type==1||this.detail.type==2">
<view class="pay_tilte-a">
合计: <span>{{listobj.total_price}}</span>
</view>
<view class="pay_tilte-b">提交订单</view>
<view class="pay_tilte-b" @click="prouctOrder">提交订单</view>
</view>
<view class="domain" v-else>
@ -124,7 +119,8 @@
<script>
import {
getCommunityshow
getCommunityshow,
getCommunityaddCart
} from '@/api/trading-floor.js'
export default {
@ -132,7 +128,7 @@
data() {
return {
detail: {},
listobj: {}
listobj: {},
}
},
onLoad(e) {
@ -144,17 +140,35 @@
},
methods: {
//
shopdetil(id) {
getCommunityshow(id).then(res => {
if (res.data.status = 200) {
console.log(res.data)
this.listobj = res.data
}
})
}
},
},
//
Merchbaby(item) {
uni.navigateTo({
url: `/pages/goods_details/index?id=${item.product_id}`
})
},
prouctOrder() {
getCommunityaddCart(this.listobj).then(res => {
if (res.status == 200) {
uni.navigateTo({
url: '/pages/users/order_confirm/index?cartId=' + res.data.cart_id.toString()
})
}
}).catch((err) => {
console.log(err)
})
}
}
}
</script>
@ -200,7 +214,7 @@
}
.content_titimg {
width: 136rpx;
width: 116rpx;
height: 64rpx;
margin-top: -10rpx;
margin-left: 10rpx;
@ -214,11 +228,19 @@
.content_top-two {
.price {
display: flex;
margin-top: 21rpx;
font-size: 46rpx;
font-family: PingFang SC;
font-weight: 500;
color: #F84221
color: #F84221;
input {
font-size: 46rpx;
font-family: PingFang SC;
font-weight: 500;
color: #F84221
}
}
.top-two_content {
@ -332,11 +354,12 @@
.content_bootm_txt {
margin-top: 42rpx;
padding-left: 28rpx;
}
.content_bootm_one {
height: 112rpx;
line-height: 112rpx;
padding-right: 28rpx;
background: #FFFFFF;
display: flex;
margin-top: 21rpx;

View File

@ -97,7 +97,7 @@
<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>
价格{{price.toFixed(2)}}</view>
<!-- <view class="select">
<view class="select_count" @click="addprice">
<text v-if="!isshow" class="text1">点击输入价格</text>
@ -109,6 +109,46 @@
</view>
</view> -->
</view>
<view class="popup_group">
<view class="radio" v-if="this.formData.product_info.length>0">
<view class="radio_label ">送货方式</view>
<checkbox-group class="select_group flex_start" @change="deliveryWayChange">
<label class="radio_select" v-for="(val, i) in deliveryFreeList"
:key="val.value">
<view>
<checkbox :value="val.value"
:checked="delivery_way.includes(val.value)" />
</view>
<view>{{ val.name }}</view>
</label>
</checkbox-group>
</view>
<!-- <view class="popup_group_item" v-if="delivery_way.includes('2')">
<view class="popup_group_item_label">是否包邮</view>
<view class="popup_group_item_value">
<view class="popup_group_item_message">
<switch :checked="delivery_free == '1'" color="#E93323"
style="transform:scale(0.8)" @change="deliveryFreeChange" />
</view>
</view>
</view> -->
<!-- <view class="popup_group_item" v-if="delivery_way.includes('2') && delivery_free == 0"
@click="tempIdSelect">
<view class="popup_group_item_label">运费模板</view>
<view class="popup_group_item_value">
<view class="popup_group_item_message">
<span v-if="setFormData.tempName"
class="popup_group_item_message_value">{{ setFormData.tempName }}</span>
<span v-else>请选择运费模板</span>
</view>
<view><span class="iconfont">&#xe6bd;</span></view>
</view>
</view> -->
</view>
</view>
</view>
<button class="release_btn button" form-type="submit">发布</button>
@ -143,6 +183,7 @@
<script>
import mTabbar from '@/components/m-tabbar/m-tabbar.vue'
import {
mapGetters
} from "vuex";
@ -169,8 +210,14 @@
configMap
} from '@/utils';
import {
getCommunitycreate
getCommunitycreate,
} from '@/api/trading-floor.js'
import {
getUserInfo
} from '@/api/user.js'
import store from '@/store';
export default {
components: {
@ -178,7 +225,8 @@
associated,
authorize,
easyLoadimage,
mTabbar
mTabbar,
},
data() {
return {
@ -189,9 +237,19 @@
category_id: 0,
video_link: '',
is_type: 3,
resale_type:1,
product_info: []
},
price: 0,
deliveryFreeList: [{
value: '1',
name: '到店核销'
},
{
value: '2',
name: '快递配送'
}
],
imageSrc: '',
productList: [],
topicName: {},
@ -223,6 +281,13 @@
showVideo: false,
videoplay: false,
videoContext: '',
delivery_free: 1,
templateListPage: {
page: 1,
limit: 10000
},
merId: '',
delivery_way: [], // 1 2
};
@ -249,6 +314,7 @@
// #ifndef APP-PLUS
this.videoContext = uni.createVideoContext('myVideo', this);
// #endif
this.getUserInfo()
},
onLoad(options) {
// uni.hideTabBar()
@ -280,6 +346,42 @@
},
methods: {
getUserInfo: function() {
let that = this;
getUserInfo().then(res => {
this.merId = res.data.service.mer_id
})
},
//
deliveryFreeChange(val) {
if (val.detail.value) {
this.delivery_free = '1';
} else {
this.delivery_free = '0';
}
},
//
deliveryWayChange(obj) {
this.delivery_way = obj.detail.value;
if(this.formData.product_info.length>0){
for(let i in this.formData.product_info){
this.formData.product_info[i].deliver_method = obj.detail.value.toString();
}
}else{
this.$util.Tips({
title: '请选择产品,再选择送货方式'
});
}
},
onLoadFun() {
this.isShowAuth = false;
},
@ -450,6 +552,7 @@
},
/*添加宝贝*/
addProduct() {
this.$refs.associated.open();
},
@ -478,9 +581,12 @@
},
/*获取选中的宝贝*/
getProduct(data) {
this.productList=[]
this.price = 0
if (data.length > 0) {
this.productList = data;
this.productList = data;
for (let i in data) {
console.log(Number(data[i].num) , Number(data[i].price),(Number(data[i].num) * Number(data[i].price)))
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,
@ -493,7 +599,7 @@ this.productList = data;
}
this.$refs.associated.close();
},
@ -502,8 +608,10 @@ this.productList = data;
* 提交数据
*/
formSubmit: function(e) {
console.log(this.id)
// console.log(this.id)
let that = this,
value = that.formData;
if (value.image.length == 0) return that.$util.Tips({
title: '请添加图文图片'
@ -894,4 +1002,99 @@ this.productList = data;
height: 500rpx;
}
}
.popup_group {
background: #fff;
margin: 31rpx auto;
width: 710rpx;
font-size: 30rpx;
border-radius: 10rpx;
.popup_group_item {
padding: 32rpx 30rpx;
display: flex;
align-items: center;
justify-content: space-between;
.popup_group_item_value {
display: flex;
align-items: center;
.popup_group_item_message {
margin-right: 15rpx;
color: #bbbbbb;
max-width: 400rpx;
&_value {
display: inline-block;
max-width: 400rpx;
color: #000;
}
}
.iconfont {
color: #bbbbbb;
}
input {
text-align: right;
}
}
}
>view:not(:last-child) {
border-bottom: 1px solid #eeeeee;
}
}
.radio {
padding: 30rpx;
&_label {
padding-left: 10rpx;
color: #333333;
font-size: 30rpx;
display: flex;
align-items: center;
.select_check {
display: flex;
align-items: center;
justify-content: center;
width: 40rpx;
height: 40rpx;
border: 1px solid #cccccc;
border-radius: 50%;
margin-right: 20rpx;
.iconfont {
font-size: 24rpx;
}
}
.select {
background: #e93323;
border: none;
.iconfont {
color: #fff;
}
}
}
.select_group {
display: flex;
}
.flex_start {
padding: 0 10rpx;
margin-top: 40rpx;
justify-content: flex-start;
}
&_select {
display: flex;
margin-right: 110rpx;
}
}
</style>

View File

@ -5,10 +5,9 @@
<view class="search">
<view class="search-content acea-row row-middle">
<text class="iconfont icon-sousuo"></text>
<input v-model="where.keyword" confirm-type="search" placeholder="请输入关键字" class="input"
@confirm="handleSearch" />
<input v-model="where.keyword" confirm-type="search" placeholder="请输入关键字" class="input" />
<view class="search_btn">
<image src="@/static/images/serchbtn.png" mode="aspectFill"></image>
<image src="@/static/images/serchbtn.png" mode="aspectFill" @click="handleSearch"></image>
</view>
</view>
@ -37,12 +36,12 @@
</view>
</view>
<view class="list">
<view class="item" v-for='(item,index) in datatlist' :key='index' @click="shopping(item.community_id)">
<view class="item" v-for='(item,index) in datatlist' :key='index' @click="shopping(item)">
<image class="shopimg" :src="item.image[0]" mode="aspectFit"></image>
<view class="item_text">
<span v-if='item.is_type==3'>调货</span>
<span v-else>委托销售</span>
<span v-if='item.resale_type==1'>调货</span>
<span v-else>打折</span>
{{item.title}}
</view>
<view class="item_prices">
@ -64,16 +63,14 @@
<image src="@/static/images/trad-add.png" mode="aspectFit"></image>
</view>
<release :isShow='visible' :bottom='true' @close="closeMadle" @cancel="cancel" @confirm="confirm"></release>
<view
v-if="datatlist.length == 0||datatlist.length == 0 && where.page > 1 || datatlist.length == 0 && where1.page > 1||datatlist.length == 0 && where2.page > 1 ">
<release :isShow='visible' :bottom='true' @close="closeMadle" @cancel="cancel" @confirm="confirm"
style="z-index: 999999!important;"></release>
<view v-if="datatlist.length == 0||datatlist.length == 0 && where.page > 1 ">
<emptyPage title="暂无商品信息"></emptyPage>
</view>
<u-loadmore :status="status"
v-if="datatlist.length == 0 && where.page > 1 || datatlist.length == 0 && where1.page > 1||datatlist.length == 0 && where2.page > 1 " />
<u-loadmore :status="status" />
</view>
</template>
@ -104,18 +101,7 @@
keyword: '',
},
where1: {
page: 1,
limit: 10,
keyword: ''
},
where2: {
page: 1,
limit: 10,
keyword: ''
},
visible: false,
num: 0,
options: [{
@ -143,70 +129,73 @@
if (this.status == 'nomore') return;
this.status = 'loading';
this.where.page = ++this.where.page;
this.getGoods()
this.getlist(this.num)
},
//
btntap(index) {
this.num = index
this.getlist()
},
shopping(pid) {
//
shopping(item) {
let data = {
type: 1,
id: pid
type: item.resale_type,
id: item.community_id
}
uni.navigateTo({
url: '/pages/trading_hall/product_details/index?key=' + encodeURIComponent(JSON.stringify(
data))
})
},
//
open() {
this.visible = true
},
getlist(index) {
//
handleSearch() {
if (this.num == 0) {
this.where = {
page: 1,
limit: 10,
is_type: 3,
keyword: '',
},
getCommunitygetOrderList(this.where).then(res => {
if (res.status == 200) {
// this.datatlist = res.data.listcons
// console.log(res.data)
this.datatlist = []
}
})
this.where.resale_type = ''
} else if (this.num == 1) {
this.where1 = {
page:1,
limit:10,
keyword:'',
},
getCommunityList(this.where).then(res => {
if (res.status == 200) {
this.datatlist = res.data.list
}
})
this.where.resale_type = 1
} else {
this.where2 = {
page: 1,
limit: 10,
keyword: '',
},
this.datatlist = []
this.where.resale_type = 2
}
getCommunityList(this.where).then(res => {
if (res.status == 200) {
if (res.data.list.length < this.where.limit) {
this.status = 'nomore'
}
this.datatlist = res.data.list
}
})
},
//
getlist(index) {
if (this.num == 0) {
this.where.resale_type = ''
} else if (this.num == 1) {
this.where.resale_type = 1
} else {
this.where.resale_type = 2
}
getCommunityList(this.where).then(res => {
if (res.status == 200) {
if (res.data.list.length < this.where.limit) {
this.status = 'nomore'
}
this.datatlist = res.data.list
}
})
},
closeMadle() {
@ -226,7 +215,7 @@
menuAction(action, rowId) {
// console.log(action);
//
this.num=action
this.num = action
this.getlist(action)
if (action === '') {
this.recomname = this.options[0].text
@ -309,7 +298,7 @@
font-size: 32rpx;
font-family: 'PingFang SC';
font-weight: 400;
.recom_sym {
width: 28rpx;
@ -344,8 +333,9 @@
.tradline {
width: 26rpx;
height: 4rpx;
opacity: 1;
border: 2rpx solid #F84221;
background-color: #F84221;
margin: 0 auto;
}
}
@ -368,7 +358,7 @@
width: 694.74rpx;
margin: 0 auto;
display: flex;
margin-bottom: 21rpx;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
@ -379,7 +369,7 @@
height: 561rpx;
background-color: #fff;
margin-top: 21rpx;
border-radius: 14rpx 14rpx 0 0;
.shopimg {

View File

@ -5,8 +5,6 @@
* @Date 2022-01-26
*/
// import store from '../store'
// 是否播放中
let isPlaying = false;
// 播放列表
@ -19,166 +17,24 @@ 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();
// }
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();
voice.playAudio();
},
// 语言播报语音数据 加入到队列里面
addAudioQueue: (parseStr) => {
let audioList = store.state.audioList;
audioList[voice.getRandomKey()] = parseStr;
store.commit('setData', {
key: 'audioList',
val: audioList
});
},
// 重置播放列表
resetPlayList: () => {
playIndex = 0;
@ -204,20 +60,18 @@ const voice = {
}
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();
}
}
// voice.resetPlayList();
// if (currentAudio.length == 0) {
// const keys = Object.keys(audioList)
// console.log(audioList)
// if (keys.length) {
// currentAudio = Object.values(audioList)[0]
// delete audioList[keys[0]]
// playIndex = 0
// } else {
// voice.resetPlayList();
// }
// }
console.log('正在播报:', currentAudio[playIndex]);
let path = plus.io.convertLocalFileSystemURL(currentAudio[playIndex]);
let currentTime = 0; // 当前流媒体的播放的位置,单位是秒
@ -240,14 +94,16 @@ const voice = {
audioPlayer.start();
isPlaying = audioPlayer.isPlaying();
// 获取音乐的总时长
// console.log(audioPlayer.getDuration());
console.log(isPlaying, audioPlayer.getDuration());
// 当前播放进度 getCurrentPosition 毫秒
}
timer = setInterval(function() {
currentTime = platform == 'iOS' ? audioPlayer.currentTime() : audioPlayer
.getCurrentPosition() / 1000;
currentDuration = platform == 'iOS' ? audioPlayer.duration() : audioPlayer
.getDuration() / 1000;
// console.log(currentTime, currentDuration)
if (currentTime == currentDuration || currentTime == 0) {
isPlaying = false;
voice.clearTimer();
@ -260,10 +116,10 @@ const voice = {
if (Object.keys(audioList).length == 0 && currentAudio.length == 0) {
voice.resetPlayList();
}
voice.playAudio();
// voice.playAudio();
}
}, 200);
}
}
export default voice
export default voice

View File

@ -54,7 +54,7 @@ body {overflow-x: hidden;}
-o-box-pack: end;
-ms-flex-pack: end;
-webkit-justify-content: flex-end;
justify-content: flex-end
justify-content: flex-end;
}
.acea-row.row-left {
-webkit-box-pack: start;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB