幼教产品B2B生态平台小程序端
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.

229 lines
5.3 KiB

11 months ago
<template>
<view>
<!-- 选择规格弹窗 -->
<uni-popup ref="popup" background-color="#fff" type="bottom" @change="change">
<view class="goodsPopup">
<view class="title">发送询价单给商家</view>
<view class="tips">请填写您需要采购的数量及需求方便商家更好地为你造型报价</view>
<ul class="tab">
<li v-for="(tab, i) in tabs" :key="i" :class="{active: curTab === tab.id}" @click="tabChange(tab)">{{ tab.name }}</li>
</ul>
<view class="content">
<scroll-view v-if="!curTab" class="goods-wrap" scroll-y :show-scrollbar="false">
<view class="goods" v-for="(item, i) in goods" :key="i">
<view class="info">
<view class="item">
11 months ago
<view class="name">{{ item.prodName }}</view>
<view class="meta">{{ item.price }}</view>
11 months ago
</view>
<view class="item">
11 months ago
<view class="name">{{ item.skuName }}</view>
<view class="meta">库存{{ item.stocks }}</view>
11 months ago
</view>
</view>
11 months ago
<uni-number-box v-model.number="item.prodCount" :min="0" :max="item.stocks"></uni-number-box>
11 months ago
</view>
</scroll-view>
11 months ago
<textarea v-else class="msg" v-model="remarks" placeholder="请输入"></textarea>
11 months ago
</view>
<view class="btns">
11 months ago
<view class="btn" @click="procure(1)">个人采购</view>
<view v-if="platformId === 5" class="btn" @click="procure(2)">组织采购</view>
11 months ago
<view class="btn back" @click="back">返回</view>
</view>
</view>
</uni-popup>
11 months ago
<uni-popup ref="successDia" type="dialog">
<uni-popup-dialog type="success" cancelText="返回" confirmText="查询询价采购单" title="提示" content="发送成功" @confirm="dialogConfirm"
@close="dialogClose"></uni-popup-dialog>
</uni-popup>
11 months ago
</view>
</template>
<script>
11 months ago
import { orderConfirm, orderSubmit } from '@/apis/modules/order.js'
import { list } from '@/apis/modules/goods.js'
11 months ago
export default {
name:"order",
11 months ago
// props: {
// prodId: {
// type: Number,
// },
// },
11 months ago
data() {
return {
11 months ago
platformId: uni.getStorageSync('platformId'),
11 months ago
shopId: '',
11 months ago
tabs: [
{
id: 0,
name: '按产品'
},
{
id: 1,
name: '留言商家'
},
],
curTab: 0,
goods: [],
11 months ago
remarks: '',
orderNumbers: '',
11 months ago
};
},
onShow() {
// this.getGoods()
},
methods: {
// 获取商品列表
11 months ago
async getGoods(shopId) {
11 months ago
this.shopId = shopId
11 months ago
const { data } = await list({
shopId
})
11 months ago
data.map(e => e.prodCount = '')
11 months ago
this.goods = data
11 months ago
},
change() {
},
// 返回
back() {
11 months ago
11 months ago
},
// tab切换
tabChange(tab) {
this.curTab = tab.id
},
11 months ago
// 采购
11 months ago
async procure(type) {
const { goods } = this
const hadOrder = goods.find(e => e.prodCount) // 是否有输入采购数量(采购数量或者留言至少需要输一个才能采购)
if (!hadOrder && !this.remarks) return this.$util.errMsg(`请输入采购数量或者留言信息!`)
try {
// 如果是采购,需要调两个接口,下面这个是采购的接口,第二个接口是需要传留言的接口;如果是留言的话就只需要调第二个接口
if (hadOrder) {
const data = goods.filter(e => e.prodCount).map(e => {
return {
prodCount: e.prodCount,
prodId: e.prodId,
shopId: this.shopId,
skuId: e.skuId,
}
})
await orderConfirm({
orderItem: data
})
}
11 months ago
11 months ago
// 留言
const res = await orderSubmit({
leaveAMessage: this.remarks ? true : false,
orderShopParam: [
{
remarks: this.remarks,
shopId: this.shopId
}
],
orderType: type
})
this.orderNumbers = res.data.orderNumbers
this.$refs.popup.close()
this.$refs.successDia.open()
} catch (e) {}
},
// 提示成功确认
dialogConfirm() {
this.$util.to(`/other/procureDetail/procureDetail?id=${this.orderNumbers}`)
},
// 提示成功返回
dialogClose() {
this.$refs.successDia.close()
11 months ago
},
11 months ago
}
}
</script>
<style scoped lang="scss">
.goodsPopup {
position: relative;
padding: 30rpx;
.title {
font-size: 30rpx;
color: #333;
}
.tips {
margin: 20rpx 0 40rpx;
font-size: 24rpx;
color: #a0a0a0;
}
.content {
height: 50vh;
}
.goods-wrap {
height: 100%;
margin-bottom: 100rpx;
}
.goods {
display: flex;
justify-content: space-between;
align-items: center;
11 months ago
margin-bottom: 20rpx;
11 months ago
}
.info {
display: inline-flex;
margin-bottom: 20rpx;
11 months ago
.item {
margin-right: 20rpx;
&:first-child {
padding-right: 20rpx;
border-right: 1px solid #e6e6e6;
}
}
11 months ago
.name {
11 months ago
margin-bottom: 10rpx;
11 months ago
font-size: 26rpx;
color: #333;
}
.meta {
font-size: 24rpx;
11 months ago
color: #9c9c9c;
11 months ago
}
}
.msg {
width: 100%;
height: 100%;
padding: 30rpx;
font-size: 24rpx;
color: #333;
border: 1px solid #dedede;
border-radius: 4px;
box-sizing: border-box;
}
.btns {
display: flex;
justify-content: space-between;
margin-top: 30rpx;
.btn {
11 months ago
width: 35%;
padding: 15rpx 0;
11 months ago
font-size: 28rpx;
color: #fff;
11 months ago
text-align: center;
11 months ago
background-color: $uni-primary;
border-radius: 20px;
}
.back {
11 months ago
width: 20%;
11 months ago
color: #333;
background-color: #fff;
border: 1px solid #ccc;
}
}
}
</style>