对接选择商品接口
parent
4ed701fa0f
commit
d0837aa8f7
|
|
@ -7,7 +7,6 @@ const whiteList = [
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
created() {
|
created() {
|
||||||
|
|
||||||
// 登录判断跳转
|
// 登录判断跳转
|
||||||
this.$u.routeAuth = (...args) => {
|
this.$u.routeAuth = (...args) => {
|
||||||
let url = args[0]
|
let url = args[0]
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<view class="text-txBase text-md price-text">{{goods.vip_price}}元 vip</view>
|
<view class="text-txBase text-md price-text">{{goods.vip_price}}元 vip</view>
|
||||||
<view v-if="isAdd" class="bg-hex-ef4444 text-center px-20rpx py-8rpx text-white rounded-10rpx" @click="add">添加</view>
|
<view v-if="isAdd" class="bg-hex-ef4444 text-center px-20rpx py-8rpx text-white rounded-10rpx" @click="add">添加</view>
|
||||||
<view v-else>
|
<view v-else>
|
||||||
<u-number-box :min="1" :value="goods.num">
|
<u-number-box :min="1" v-model="goods.num" @change="valChange">
|
||||||
</u-number-box>
|
</u-number-box>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -27,19 +27,16 @@
|
||||||
type:Object,
|
type:Object,
|
||||||
default:()=>{}
|
default:()=>{}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
data(){
|
|
||||||
return {
|
|
||||||
goodsItem:{},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
|
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
//添加商品
|
//添加商品
|
||||||
add(){
|
add(){
|
||||||
this.$emit('addGood',this.goods.id)
|
this.$emit('addGood',this.goods.id)
|
||||||
|
},
|
||||||
|
//商品数量改变
|
||||||
|
valChange(e){
|
||||||
|
const {value}=e
|
||||||
|
this.$emit('numChange',this.goods.id,value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,13 @@
|
||||||
<view class="flex flex-1 items-center justify-between">
|
<view class="flex flex-1 items-center justify-between">
|
||||||
<view>默认已提货量》</view>
|
<view>默认已提货量》</view>
|
||||||
<view>
|
<view>
|
||||||
<u-number-box :min="1" :max="3" :value="1">
|
<u-number-box :min="1" v-model="item.defaultNum" :max="item.num">
|
||||||
</u-number-box>
|
</u-number-box>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<GoodsItem class="px-0" />
|
<GoodsItem class="px-0" :goods="item" @numChange="numChange" />
|
||||||
<u-line v-if="list.length-1!=index" :hair-line="false" color="#c8c9cc"></u-line>
|
<u-line v-if="chooseList.length-1!=index" :hair-line="false" color="#c8c9cc"></u-line>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -39,11 +39,11 @@
|
||||||
<view class="flex items-center">
|
<view class="flex items-center">
|
||||||
<view>
|
<view>
|
||||||
合计
|
合计
|
||||||
<text class="ml-10rpx price-text text-hex-ef4444">15元</text>
|
<text class="ml-10rpx price-text text-hex-ef4444">{{totalPrice}}元</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="ml-10rpx">
|
<view class="ml-10rpx">
|
||||||
vip
|
vip
|
||||||
<text class="ml-10rpx price-text text-hex-ef4444">15元</text>
|
<text class="ml-10rpx price-text text-hex-ef4444">{{vipPrice}}元</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view @click="$u.route('/pageB/code/index')"
|
<view @click="$u.route('/pageB/code/index')"
|
||||||
|
|
@ -81,9 +81,24 @@
|
||||||
}) {
|
}) {
|
||||||
this.id = id
|
this.id = id
|
||||||
},
|
},
|
||||||
|
computed:{
|
||||||
|
//普通价格合计
|
||||||
|
totalPrice(){
|
||||||
|
const total=this.chooseList.reduce((pr, cu)=>{
|
||||||
|
return pr+cu.sell_price*cu.num
|
||||||
|
},0)
|
||||||
|
return total
|
||||||
|
},
|
||||||
|
//会员价合计
|
||||||
|
vipPrice(){
|
||||||
|
const total=this.chooseList.reduce((pr, cu)=>{
|
||||||
|
return pr+cu.vip_price*cu.num
|
||||||
|
},0)
|
||||||
|
return total
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async searchGoods() {
|
async searchGoods() {
|
||||||
this.isShow=false
|
|
||||||
const resDate = await this.$api.get(`/v1/product/products`, {
|
const resDate = await this.$api.get(`/v1/product/products`, {
|
||||||
params: {
|
params: {
|
||||||
keyword: this.keyword
|
keyword: this.keyword
|
||||||
|
|
@ -93,21 +108,32 @@
|
||||||
if (this.list.length == 0) {
|
if (this.list.length == 0) {
|
||||||
return this.$u.toast('暂未搜索到该商品')
|
return this.$u.toast('暂未搜索到该商品')
|
||||||
}
|
}
|
||||||
|
this.isShow=false
|
||||||
let goodsObj = resDate.data.length > 0 ? resDate.data[0] : {}
|
let goodsObj = resDate.data.length > 0 ? resDate.data[0] : {}
|
||||||
goodsObj.defaultNum = 1
|
goodsObj.defaultNum =1
|
||||||
goodsObj.num = 1
|
goodsObj.num = 1
|
||||||
this.goodItem = goodsObj
|
this.goodItem = goodsObj
|
||||||
console.log( this.goodItem)
|
|
||||||
},
|
},
|
||||||
//添加商品
|
//添加商品
|
||||||
addGood(e) {
|
addGood(e) {
|
||||||
const result=this.chooseList.findIndex(item=> item.id=e)
|
const result=this.chooseList.findIndex(item=> item.id==e)
|
||||||
console.log(result);
|
|
||||||
if(result==-1){
|
if(result==-1){
|
||||||
this.chooseList.unshift(this.goodItem)
|
this.chooseList.unshift(this.goodItem)
|
||||||
}else{
|
}else{
|
||||||
|
const num= this.chooseList[result].num+1
|
||||||
|
this.getUpdate(result,num)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
//商品数量改变
|
||||||
|
numChange(id,value){
|
||||||
|
const Index= this.chooseList.findIndex(item=>item.id==id)
|
||||||
|
this.getUpdate(Index,value)
|
||||||
|
},
|
||||||
|
//刷新页面
|
||||||
|
getUpdate(Index,val){
|
||||||
|
this.chooseList[Index].num=val
|
||||||
|
this.chooseList[Index].defaultNum=val
|
||||||
|
this.chooseList=[...this.chooseList]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,9 @@
|
||||||
<loading-view v-if="isFirstLoading"></loading-view>
|
<loading-view v-if="isFirstLoading"></loading-view>
|
||||||
<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
|
<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
|
||||||
:down="downOption" :up="upOption">
|
:down="downOption" :up="upOption">
|
||||||
<view class="grid grid-cols-2 gap-x-80rpx gap-y-40rpx pt-60rpx px-80rpx">
|
<view class="grid grid-cols-2 gap-x-80rpx pt-20rpx px-80rpx">
|
||||||
<view @click="$u.route('/pageB/select_product/index',{id:item.id})" class="flex items-center justify-center flex-col"
|
<view @click="$u.route('/pageB/select_product/index',{id:item.id})" class="flex items-center justify-center flex-col mt-40rpx"
|
||||||
v-for="(item,index) in dataList" :key="index">
|
v-for="(item,index) in dataList" :key="index">
|
||||||
<!-- <view class="w-240rpx h-240rpx bg-hex-367fa9 bg-opacity-60"></view> -->
|
|
||||||
<u-image class="flex-none" width="240" height="240" :src="item.image" :lazy-load="true">
|
<u-image class="flex-none" width="240" height="240" :src="item.image" :lazy-load="true">
|
||||||
</u-image>
|
</u-image>
|
||||||
<view class="mt-15rpx">{{item.title}}</view>
|
<view class="mt-15rpx">{{item.title}}</view>
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="flex flex-col w-full min-h-full">
|
<view class="flex flex-col w-full min-h-full">
|
||||||
<view class="flex-1">
|
<view class="flex-1 translate-center w-full ">
|
||||||
<view class="flex items-center justify-center py-100rpx">
|
<!-- <view class="flex items-center justify-center py-100rpx">
|
||||||
<image class="borderTop w-164rpx h-164rpx m-auto" src="/static/images/logs/logs.png" mode="aspectFill"></image>
|
<image class="borderTop w-164rpx h-164rpx m-auto" src="/static/images/logs/logs.png" mode="aspectFill"></image>
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
<view class="px-45rpx">
|
<view class="px-45rpx ">
|
||||||
|
<!-- #ifndef MP-WEIXIN -->
|
||||||
<u-form :model="form" ref="uForm" :error-type="['toast']">
|
<u-form :model="form" ref="uForm" :error-type="['toast']">
|
||||||
<u-form-item prop="phone">
|
<u-form-item prop="phone">
|
||||||
<view class="flex items-center w-full">
|
<view class="flex items-center w-full">
|
||||||
|
|
@ -26,7 +27,7 @@
|
||||||
</view>
|
</view>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
</u-form>
|
</u-form>
|
||||||
<!-- #ifndef MP-WEIXIN -->
|
|
||||||
<view class="flex justify-between mt-45rpx">
|
<view class="flex justify-between mt-45rpx">
|
||||||
<text class="text-md" @tap="$u.route('/pageA/reset_password/login', { type: 0 })">忘记密码?</text>
|
<text class="text-md" @tap="$u.route('/pageA/reset_password/login', { type: 0 })">忘记密码?</text>
|
||||||
<text class="text-md text-primary" @tap="$u.route('/pages/register/index')">注册</text>
|
<text class="text-md text-primary" @tap="$u.route('/pages/register/index')">注册</text>
|
||||||
|
|
@ -34,7 +35,7 @@
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
<view class="mt-90rpx">
|
<view class="mt-90rpx">
|
||||||
<!-- #ifdef MP-WEIXIN -->
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
<view class="login-btn" @tap="wxMpLogin"> 登录 </view>
|
<!-- <view class="login-btn" @tap="wxMpLogin"> 登录 </view> -->
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
<!-- #ifndef MP-WEIXIN -->
|
<!-- #ifndef MP-WEIXIN -->
|
||||||
<view class="login-btn" @tap="onSubmit"> 登录 </view>
|
<view class="login-btn" @tap="onSubmit"> 登录 </view>
|
||||||
|
|
@ -53,10 +54,10 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- #ifndef MP-WEIXIN -->
|
<!-- #ifndef MP-WEIXIN -->
|
||||||
<view class="py-60rpx flex items-center flex-col justify-center text-txGray">
|
<!-- <view class="py-60rpx flex items-center flex-col justify-center text-txGray">
|
||||||
<view>子春生电子商务有限公司版权所有</view>
|
<view>子春生电子商务有限公司版权所有</view>
|
||||||
<view @tap="$u.route('/pages/web_view/index', { url: 'https://beian.miit.gov.cn' })">渝ICP备2021010072号-2</view>
|
<view @tap="$u.route('/pages/web_view/index', { url: 'https://beian.miit.gov.cn' })">渝ICP备2021010072号-2</view>
|
||||||
</view>
|
</view> -->
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -92,7 +93,7 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onReady() {
|
onReady() {
|
||||||
this.$refs.uForm.setRules(this.rules);
|
// this.$refs.uForm.setRules(this.rules);
|
||||||
},
|
},
|
||||||
async onLoad({ type, phone }) {
|
async onLoad({ type, phone }) {
|
||||||
this.form.phone = phone ?? '';
|
this.form.phone = phone ?? '';
|
||||||
|
|
@ -110,17 +111,14 @@ export default {
|
||||||
|
|
||||||
//微信快捷登录
|
//微信快捷登录
|
||||||
async getPhoneNumber(e) {
|
async getPhoneNumber(e) {
|
||||||
const { encryptedData, iv } = e.detail;
|
const { code } = e.detail;
|
||||||
if(!iv) return
|
if(!code) return
|
||||||
const invite_code = uni.getStorageSync('INVITE_CODE');
|
const invite_code = uni.getStorageSync('INVITE_CODE');
|
||||||
// const code = await getWxCode();
|
// const code = await getWxCode();
|
||||||
const params = {}
|
const params = {}
|
||||||
if(!!invite_code) params.inviter_code = invite_code
|
if(!!invite_code) params.inviter_code = invite_code
|
||||||
const resData = await this.$api.post('/v1/socialite/code-bind-user/wechat-mini', {
|
const resData = await this.$api.post('/v1/wechat-mini/bind-phone', {
|
||||||
type: 'wechat-mini',
|
code:code,
|
||||||
code:this.code,
|
|
||||||
iv,
|
|
||||||
data: encryptedData,
|
|
||||||
...params
|
...params
|
||||||
});
|
});
|
||||||
this.LOGIN(resData.token);
|
this.LOGIN(resData.token);
|
||||||
|
|
|
||||||
|
|
@ -185,8 +185,9 @@
|
||||||
<view class="w-710rpx bg-white px-base m-auto rounded-xs mt-base">
|
<view class="w-710rpx bg-white px-base m-auto rounded-xs mt-base">
|
||||||
<!-- 销售端 -->
|
<!-- 销售端 -->
|
||||||
<view
|
<view
|
||||||
@tap="$u.route('/pageB/index/index')"
|
@tap="$u.routeAuth('/pageB/index/index')"
|
||||||
class="flex justify-between items-center py-base border-b border-txBorder"
|
class="flex justify-between items-center py-base border-b border-txBorder"
|
||||||
|
v-if="is_company"
|
||||||
>
|
>
|
||||||
<view class="flex items-center">
|
<view class="flex items-center">
|
||||||
<image class="w-32rpx h-32rpx" src="/static/images/user/my_account.png" mode=""></image>
|
<image class="w-32rpx h-32rpx" src="/static/images/user/my_account.png" mode=""></image>
|
||||||
|
|
@ -275,9 +276,9 @@
|
||||||
</view>
|
</view>
|
||||||
</view> -->
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
<block v-if="isLogin">
|
<!-- <block v-if="isLogin">
|
||||||
<view class="text-lg text-txBase w-710rpx h-100rpx bg-white m-auto rounded-xs mt-base text-center leading-100rpx" @tap="LogOut">退出登录</view>
|
<view class="text-lg text-txBase w-710rpx h-100rpx bg-white m-auto rounded-xs mt-base text-center leading-100rpx" @tap="LogOut">退出登录</view>
|
||||||
</block>
|
</block> -->
|
||||||
<view class="mt-40rpx">
|
<view class="mt-40rpx">
|
||||||
<view class="flex justify-center items-center">
|
<view class="flex justify-center items-center">
|
||||||
<view @tap="$u.route('/pages/web_view/index', { url: config.user_promotion_agreement })">服务协议</view>
|
<view @tap="$u.route('/pages/web_view/index', { url: config.user_promotion_agreement })">服务协议</view>
|
||||||
|
|
@ -357,6 +358,11 @@ export default {
|
||||||
order_count() {
|
order_count() {
|
||||||
return this.$store.getters.order_count ?? {};
|
return this.$store.getters.order_count ?? {};
|
||||||
},
|
},
|
||||||
|
//是否为店员
|
||||||
|
is_company(){
|
||||||
|
// return this.user?.is_company??false
|
||||||
|
return true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.$store.dispatch('user/getOrderNum');
|
this.$store.dispatch('user/getOrderNum');
|
||||||
|
|
|
||||||
|
|
@ -125,11 +125,11 @@
|
||||||
<text class="text-black">运费</text>
|
<text class="text-black">运费</text>
|
||||||
<text>¥{{ detail.shipping_fee }}</text>
|
<text>¥{{ detail.shipping_fee }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="h-50rpx leading-50rpx flex justify-between">
|
<view class="h-50rpx leading-50rpx flex justify-between" v-if="detail.coupon_discount_amount > 0">
|
||||||
<text class="text-black">优惠券</text>
|
<text class="text-black">优惠券</text>
|
||||||
<text class="text-warning">-¥{{ detail.coupon_discount_amount }}</text>
|
<text class="text-warning">-¥{{ detail.coupon_discount_amount }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="h-50rpx leading-50rpx flex justify-between">
|
<view class="h-50rpx leading-50rpx flex justify-between" v-if="detail.vip_discount_amount > 0">
|
||||||
<text class="text-black">会员优惠</text>
|
<text class="text-black">会员优惠</text>
|
||||||
<text class="text-warning">-¥{{ detail.vip_discount_amount }}</text>
|
<text class="text-warning">-¥{{ detail.vip_discount_amount }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
const getters = {
|
const getters = {
|
||||||
isLogin: state => !!state.user.token,
|
isLogin: state => !!state.user.user?.phone,
|
||||||
token: state => state.user.token,
|
token: state => state.user.token,
|
||||||
user:state => state.user.user,
|
user:state => state.user.user,
|
||||||
allaccounts:state => state.user.allaccounts,
|
allaccounts:state => state.user.allaccounts,
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ const actions = {
|
||||||
commit
|
commit
|
||||||
}) {
|
}) {
|
||||||
/* #ifdef MP-WEIXIN */
|
/* #ifdef MP-WEIXIN */
|
||||||
await http.post('/v1/socialite/unbind-user/wechat-mini')
|
//await http.post('/v1/socialite/unbind-user/wechat-mini')
|
||||||
/* #endif */
|
/* #endif */
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
http.post('/v1/logout', {}, {
|
http.post('/v1/logout', {}, {
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ page {
|
||||||
.translate-center {
|
.translate-center {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
top: 50%;
|
top: 40%;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,13 @@ export async function wxMnpLogin(){
|
||||||
|
|
||||||
|
|
||||||
async function silentLogin(data){
|
async function silentLogin(data){
|
||||||
const provider = 'wechat-mini'
|
// const provider = 'wechat-mini'
|
||||||
const resData = await http.post(`/v1/socialite/code-auth/${provider}`,data,{
|
// const resData = await http.post(`/v1/socialite/code-auth/${provider}`,data,{
|
||||||
|
// custom:{
|
||||||
|
// toast:false
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
const resData = await http.post(`/v1/wechat-mini/login`,data,{
|
||||||
custom:{
|
custom:{
|
||||||
toast:false
|
toast:false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue