Browse Source

对接商家中心余额页面接口,对接商家中心订单相关接口

master
邓平艺 4 years ago
parent
commit
d42832f80e
  1. 2
      common/js/config.js
  2. 10
      common/styles/iconfont.css
  3. 114
      pages/business/balance/balance.vue
  4. 27
      pages/business/center/center.vue
  5. 6
      pages/business/login/login.vue
  6. 194
      pages/business/order/list.vue

2
common/js/config.js

@ -16,7 +16,7 @@ export default {
//https://demo-guojiang-ec-api.guojiang.club/
baseUrl: process.env.NODE_ENV === 'development' ?
'http://192.168.3.165/' : 'https://v3-ec-admin-dev.guojiang.club/', // 运行时自动替换变量
'http://192.168.3.29/' : 'https://v3-ec-admin-dev.guojiang.club/', // 运行时自动替换变量
},
PACKAGES: {
activity: false,

10
common/styles/iconfont.css

@ -1,8 +1,8 @@
@font-face {
font-family: "lf-iconfont"; /* Project id 2779107 */
src: url('//at.alicdn.com/t/font_2779107_g6issu2jkr.woff2?t=1631610243868') format('woff2'),
url('//at.alicdn.com/t/font_2779107_g6issu2jkr.woff?t=1631610243868') format('woff'),
url('//at.alicdn.com/t/font_2779107_g6issu2jkr.ttf?t=1631610243868') format('truetype');
src: url('//at.alicdn.com/t/font_2779107_e1lp09zkffc.woff2?t=1632308314645') format('woff2'),
url('//at.alicdn.com/t/font_2779107_e1lp09zkffc.woff?t=1632308314645') format('woff'),
url('//at.alicdn.com/t/font_2779107_e1lp09zkffc.ttf?t=1632308314645') format('truetype');
}
.lf-iconfont {
@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-jiazai:before {
content: "\e7ba";
}
.icon-daifahuo:before {
content: "\e642";
}

114
pages/business/balance/balance.vue

@ -9,7 +9,7 @@
<text class="lf-iconfont icon-yuebao lf-font-50"></text>
</view>
<view class="point">
<text>78326478</text>
<text>{{ balance }}</text>
<text class="label">()</text>
</view>
</view>
@ -17,39 +17,33 @@
</view>
<view class="tabs">
<view class="lf-flex lf-h-100">
<view class="tab" :class="{'active-tab': current == 0}" @click="current = 0">余额明细</view>
<view class="tab" :class="{'active-tab': current == 1}" @click="current = 1">提现明细</view>
<view class="tab"
v-for="(item, index) in tab_list" :key="index"
:class="{'active-tab': current == index}"
@click="switchTab(index)">{{ item.name }}
</view>
</view>
<picker mode='date' :value="date" @change="dateChange">
<view style="width: 340rpx; text-align: right;">
<text>{{ date || '2021-09-01' }}</text>
<text>{{ date || getDay }}</text>
<text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10"></text>
</view>
</picker>
</view>
<view class="main" v-if="current == 0">
<view class="item" v-for="(item, index) in 10" :key="index">
<view class="lf-row-between">
<text class="lf-font-36 lf-color-black lf-font-bold">+80</text>
<text class="lf-font-24 lf-color-555">扫码收款</text>
</view>
<view class="lf-row-between lf-m-t-20">
<text class="lf-font-24 lf-color-555">¥374.38</text>
<text class="lf-font-24 lf-color-777">2021-09-01 18:27:58</text>
</view>
</view>
</view>
<view class="main" v-else-if="current == 1">
<view class="item" v-for="(item, index) in 10" :key="index">
<view class="main" v-for="(tabItem, tabIndex) in tab_list" :key="tabIndex"
v-if="current == tabIndex">
<view class="item" v-for="(item, index) in tabItem.list" :key="index">
<view class="lf-row-between">
<text class="lf-font-36 lf-font-bold" style="color: #F63434;">-80</text>
<text class="lf-font-24 lf-color-555">提现到支付宝[18203835380]</text>
<text class="lf-font-36 lf-color-black lf-font-bold" style="width: 70%;" v-if="item.type == 'charge'">+{{ item.balance }}</text>
<text class="lf-font-36 lf-font-bold" style="color: #F63434; width: 70%;" v-else>{{ item.balance }}</text>
<text class="lf-font-24 lf-color-555">{{ item.note }}</text>
</view>
<view class="lf-row-between lf-m-t-20">
<text class="lf-font-24 lf-color-555">¥374.38</text>
<text class="lf-font-24 lf-color-777">2021-09-01 18:27:58</text>
<text class="lf-font-24 lf-color-555">¥{{ item.current }}</text>
<text class="lf-font-24 lf-color-777">{{ item.created_at }}</text>
</view>
</view>
<lf-nocontent src="/static/images/empty.png" v-if="tabItem.list.length <= 0"></lf-nocontent>
</view>
<u-back-top :scrollTop="pageScrollTop"></u-back-top>
</view>
@ -60,15 +54,87 @@
data(){
return {
date: '',
current: 0
current: 0,
tab_list: [{
name: '余额明细',
page: 1,
isPage: true,
list: []
},{
name: '提现明细',
page: 1,
isPage: true,
list: []
}],
balance: 0
}
},
computed: {
getDay(){
return this.$shared.recordTime(new Date(), '-', 'date');
}
},
onLoad(){
this.getBalance();
},
methods: {
//
dateChange(event){
this.date = event.detail.value;
let tabItem = this.tab_list[this.current];
tabItem.page = 1;
tabItem.isPage = true;
this.getBalance();
},
// tab
switchTab(index){
this.current = index;
if(this.tab_list[index].list.length <= 0){
this.getBalance();
}
},
getBalance(){
uni.showLoading({
title: '正在查询中'
})
let token = this.$cookieStorage.get('store_token');
let tabItem = this.tab_list[this.current];
let par = {
cash: this.current,
page: tabItem.page
}
if(this.date){
par.date = this.date;
}
this.$http.get({
api: 'api/supplier/balance',
data: par,
header: {
token: token
}
}).then(res => {
if(res.data.code == 200){
let balance = res.data.data.balance;
let list = res.data.data.list;
this.balance = balance;
tabItem.isPage = this.$shared.isRight(list.next_page_url);
if(tabItem.page == 1){
tabItem.list = list.data;
}else{
tabItem.list.push(...list.data);
}
}
uni.hideLoading();
}).catch(err => uni.hideLoading());
}
},
onReachBottom(){
let tabItem = this.tab_list[this.current];
if(tabItem.isPage){
tabItem.page = tabItem.page+1;
this.getBalance();
}else{
this.$msg('没有更多啦~')
}
}
}

27
pages/business/center/center.vue

@ -7,8 +7,8 @@
<view class="bg-right"></view>
<view class="head-content">
<view class="lf-flex">
<image class="head-img" mode="aspectFill" src="https://picsum.photos/id/237/200/300"></image>
<view class="head-title lf-line-3">雅诗兰黛专卖店</view>
<image class="head-img" mode="aspectFill" :src="detail.brand.logo"></image>
<view class="head-title lf-line-3">{{ detail.brand.name }}</view>
</view>
<view class="lf-flex">
<view class="head-menu" @click="$url('/pages/business/balance/balance')">
@ -22,8 +22,8 @@
</view>
</view>
</view>
<view class="notice">
<u-notice-bar mode="vertical" type="none" :list="list"></u-notice-bar>
<view class="notice" v-if="detail.notice.length">
<u-notice-bar mode="vertical" type="none" :list="detail.notice"></u-notice-bar>
</view>
<view class="card">
<view class="lf-row-between">
@ -35,15 +35,15 @@
</view>
<view class="lf-flex lf-m-t-50">
<view class="item" :style="{width: 100 / 3 +'%'}">
<view class="num">0</view>
<view class="num">{{ detail.todo.new }}</view>
<view>待付款</view>
</view>
<view class="item" :style="{width: 100 / 3 +'%'}">
<view class="num">0</view>
<view class="num">{{ detail.todo.send }}</view>
<view>待发货</view>
</view>
<view class="item" :style="{width: 100 / 3 +'%'}">
<view class="num">0</view>
<view class="num">{{ detail.todo.pick }}</view>
<view>待提货</view>
</view>
</view>
@ -56,21 +56,21 @@
<view class="lf-flex lf-m-t-50">
<view class="item" :style="{width: 100 / 3 +'%'}">
<view class="num">
<text>0</text>
<text>{{ detail.today.pay }}</text>
<text class="lf-font-24">()</text>
</view>
<view>支付金额</view>
</view>
<view class="item" :style="{width: 100 / 3 +'%'}">
<view class="num">
<text>0</text>
<text>{{ detail.today.online }}</text>
<text class="lf-font-24">()</text>
</view>
<view>线上订单</view>
</view>
<view class="item" :style="{width: 100 / 3 +'%'}">
<view class="num">
<text>0</text>
<text>{{ detail.today.offline }}</text>
<text class="lf-font-24">()</text>
</view>
<view>线下订单</view>
@ -83,15 +83,15 @@
</view>
<view class="lf-flex lf-m-t-50">
<view class="item" :style="{width: 100 / 3 +'%'}">
<view class="num">0</view>
<view class="num">{{ detail.goods.del }}</view>
<view>销售中</view>
</view>
<view class="item" :style="{width: 100 / 3 +'%'}">
<view class="num">0</view>
<view class="num">{{ detail.goods.on_sell }}</view>
<view>待上架</view>
</view>
<view class="item" :style="{width: 100 / 3 +'%'}">
<view class="num">0</view>
<view class="num">{{ detail.goods.off_sell }}</view>
<view>已下架</view>
</view>
</view>
@ -104,7 +104,6 @@
export default {
data(){
return {
list: ['我有一只小毛驴,但我从来也不骑', '天苍苍野茫茫'],
token: '',
detail: {}
}

6
pages/business/login/login.vue

@ -109,7 +109,7 @@
.next-btn{
width: 550rpx;
height: 100rpx;
background: #15716E;
background: #0D2E9A;
border-radius: 50rpx;
line-height: 100rpx;
color: #FFFFFF;
@ -139,12 +139,12 @@
height: 64rpx;
padding: 0 4rpx;
font-size: 24rpx;
color: #15716E;
color: #0D2E9A;
display: flex;
justify-content: center;
align-items: center;
border-radius: 32rpx;
border: 2rpx solid #15716E;
border: 2rpx solid #0D2E9A;
}
.active-bg{
background: #efefef;

194
pages/business/order/list.vue

@ -7,40 +7,48 @@
<swiper :style="{height: autoHeight}" :current="tab_current" @change="swiperChange">
<swiper-item v-for="(tab_item, tab_index) in tab_list" :key="tab_index">
<scroll-view :style="{height: autoHeight}" :scroll-y="true">
<scroll-view :style="{height: autoHeight}"
:scroll-y="true"
@scrolltolower="scrolltolower"
:refresher-enabled="true"
:refresher-triggered="tab_item.isRefresher"
@refresherrefresh="refresherrefresh">
<view class="content">
<view class="card" v-for="(item, index) in 10" :key="index">
<view class="card" v-for="(item, index) in tab_item.list" :key="index">
<view class="lf-flex">
<image class="goods-img"></image>
<image class="goods-img" :src="item.items[0].item_meta.image"></image>
<view class="info">
<view class="lf-font-26 lf-color-333 lf-line-2">爱他美较大婴儿配方奶粉较大配方奶粉较2段 </view>
<view class="lf-font-26 lf-color-333 lf-line-2">{{ item.items[0].item_name }}</view>
<view class="lf-row-between" style="line-height: 1;">
<text class="lf-font-24 lf-color-777">1900g</text>
<text class="lf-font-32 lf-font-bold" style="color: #F63434;">¥385</text>
<text class="lf-font-24 lf-color-777">{{ item.payment.amount }}{{ item.items[0].item_meta.specs_text }}</text>
<text class="lf-font-32 lf-font-bold" style="color: #F63434;">¥{{ item.payment.amount_yuan }}</text>
</view>
</view>
</view>
<view class="order-num">
<view class="deliver" v-if="index == 1" @click="deliver">发货</view>
<view v-else>待付款</view>
<view style="color: #F63434;">删除订单</view>
<view class="deliver" v-if="item.status_text == '待发货'" @click="deliver(item.order_no)">发货</view>
<view v-else>{{ item.status_text }}</view>
<view style="color: #F63434;" @click="removeOrder(item.order_no, tab_index, index)">删除订单</view>
</view>
</view>
<lf-nocontent src="/static/images/empty.png" v-if="tab_item.list.length <= 0"></lf-nocontent>
</view>
</scroll-view>
</swiper-item>
</swiper>
<u-popup mode="bottom" v-model="show_deliver" :round="true" borderRadius="20">
<view class="popup-content">
<view class="title">选择物流商家</view>
<picker mode="selector" :range="columns" :value="select_index" @change="selectChange">
<view class="logistics" @click="show_logistics = true">
<text>{{ columns[select_index] || '请选择物流' }}</text>
<text class="lf-iconfont icon--1"></text>
<picker mode="selector" range-key="name" :range="columns" :value="select_index" @change="selectChange">
<view class="logistics">
<text>{{ (columns[select_index] && columns[select_index].name) || '请选择物流' }}</text>
<text class="lf-iconfont icon-jiazai load-a" v-if="logistics_load"></text>
<text class="lf-iconfont icon-xiangxia" v-else></text>
</view>
</picker>
<view class="title">订单编</view>
<input class="input" placeholder="请输入订单编号" v-model="orderNum" />
<view class="title">快递单</view>
<input class="input" placeholder="请输入快递单号" v-model="expressNum" />
<button class="btn" @click="confirm">确认发货</button>
</view>
</u-popup>
@ -54,7 +62,8 @@
page: 1,
isPage: true,
loadingClass: true,
loadingText: '正在加载中'
loadingText: '正在加载中',
isRefresher: false
}
return {
tab_current: 0,
@ -78,13 +87,13 @@
scrollH: 0,
nav_height: 0,
show_deliver: false,
columns: [
'中通快递', '申通快递', '圆通快递', '国通快递', '百世汇通快递',
'顺丰快递', '京东快递', '天猫快递', 'EMS特快'
],
columns: [],
show_logistics: false,
select_index: null,
orderNum: ''
expressNum: '',
token: '',
logistics_load: true,
click_order_no: ''
}
},
computed: {
@ -95,30 +104,155 @@
onLoad(){
let info = uni.getSystemInfoSync();
this.scrollH = info.screenHeight;
this.token = this.$cookieStorage.get('store_token');
this.getOrderList();
},
methods: {
getOrderList(options = {}){
let tabItem = this.tab_list[this.tab_current];
this.$http.get({
api: 'api/supplier/order',
data: {
status: String(this.tab_current)
},
header: {
token: this.token
}
}).then(res => {
console.log("getOrderList", res);
tabItem.isPage = this.$isRight(res.data.next_page_url);
if(options.refresher){
tabItem.isRefresher = false;
this.$msg('刷新成功', {icon: 'success'});
}
if(!tabItem.isPage){
tabItem.loadingClass = false;
tabItem.loadingText = '已加载全部数据~'
}
if(tabItem.page == 1){
tabItem.list = res.data.data.data;
}else{
tabItem.list.push(...res.data.data.data);
}
console.log("this.tab_list", this.tab_list)
})
},
tabChange(event){
this.tab_current = event;
if(this.tab_list[this.tab_current].list.length <= 0){
this.getOrderList();
}
},
swiperChange(event){
this.tab_current = event.detail.current;
if(event.detail.source){
if(this.tab_list[this.tab_current].list.length <= 0){
this.getOrderList();
}
}
},
//
getLogistics(){
this.logistics_load = true;
this.$http.get({
api: 'api/supplier/order/send_list',
data: {
order_no: this.click_order_no
},
header: {
token: this.token
}
}).then(res => {
if(res.data.code == 200){
this.logistics_load = false;
this.columns = res.data.data;
}
})
},
deliver(){
deliver(order_no){
console.log("1111111");
this.show_deliver = true;
this.click_order_no = order_no;
this.getLogistics();
},
selectChange(event){
this.select_index = event.detail.value;
console.log("event",event)
},
//
confirm(){
console.log("选择的物流:", this.columns[this.select_index] || '未选择');
console.log("订单号:", this.orderNum || '未输入');
if(this.columns[this.select_index] && this.orderNum){
if(this.columns[this.select_index] && this.expressNum){
uni.showLoading({
title: '正在提交'
})
let method_id = this.columns[this.select_index].id;
let express_no = this.expressNum;
let order_no = this.click_order_no;
this.$http.get({
api: 'api/supplier/order/send',
data: {
distribution_id: 0,
method_id: method_id,
express_no: express_no,
order_no: order_no
},
header: {
token: this.token
}
}).then(res => {
uni.hideLoading();
this.$msg('发货成功', {icon: 'success'});
this.show_deliver = false;
}).catch(err => uni.hideLoading());
}else{
this.$msg('请将信息补充完整')
}
},
//
removeOrder(order_no, parentIndex, childIndex){
uni.showModal({
title: '温馨提示',
content: '确定删除该订单吗?',
success: result => {
if(result.confirm){
this.$http.post({
api: 'api/supplier/order/delete',
data: {
order_no: order_no
},
header: {
token: this.token
}
}).then(res => {
if(res.data.code == 200){
this.$msg(res.data.data);
this.tab_list[parentIndex].list.splice(childIndex, 1);
}
})
}
}
})
},
// scroll-view
scrolltolower(){
let tabItem = this.tab_list[this.tab_current];
if(tabItem.isPage){
tabItem.page = tabItem.page+1;
this.getOrderList();
}else{
this.$msg('没有更多啦~')
}
},
//
refresherrefresh(){
let tabItem = this.tab_list[this.tab_current];
tabItem.isRefresher = true;
tabItem.page = 1;
tabItem.isPage = true;
tabItem.loadingClass = true;
tabItem.loadingText = '正在加载中';
this.getOrderList({refresher: true});
}
}
}
@ -228,6 +362,16 @@
color: #FFFFFF;
}
}
.load-a{
animation: my-load-a 2.5s infinite;
}
@keyframes my-load-a{
0%{transform: rotate(0deg);}
25%{transform: rotate(90deg);}
50%{transform: rotate(180deg);}
75%{transform: rotate(270deg);}
100%{transform: rotate(360deg);}
}
// tabs
/deep/.u-scroll-box {

Loading…
Cancel
Save