Browse Source

对接登录

master
前端-胡立永 7 months ago
parent
commit
8efdad7284
9 changed files with 312 additions and 238 deletions
  1. +6
    -0
      api/api.js
  2. +3
    -2
      components/user/productList.vue
  3. +1
    -1
      locale/zh-Hans.json
  4. +4
    -2
      pages/index/center2.vue
  5. +2
    -2
      pages/index/index.vue
  6. +1
    -1
      pages_order/auth/registerShop.vue
  7. +209
    -201
      pages_order/tradingPlatform/confirmOrder.vue
  8. +63
    -28
      pages_order/tradingPlatform/nowOrder.vue
  9. +23
    -1
      store/store.js

+ 6
- 0
api/api.js View File

@ -80,6 +80,11 @@ const config = {
url: '/product/addProductOrder', url: '/product/addProductOrder',
method: 'POST', method: 'POST',
}, },
// 确认-取消订单
updateOrder: {
url: '/product/updateOrder',
method: 'POST',
},
// 我的挂单列表 // 我的挂单列表
getMyProductlist: { getMyProductlist: {
url: '/product/myProductlist', url: '/product/myProductlist',
@ -136,6 +141,7 @@ const config = {
getImagePhoneOther: { getImagePhoneOther: {
url: '/index/index', url: '/index/index',
method: 'POST', method: 'POST',
limit: 500,
}, },


+ 3
- 2
components/user/productList.vue View File

@ -44,9 +44,10 @@ export default {
// //
immediatePurchase(item) { immediatePurchase(item) {
console.log("====") console.log("====")
var itemStr = encodeURIComponent(JSON.stringify(item));
// var itemStr = encodeURIComponent(JSON.stringify(item));
this.$store.state.productDetail = item
uni.navigateTo({ uni.navigateTo({
url: `/pages_order/tradingPlatform/nowOrder?params=${itemStr}`,
url: `/pages_order/tradingPlatform/nowOrder`,
}); });
} }
}, },


+ 1
- 1
locale/zh-Hans.json View File

@ -171,7 +171,7 @@
"aluminumProducts": "铝制品", "aluminumProducts": "铝制品",
"tentativeQuantity": "暂定数量(吨)", "tentativeQuantity": "暂定数量(吨)",
"performanceDeposit": "履约保证金", "performanceDeposit": "履约保证金",
"priceQuantityPercentage": "(单价*数量*2%)",
"priceQuantityPercentage": "(单价*数量*{0}%)",
"companyName": "公司名称", "companyName": "公司名称",
"enterCompanyName": "请输入公司名称", "enterCompanyName": "请输入公司名称",
"taxCode": "税收编码", "taxCode": "税收编码",


+ 4
- 2
pages/index/center2.vue View File

@ -34,7 +34,7 @@
<!-- 采购商 --> <!-- 采购商 -->
<view class="purchaser" v-else> <view class="purchaser" v-else>
<centerList :list="supplierList" @open="openCustomerServicePopup"></centerList>
<centerList :list="purchaserList" @open="openCustomerServicePopup"></centerList>
</view> </view>
</view> </view>
@ -59,6 +59,7 @@ export default {
}, },
data() { data() {
return { return {
//
supplierList: [ supplierList: [
{text: `${this.$t('pageTitle.myOrders')}`,englishText:'myOrders', value: ">", imgUrl: '/static/image/center/14.svg', toPathUrl: '/pages_order/order/pendingOrder'}, {text: `${this.$t('pageTitle.myOrders')}`,englishText:'myOrders', value: ">", imgUrl: '/static/image/center/14.svg', toPathUrl: '/pages_order/order/pendingOrder'},
{text: `${this.$t('components.contactCustomerService')}`, englishText:'contactCustomerService',value: ">", imgUrl: '/static/image/center/13.svg'}, {text: `${this.$t('components.contactCustomerService')}`, englishText:'contactCustomerService',value: ">", imgUrl: '/static/image/center/13.svg'},
@ -66,10 +67,11 @@ export default {
{text: `${this.$t('components.helpFeedback')}`,englishText:'systemSettings', value: ">", imgUrl: '/static/image/center/12.svg', toPathUrl: '/pages_order/center/helpFeedback'}, {text: `${this.$t('components.helpFeedback')}`,englishText:'systemSettings', value: ">", imgUrl: '/static/image/center/12.svg', toPathUrl: '/pages_order/center/helpFeedback'},
{text: `${this.$t('components.aboutUs')}`, englishText:'aboutUs',value: ">", imgUrl: '/static/image/center/13.svg'}, {text: `${this.$t('components.aboutUs')}`, englishText:'aboutUs',value: ">", imgUrl: '/static/image/center/13.svg'},
], ],
//
purchaserList: [ purchaserList: [
// this.$t('pages.index.index.companyProfile') // this.$t('pages.index.index.companyProfile')
{text: `${this.$t('components.contactCustomerService')}`, englishText:'contactCustomerService',value: ">", imgUrl: '/static/image/center/13.svg'}, {text: `${this.$t('components.contactCustomerService')}`, englishText:'contactCustomerService',value: ">", imgUrl: '/static/image/center/13.svg'},
{text: `${this.$t('components.contactCustomerService')}`,englishText:'systemSettings', value: ">", imgUrl: '/static/image/center/12.svg', toPathUrl: '/pages_order/center/systemSet'},
{text: `${this.$t('components.systemSettings')}`,englishText:'systemSettings', value: ">", imgUrl: '/static/image/center/12.svg', toPathUrl: '/pages_order/center/systemSet'},
{text: `${this.$t('components.helpFeedback')}`,englishText:'systemSettings', value: ">", imgUrl: '/static/image/center/12.svg', toPathUrl: '/pages_order/center/helpFeedback'}, {text: `${this.$t('components.helpFeedback')}`,englishText:'systemSettings', value: ">", imgUrl: '/static/image/center/12.svg', toPathUrl: '/pages_order/center/helpFeedback'},
{text: `${this.$t('components.aboutUs')}`, englishText:'aboutUs',value: ">", imgUrl: '/static/image/center/13.svg'}, {text: `${this.$t('components.aboutUs')}`, englishText:'aboutUs',value: ">", imgUrl: '/static/image/center/13.svg'},
] ]


+ 2
- 2
pages/index/index.vue View File

@ -144,6 +144,7 @@
url: '/pages_order/auth/selectionIdentity?back=no&' url: '/pages_order/auth/selectionIdentity?back=no&'
}) })
} }
this.$store.commit('getUserInfo')
}, },
computed: { computed: {
...mapGetters(['userShop']), ...mapGetters(['userShop']),
@ -169,9 +170,8 @@
} }
.page { .page {
background-color: #2e394d; background-color: #2e394d;
min-height: 100vh;
// //
.supplier { .supplier {
display: flex; display: flex;


+ 1
- 1
pages_order/auth/registerShop.vue View File

@ -271,7 +271,7 @@
<style scoped lang="scss"> <style scoped lang="scss">
.registerShop { .registerShop {
.frame { .frame {
height: 79vh;
min-height: 100vh;
overflow: auto; overflow: auto;
.basicInfo { .basicInfo {


+ 209
- 201
pages_order/tradingPlatform/confirmOrder.vue View File

@ -1,209 +1,217 @@
<template> <template>
<view class="confirmOrder">
<navbar :title="$t('pageTitle.confirmOrder')" leftClick @leftClick="$utils.navigateBack"/>
<view class="frame">
<view class="title">
{{ $t('other.payDeposit') }}
</view>
<!--填写信息-->
<view class="form">
<!--开户名称-->
<view class="item">
<view> {{ $t('components.accountName') }}</view>
<view>
<input v-model="form.a" :placeholder="$t('components.enterAccountName')" clearable></input>
</view>
</view>
<!--开户行-->
<view class="item">
<view> {{ $t('components.bankName') }}</view>
<view>
<input v-model="form.b" :placeholder="$t('components.enterOpeningBank')" clearable></input>
</view>
</view>
<!--银行账号-->
<view class="item">
<view> {{ $t('components.bankAccount') }}</view>
<view>
<input v-model="form.c" :placeholder="$t('components.enterBankAccount')" clearable></input>
</view>
</view>
<view class="tip">
{{ $t('components.paymentNotice') }}
</view>
</view>
<!--和联系我们-->
<view class="btns">
<span @click="confirmOrder" class="qrdd">
{{ $t('components.confirmOrder') }}
</span>
<span @click="closeOrder" class="qxdd">
{{ $t('components.cancelOrder') }}
</span>
</view>
</view>
</view>
<view class="confirmOrder">
<navbar :title="$t('pageTitle.confirmOrder')" leftClick @leftClick="$utils.navigateBack" />
<view class="frame">
<view class="title">
{{ $t('other.payDeposit') }}
</view>
<!--填写信息-->
<view class="form">
<!--开户名称-->
<view class="item">
<view> {{ $t('components.accountName') }}</view>
<view>
<input v-model="form.companyName"
disabled
:placeholder="$t('components.enterAccountName')" clearable></input>
</view>
</view>
<!--开户行-->
<view class="item">
<view> {{ $t('components.bankName') }}</view>
<view>
<input v-model="form.bankName"
disabled :placeholder="$t('components.enterOpeningBank')" clearable></input>
</view>
</view>
<!--银行账号-->
<view class="item">
<view> {{ $t('components.bankAccount') }}</view>
<view>
<input v-model="form.bankAccount"
disabled
:placeholder="$t('components.enterBankAccount')" clearable></input>
</view>
</view>
<view class="tip">
{{ $t('components.paymentNotice') }}
</view>
</view>
<!--和联系我们-->
<view class="btns">
<!-- 确认订单 -->
<span @click="confirmOrder(0)" class="qrdd">
{{ $t('components.confirmOrder') }}
</span>
<!-- 取消订单 -->
<span @click="confirmOrder(1)" class="qxdd">
{{ $t('components.cancelOrder') }}
</span>
</view>
</view>
</view>
</template> </template>
<script> <script>
export default {
name: "confirmOrder",
onLoad(options) {
if (options.params) {
const fatherData = JSON.parse(decodeURIComponent(options.params));
console.log(fatherData, "fatherData==========")
this.fatherData = fatherData;
}
},
data() {
return {
fatherData: {},
form: {
a: "",
b: "",
c: "",
},
}
},
methods: {
//
confirmOrder() {
this.$api('addProductOrder',this.form, res => {
if (res.code == 200) {
uni.redirectTo({
url: '/pages/index/clearanceService'
})
}
})
},
//
closeOrder() {
},
},
}
export default {
name: "confirmOrder",
onLoad(options) {
// if (options.params) {
// const fatherData = JSON.parse(decodeURIComponent(options.params));
// console.log(fatherData, "fatherData==========")
this.fatherData = this.$store.state.productDetail;
this.form = this.$store.state.cartInfo;
// }
},
data() {
return {
fatherData: {},
form: {
},
}
},
methods: {
//0 / 1
confirmOrder(type) {
this.$api('updateOrder', {
orderId : this.form.orderId,
type
}, res => {
if (res.code == 200) {
uni.redirectTo({
url: '/pages/index/clearanceService'
})
}
})
},
//
closeOrder() {
},
},
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.confirmOrder {
background-color: #FFF;
height: 100vh;
.frame {
.title {
display: flex;
justify-content: center;
align-items: center;
font-size: 36rpx;
color: #000;
padding: 30rpx;
}
.form {
margin: 20rpx;
border: 1px solid #efefef;
border-radius: 20rpx;
overflow: hidden;
.item {
display: flex;
align-items: center;
background-color: #FFF;
height: 100rpx;
padding: 10rpx 0 0 20rpx;
border-bottom: 1px solid #efefef;
> view:nth-of-type(1) {
width: 30%;
// font-weight: 700;
}
> view:nth-of-type(2) {
width: 70%;
border-radius: 10rpx;
overflow: hidden;
input {
background-color: #FFF;
font-size: 28rpx;
padding: 16rpx 8rpx 16rpx 15rpx;
}
}
}
.tip {
display: flex;
justify-content: center;
align-items: center;
font-size: 28rpx;
color: #f95e7d;
background-color: #f5f5f5;
height: 40rpx;
//margin-top: 20rpx;
padding: 10rpx;
}
}
.btns {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 20rpx;
position: fixed;
bottom: 80rpx;
left: 0;
right: 0;
.qrdd {
display: flex;
align-items: center;
justify-content: center;
width: 500rpx;
height: 70rpx;
border-radius: 40rpx;
color: #FFF;
font-size: 28rpx;
margin: 20rpx 10rpx 0 0;
background: $uni-color;
//margin-top: 20rpx;
border-radius: 40rpx;
}
.qxdd {
display: flex;
align-items: center;
justify-content: center;
width: 500rpx;
height: 70rpx;
border-radius: 40rpx;
color: #000000;
font-size: 28rpx;
margin: 20rpx 10rpx 0 0;
background: #f1f1f1;
//margin-top: 20rpx;
border-radius: 40rpx;
}
}
}
}
.confirmOrder {
background-color: #FFF;
height: 100vh;
.frame {
.title {
display: flex;
justify-content: center;
align-items: center;
font-size: 36rpx;
color: #000;
padding: 30rpx;
}
.form {
margin: 20rpx;
border: 1px solid #efefef;
border-radius: 20rpx;
overflow: hidden;
.item {
display: flex;
align-items: center;
background-color: #FFF;
height: 100rpx;
padding: 10rpx 0 0 20rpx;
border-bottom: 1px solid #efefef;
>view:nth-of-type(1) {
width: 30%;
// font-weight: 700;
}
>view:nth-of-type(2) {
width: 70%;
border-radius: 10rpx;
overflow: hidden;
input {
background-color: #FFF;
font-size: 28rpx;
padding: 16rpx 8rpx 16rpx 15rpx;
}
}
}
.tip {
display: flex;
justify-content: center;
align-items: center;
font-size: 28rpx;
color: #f95e7d;
background-color: #f5f5f5;
height: 40rpx;
//margin-top: 20rpx;
padding: 10rpx;
}
}
.btns {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 20rpx;
position: fixed;
bottom: 80rpx;
left: 0;
right: 0;
.qrdd {
display: flex;
align-items: center;
justify-content: center;
width: 500rpx;
height: 70rpx;
border-radius: 40rpx;
color: #FFF;
font-size: 28rpx;
margin: 20rpx 10rpx 0 0;
background: $uni-color;
//margin-top: 20rpx;
border-radius: 40rpx;
}
.qxdd {
display: flex;
align-items: center;
justify-content: center;
width: 500rpx;
height: 70rpx;
border-radius: 40rpx;
color: #000000;
font-size: 28rpx;
margin: 20rpx 10rpx 0 0;
background: #f1f1f1;
//margin-top: 20rpx;
border-radius: 40rpx;
}
}
}
}
</style> </style>

+ 63
- 28
pages_order/tradingPlatform/nowOrder.vue View File

@ -14,7 +14,7 @@
<view class="item"> <view class="item">
<view>{{ $t('components.productSpe') }}</view> <view>{{ $t('components.productSpe') }}</view>
<view> <view>
{{$t('other.aluminumProducts') }}
{{$t('other.aluminumProducts') }}
</view> </view>
</view> </view>
@ -48,12 +48,14 @@
<view class="delivery-date"> <view class="delivery-date">
<view>{{ $t('components.deliveryDate') }}</view> <view>{{ $t('components.deliveryDate') }}</view>
<view class="value"> <view class="value">
<view class="dateTimeCls">
<view class="date" @click="startDateOpen">
<view class="dateTimeCls"
@click="startDateOpen">
<view class="date">
{{ form.takeTime }} {{ form.takeTime }}
<uv-datetime-picker ref="startDateRef"
v-model="form.takeTime"
<uv-datetime-picker ref="startDateRef"
v-model="form.takeTime"
mode="date" mode="date"
:minDate="$dayjs(fatherData.transactionTime).valueOf()"
@confirm="startDateChange"></uv-datetime-picker> @confirm="startDateChange"></uv-datetime-picker>
</view> </view>
<view class="img"> <view class="img">
@ -69,9 +71,8 @@
<view class="tentativeQuantity"> <view class="tentativeQuantity">
<view class="key">{{ $t('other.tentativeQuantity') }}</view> <view class="key">{{ $t('other.tentativeQuantity') }}</view>
<view class="value"> <view class="value">
<uv-number-box @change="form.deposit = (fatherData.price * form.num * (0.02)).toFixed(2)"
inputWidth="200rpx"
v-model="form.num" :max="fatherData.num"></uv-number-box>
<uv-number-box
inputWidth="200rpx" v-model="form.num" :max="fatherData.num"></uv-number-box>
</view> </view>
</view> </view>
@ -87,14 +88,15 @@
<view class="performanceBond"> <view class="performanceBond">
<view class="key">{{ $t('other.performanceDeposit') }}</view> <view class="key">{{ $t('other.performanceDeposit') }}</view>
<view class="value"> <view class="value">
<input v-model="form.deposit" clearable></input>
<!-- <input v-model="form.deposit" clearable></input> -->
{{ deposit }}
</view> </view>
</view> </view>
<view class="Tip"> <view class="Tip">
<span class="span">{{ $t('other.priceQuantityPercentage') }}</span>
<span class="span">{{ $t('other.priceQuantityPercentage', [10]) }}</span>
</view> </view>
<!--立即下单和联系我们--> <!--立即下单和联系我们-->
<view class="btns"> <view class="btns">
<span @click="ljxd" class="ljxd"> <span @click="ljxd" class="ljxd">
@ -132,38 +134,70 @@
}, },
computed: { computed: {
...mapGetters(['userShop']), ...mapGetters(['userShop']),
deposit(){
return (this.fatherData.price * this.form.num * (0.1)).toFixed(2)
},
}, },
onLoad(options) { onLoad(options) {
if (options.params) {
const fatherData = JSON.parse(decodeURIComponent(options.params));
// if (options.params) {
// const fatherData = JSON.parse(decodeURIComponent(options.params));
// vuex
const fatherData = this.$store.state.productDetail
console.log(fatherData, "fatherData==========") console.log(fatherData, "fatherData==========")
this.fatherData = fatherData; this.fatherData = fatherData;
this.form.deposit = (fatherData.price * this.form.num * (0.02)).toFixed(2);
}
//
// this.form.deposit = (fatherData.price * this.form.num * (0.02)).toFixed(2);
// }
}, },
data() { data() {
return { return {
fatherData: {}, fatherData: {},
form: { form: {
"address": "",
"addressId": "",
"deposit": 0,
"id": "",
"num": 1,
"price": 0,
"productId": "",
"takeTime": ""
},
"address": "",
"addressId": "",
"deposit": 0,
"id": "",
"num": 1,
"price": 0,
"productId": "",
"takeTime": ""
},
id : 0,
} }
}, },
methods: { methods: {
// //
ljxd() { ljxd() {
var itemStr = encodeURIComponent(JSON.stringify(this.form));
uni.navigateTo({
url: `/pages_order/tradingPlatform/confirmOrder?params=${itemStr}`,
});
// var itemStr = encodeURIComponent(JSON.stringify(this.form));
// uni.navigateTo({
// url: `/pages_order/tradingPlatform/confirmOrder`,
// });
this.form.deposit = this.deposit
this.form.productId = this.fatherData.id
if(this.$utils.verificationAll(this.form, {
"takeTime": '请选择交货时间',
})){
return
}
this.$api('addProductOrder', this.form, res => {
if(res.code == 200){
// vuex
this.$store.state.cartInfo = res.result
uni.navigateTo({
url: `/pages_order/tradingPlatform/confirmOrder`,
});
}
})
}, },
// //
contactUs() { contactUs() {
@ -176,6 +210,7 @@
}); });
}, },
startDateOpen() { startDateOpen() {
console.log(1);
this.$refs.startDateRef.open(); this.$refs.startDateRef.open();
}, },


+ 23
- 1
store/store.js View File

@ -15,6 +15,8 @@ const store = new Vuex.Store({
shopData : {}, shopData : {},
buy : {}, buy : {},
customerPhone : '',//客服电话 customerPhone : '',//客服电话
productDetail : {},//商品详情用于中转
cartInfo : {},//采购商下单的时候供应商开户行信息
}, },
getters: { getters: {
// 角色 true 为供应商 false 为采购商 // 角色 true 为供应商 false 为采购商
@ -62,7 +64,7 @@ const store = new Vuex.Store({
state.shop = !!res.result.shop state.shop = !!res.result.shop
uni.setStorageSync('token', res.result.token) uni.setStorageSync('token', res.result.token)
if(!state.shop && !state.buy){
if(!state.shopData && !state.buy){
uni.reLaunch({ uni.reLaunch({
url: '/pages_order/auth/selectionIdentity?back=no&' url: '/pages_order/auth/selectionIdentity?back=no&'
}) })
@ -73,11 +75,31 @@ const store = new Vuex.Store({
} }
}) })
}, },
// 获取个人信息
getUserInfo(state){ getUserInfo(state){
api('getImagePhoneOther', res => { api('getImagePhoneOther', res => {
if(res.code == 200){ if(res.code == 200){
state.userInfo = res.result.my state.userInfo = res.result.my
state.customerPhone = res.result.phone state.customerPhone = res.result.phone
state.buy = res.result.buy
state.shopData = res.result.shop
// 如果什么身份都没有,就去注册
if(!state.shopData && !state.buy){
uni.reLaunch({
url: '/pages_order/auth/selectionIdentity?back=no&'
})
}
// 没有供应商身份
if(!state.shopData){
state.shop = false
// 没有采购商身份
}else if(!state.buy){
state.shop = true
}
} }
}) })
}, },


Loading…
Cancel
Save