Browse Source

对接登录

master
前端-胡立永 3 months ago
parent
commit
c0a9a9f94b
16 changed files with 301 additions and 135 deletions
  1. +7
    -1
      api/api.js
  2. +84
    -78
      components/base/topbar.vue
  3. +3
    -0
      components/config/configPopup.vue
  4. +5
    -0
      components/user/productList.vue
  5. +13
    -5
      components/user/visualization.vue
  6. +37
    -1
      pages/index/center2.vue
  7. +3
    -2
      pages/index/index.vue
  8. +8
    -5
      pages/index/tradingPlatform.vue
  9. +10
    -4
      pages_order/components/order/myOrderList.vue
  10. +2
    -2
      pages_order/components/order/orderList.vue
  11. +7
    -2
      pages_order/components/product/submit.vue
  12. +3
    -3
      pages_order/order/offerOrBillLading.vue
  13. +49
    -12
      pages_order/order/orderDetail2.vue
  14. +44
    -15
      pages_order/product/productDetail.vue
  15. +11
    -4
      store/store.js
  16. +15
    -1
      utils/utils.js

+ 7
- 1
api/api.js View File

@ -183,8 +183,14 @@ const config = {
method: 'POST',
},
// 我的头像昵称,平台客户电话等信息
getImagePhoneOther: {
getUserInfo: {
url: '/index/index',
method: 'POST',
auth : true,
},
// 我的头像昵称,平台客户电话等信息
getImagePhoneOther: {
url: '/index/getIndex',
method: 'POST',
},
// 我的订单列表


+ 84
- 78
components/base/topbar.vue View File

@ -1,89 +1,95 @@
<template>
<view class="top-bar">
<!--左边-->
<view class="titleCls">
<view>
<img src="../../static/image/logo.png" style="width: 70rpx;height: 70rpx;border-radius: 50%;">
</view>
<span class="text"> {{ $t('pageTitle.proName') }}</span>
</view>
<!--右边-->
<view v-if="showRight == '1'" @click="switchIdentity" class="change">
<!-- {{ $t('pages.index.index.purchaser') }} -->
{{ userShop ? '供应商' : '采购商' }}
</view>
</view>
<view class="top-bar">
<!--左边-->
<view class="titleCls">
<view>
<img src="../../static/image/logo.png" style="width: 70rpx;height: 70rpx;border-radius: 50%;">
</view>
<span class="text"> {{ $t('pageTitle.proName') }}</span>
</view>
<!--右边-->
<view v-if="showRight == '1' && !userInfo.id" @click="$utils.toLogin" class="change">
<!-- {{ $t('pages.index.index.purchaser') }} -->
登录
</view>
<view v-else-if="showRight == '1'" @click="switchIdentity" class="change">
<!-- {{ $t('pages.index.index.purchaser') }} -->
{{ userShop ? '供应商' : '采购商' }}
</view>
</view>
</template>
<script>
import {mapGetters} from 'vuex'
import {
mapGetters
} from 'vuex'
export default {
props: {
showRight: {
default: '0',
type: String,
}
},
mounted() {
console.log(this.$store.state, "this.$store.state")
},
data() {
return {
export default {
props: {
showRight: {
default: '0',
type: String,
}
},
mounted() {
console.log(this.$store.state, "this.$store.state")
},
data() {
return {
}
},
computed: {
...mapGetters(['userShop']),
},
methods: {
//
switchIdentity() {
uni.navigateTo({
url: '/pages_order/auth/selectionIdentity'
})
}
,
}
}
}
},
computed: {
...mapGetters(['userShop', 'userInfo']),
},
methods: {
//
switchIdentity() {
uni.navigateTo({
url: '/pages_order/auth/selectionIdentity'
})
},
}
}
</script>
<style lang="scss" scoped>
//
.top-bar {
display: flex;
justify-content: space-between;
height: 120rpx;
background-color: $uni-color;
//
.top-bar {
display: flex;
justify-content: space-between;
height: 120rpx;
background-color: $uni-color;
.titleCls {
display: flex;
padding: 20rpx 10rpx;
align-items: center;
.text {
display: flex;
justify-content: center;
align-items: center;
font-size: 30rpx;
color: #FFFFFF;
margin-left: 20rpx;
}
}
.titleCls {
display: flex;
padding: 20rpx 10rpx;
align-items: center;
.change {
display: flex;
align-items: center;
justify-content: center;
width: 30%;
height: 70rpx;
border-radius: 40rpx;
color: white;
font-size: 28rpx;
margin: 20rpx 10rpx 0 0;
background: $uni-color;
border: 1px solid #757986;
//margin-top: 20rpx;
border-radius: 40rpx;
}
}
</style>
.text {
display: flex;
justify-content: center;
align-items: center;
font-size: 30rpx;
color: #FFFFFF;
margin-left: 20rpx;
}
}
.change {
display: flex;
align-items: center;
justify-content: center;
width: 30%;
height: 70rpx;
border-radius: 40rpx;
color: white;
font-size: 28rpx;
margin: 20rpx 10rpx 0 0;
background: $uni-color;
border: 1px solid #757986;
//margin-top: 20rpx;
border-radius: 40rpx;
}
}
</style>

+ 3
- 0
components/config/configPopup.vue View File

@ -39,6 +39,9 @@
.configPopup {
.content{
padding: 30rpx 20rpx;
overflow: scroll;
height: 100%;
box-sizing: border-box;
}
}
</style>

+ 5
- 0
components/user/productList.vue View File

@ -88,6 +88,11 @@
methods: {
//
immediatePurchase(item) {
if(!uni.getStorageSync('token')){
return this.$utils.toLogin()
}
console.log("====")
// var itemStr = encodeURIComponent(JSON.stringify(item));
this.$store.state.productDetail = item


+ 13
- 5
components/user/visualization.vue View File

@ -33,7 +33,7 @@
],
series : [
{
name: '长江现货铝均价',
name: '长江现货',
type: 'line',
data: [],
smooth: true,
@ -51,7 +51,7 @@
},
},
{
name: '国内现货铝均价',
name: '国内现货',
type: 'line',
data: [],
smooth: true,
@ -69,7 +69,7 @@
},
},
{
name: '国外现货铝均价',
name: '国外现货',
type: 'line',
data: [],
smooth: true,
@ -87,7 +87,7 @@
},
},
{
name: '伦敦铝均价',
name: '伦敦',
type: 'line',
data: [],
smooth: true,
@ -151,12 +151,20 @@
var that = this;
let serie = this.series[this.index]
let sum = 0
serie.data.forEach(n => {
sum += n
})
sum = (sum / serie.data.length).toFixed(2)
// ECharts
const option = {
backgroundColor: '#1B263B',
title: {
text: `${serie.name} ${serie.data[serie.data.length - 1].toFixed(4)}`,
text: `${serie.name} 近7日铝均价${sum} 今日铝价${serie.data[serie.data.length - 1].toFixed(2)}`,
right: '10%',
top: '10%',
textStyle: {


+ 37
- 1
pages/index/center2.vue View File

@ -10,7 +10,15 @@
<view class="headImage">
<image src="1" mode=""></image>
</view>
<view class="change"
v-if="!userInfo.id"
@click="$utils.toLogin">
登录
</view>
<view class="info"
v-else
@click="toUpdateInfo">
<view class="name"
v-if="userShop">
@ -41,9 +49,16 @@
<uv-icon name="setting" size="40rpx"></uv-icon>
</view> -->
</view>
<view class=""
style="color: #aaa;
text-align: center;line-height: 100rpx;"
v-if="!userInfo.id">
请先完成登录解锁更多功能
</view>
<!-- 供应商 -->
<view class="supplier" v-if="userShop">
<view class="supplier" v-else-if="userShop">
<centerList :list="supplierList" @open="openCustomerServicePopup" @about="$refs.popup.open('gywm')">
</centerList>
</view>
@ -185,6 +200,11 @@
],
}
},
onShow() {
if(uni.getStorageSync('token')){
this.$store.commit('getUserInfo')
}
},
methods: {
openCustomerServicePopup() {
console.log("打开客服弹框")
@ -239,6 +259,22 @@
border-radius: 50%;
margin-right: 40rpx;
}
.change {
display: flex;
align-items: center;
justify-content: center;
width: 30%;
height: 70rpx;
border-radius: 40rpx;
color: white;
font-size: 28rpx;
margin: 20rpx 10rpx 0 0;
background: $uni-color;
border: 1px solid #757986;
//margin-top: 20rpx;
border-radius: 40rpx;
}
.info {
font-size: 28rpx;


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

@ -20,7 +20,7 @@
<visualization/>
<!--报价和挂单-->
<view class="btns" v-if="userShop">
<view class="btns" v-if="userShop && userInfo.id">
<span @click="goToPage(0)" class="oneBtn">
{{ $t('other.supplierQuotation') }}
</span>
@ -40,7 +40,7 @@
import topbar from '@/components/base/topbar.vue'
import tabber from '@/components/base/tabbar.vue'
import productList from '@/components/user/productList.vue'
import { mapGetters } from 'vuex'
import { mapGetters, mapState } from 'vuex'
import changeLanguage from '@/components/base/changeLanguage.vue'
import visualization from '@/components/user/visualization.vue'
export default {
@ -75,6 +75,7 @@
},
computed: {
...mapGetters(['userShop']),
...mapState(['userInfo']),
},
methods: {


+ 8
- 5
pages/index/tradingPlatform.vue View File

@ -33,8 +33,9 @@
<view class="purchaser">
<!--切换现货/期货-->
<view class="purchaser-title" style="">
<span v-for="(item, index) in type" :class="actionIndex == index ? 'active' : 'noactive'"
@click="actionIndexChange(index)">{{ item.name }}</span>
<span v-for="(item, index) in type"
:class="actionIndex == item.value ? 'active' : 'noactive'"
@click="actionIndexChange(item.value)">{{ item.name }}</span>
</view>
<view class="productList">
<productList :list="list" @previewVideo="previewVideo"/>
@ -91,14 +92,16 @@
},
data() {
return {
actionIndex: 0,
actionIndex: 1,
mixinsListApi: 'getMyProductlist',
type: [
{
name: '国内现货'
name: '国内现货',
value : 1,
},
{
name: '国外现货'
name: '国外现货',
value : 0,
},
],
vedioUrl : '',


+ 10
- 4
pages_order/components/order/myOrderList.vue View File

@ -2,7 +2,6 @@
<view class="page">
<view v-for="(item, index) in list"
v-if="list.length>0"
:key="index"
class="content"
@click="lookDetail(item, index)">
@ -62,7 +61,7 @@
</view>
<!--无历史记录-->
<view v-else style="padding: 100rpx 0;">
<view v-if="list.length==0" style="padding: 100rpx 0;">
<uv-empty iconSize="100rpx" mode="history" textSize="28rpx" />
</view>
</view>
@ -74,7 +73,7 @@
props: {
list: {
type: Array,
default: false
default: []
},
},
data() {
@ -150,12 +149,13 @@
.left {
width: 200rpx;
height: 100%;
min-height: 200rpx;
border-radius: 10rpx;
flex-shrink: 0;
image {
width: 100%;
height: 100%;
height: 315rpx;
border-radius: 10rpx;
}
}
@ -167,6 +167,12 @@
padding-left: 20rpx;
line-height: 40rpx;
background-color: #F8F8F8;
.text-hidden-1{
overflow:hidden; //
text-overflow:ellipsis; //
white-space:nowrap; //
width: 490rpx;
}
}
}


+ 2
- 2
pages_order/components/order/orderList.vue View File

@ -1,6 +1,6 @@
<template>
<view class="page">
<view v-if="list.length>0" class="item"
<view class="item"
@click="lookDetail(item)"
v-for="(item, index) in list" :key="index">
<view class="top">
@ -75,7 +75,7 @@
</view>
<!--无历史记录-->
<view style="padding: 100rpx 0;" v-else>
<view style="padding: 100rpx 0;" v-if="list.length==0">
<uv-empty mode="history" textSize="28rpx" iconSize="100rpx" />
</view>
</view>


+ 7
- 2
pages_order/components/product/submit.vue View File

@ -19,7 +19,7 @@
</view>
</view> -->
<view class="btn"
@click="$emit('submit')">
@click="submit">
{{ submiitTitle }}
</view>
</view>
@ -40,7 +40,12 @@
}
},
methods: {
submit(){
if(!uni.getStorageSync('token')){
return this.$utils.toLogin()
}
this.$emit('submit')
},
}
}
</script>


+ 3
- 3
pages_order/order/offerOrBillLading.vue View File

@ -4,11 +4,11 @@
<navbar :title="titleList[titleIndex]" leftClick @leftClick="$utils.navigateBack" />
<view class="frame">
<view class="title">
<!-- <view class="title">
<span
style="width: 10rpx;height: 40rpx;background-color: #1f1c39;border-radius: 10rpx;overflow: hidden;"></span>
<span>{{ $t('other.aluminumProducts') }}</span>
</view>
</view> -->
<view class="basic-info">
@ -351,8 +351,8 @@
},
type : '',
productType : [
'国内现货',
'国外现货',
'国内现货',
],
}
},


+ 49
- 12
pages_order/order/orderDetail2.vue View File

@ -31,19 +31,27 @@
</view>
<!-- 商品信息 -->
<view class="line">
<view class="t min_tips">
<view class="">
商品信息
</view>
</view>
<view class="line imageAndVideo">
<view class="min_tips"
v-if="orderInfo.picDetail">
<view class="">
商品图片
</view>
<view class="">
<uv-album :urls="orderInfo.picDetail.split(',')"></uv-album>
<view class=""
style="width: 690rpx;">
<uv-swiper
:list="orderInfo.picDetail.split(',')"
indicator
:autoplay="false"
@click="index => previewFullImage(index,
orderInfo.picDetail.split(','))"
height="350rpx"></uv-swiper>
<!-- <uv-album
multipleSize="180"
:urls="orderInfo.picDetail.split(',')">
</uv-album> -->
</view>
</view>
<view class="min_tips"
@ -66,8 +74,20 @@
<view class="">
检测报告
</view>
<view class="">
<uv-album :urls="orderInfo.report.split(',')"></uv-album>
<view class=""
style="width: 690rpx;">
<uv-swiper
:list="orderInfo.report.split(',')"
indicator
:autoplay="false"
@click="index => previewFullImage(index,
orderInfo.report.split(','))"
height="350rpx"></uv-swiper>
<!-- <uv-album
multipleSize="180"
:urls="orderInfo.report.split(',')"></uv-album> -->
</view>
</view>
<view class="min_tips"
@ -191,6 +211,12 @@
this.orderInfo = res.result
})
},
previewFullImage(index, images){
uni.previewImage({
urls: images,
current: index,
})
},
//
backOrder() {
@ -230,10 +256,11 @@
display: flex;
flex-wrap: wrap;
video{
width: 480rpx;
height: 270rpx;
width: 690rpx;
height: 390rpx;
}
}
.info {
margin: 10px;
@ -509,5 +536,15 @@
}
}
}
.imageAndVideo{
.min_tips{
flex-direction: column;
align-items: flex-start;
font-size: 30rpx;
color: #000;
gap: 20rpx;
}
}
}
</style>

+ 44
- 15
pages_order/product/productDetail.vue View File

@ -7,7 +7,9 @@
v-if="productDetail.picDetail"
:list="productDetail.picDetail.split(',')"
indicator
height="350rpx"></uv-swiper>
@click="index => previewFullImage(index,
productDetail.picDetail.split(','))"
height="420rpx"></uv-swiper>
</view>
<view class="info">
@ -23,6 +25,12 @@
<!-- <image src="../static/product/like.png" mode=""></image> -->
</view>
</view>
<view class="info-line">
交货日期{{ productDetail.transactionTime }}
</view>
<view class="info-line">
提货地址{{ productDetail.address }}
</view>
<!-- <view class="tips">
<view class="tip">
专业设备
@ -58,6 +66,34 @@
<!-- <uv-parse :content="productDetail.content"></uv-parse> -->
<view class="content"
v-if="productDetail.report">
<view class="title">
检测报告
</view>
<view class=""
style="padding: 0 30rpx;">
<!-- <uv-album
multipleSize="690"
singleSize="690"
singleMode="widthFix"
multipleMode="widthFix"
:urls="productDetail.report.split(',')">
</uv-album> -->
<uv-swiper
:list="productDetail.report.split(',')"
indicator
:autoplay="false"
@click="index => previewFullImage(index,
productDetail.report.split(','))"
height="350rpx"></uv-swiper>
</view>
</view>
<view class="content"
v-if="productDetail.video">
<view class="title">
@ -73,19 +109,6 @@
</view>
</view>
<view class="content"
v-if="productDetail.report">
<view class="title">
检测报告
</view>
<view class=""
style="padding: 0 30rpx;">
<uv-album
:urls="productDetail.report.split(',')"></uv-album>
</view>
</view>
<view class="content"
v-if="productDetail.reportVideo">
<view class="title">
@ -138,7 +161,13 @@
uni.navigateTo({
url: `/pages_order/tradingPlatform/nowOrder`,
});
}
},
previewFullImage(index, images){
uni.previewImage({
urls: images,
current: index,
})
},
}
}
</script>


+ 11
- 4
store/store.js View File

@ -43,6 +43,13 @@ const store = new Vuex.Store({
}
})
api('getImagePhoneOther', res => {
if(res.code == 200){
state.customerPhone = res.result.phone
state.pic = res.result.pic
}
})
// let config = ['getPrivacyPolicy', 'getUserAgreement']
// config.forEach(k => {
// api(k, res => {
@ -83,15 +90,13 @@ const store = new Vuex.Store({
},
// 获取个人信息
getUserInfo(state){
api('getImagePhoneOther', res => {
api('getUserInfo', res => {
if(res.code == 200){
state.userInfo = res.result.my
state.customerPhone = res.result.phone
state.buy = res.result.buy
state.shopData = res.result.shop
state.pic = res.result.pic
// 如果什么身份都没有,就去注册
// if(!state.shopData && !state.buy &&
@ -121,7 +126,9 @@ const store = new Vuex.Store({
success(r) {
if(r.confirm){
state.userInfo = {}
state.role = false
state.buy = {}
state.shopData = {}
state.shop = false
uni.removeStorageSync('token')
uni.redirectTo({
url: '/pages/index/index'


+ 15
- 1
utils/utils.js View File

@ -173,6 +173,19 @@ export function redirectTo(...args){
uni.redirectTo(params(...args))
}
export const toLogin = function(){
let time = 0
return () => {
if(new Date().getTime() - time < 1000){
return
}
time = new Date().getTime()
uni.navigateTo({
url: '/pages_order/auth/loginAndRegisterAndForgetPassword'
})
}
}()
export default {
toArray,
generateUUID,
@ -185,5 +198,6 @@ export default {
navigateTo,
navigateBack,
redirectTo,
copyText
copyText,
toLogin
}

Loading…
Cancel
Save