master
yujialong 3 years ago
parent c607d0b894
commit 9c5e42e25b
  1. 4
      apis/modules/client.js
  2. 6
      apis/modules/parner.js
  3. 2
      apis/request.js
  4. 2
      config/request.js
  5. 18
      pages.json
  6. 5
      pages/clientDetail/clientDetail.vue
  7. 37
      pages/invite/invite.vue
  8. 201
      pages/ordered/ordered.vue
  9. 2
      pages/orders/orders.vue

@ -32,3 +32,7 @@ export const addCustomer = (data) => {
export const updateCustomer = (data) => {
return post('nakadai/nakadai/customer/updateCustomer', data)
}
export const getProductsSubscribedByCustomers = (data) => {
return get('nakadai/nakadai/customer/getProductsSubscribedByCustomers', data)
}

@ -0,0 +1,6 @@
import request from '@/apis/request.js'
const { get, post } = request
export const savePartnerAccount = (data) => {
return post('nakadai/partnerAccount/savePartnerAccount', data)
}

@ -12,7 +12,7 @@ const request = options => {
})
}
const header = Object.assign({}, config.headers, {
token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyIiwiaWF0IjoxNjUyMzIxMzkwLCJleHAiOjE2NTIzNjQ1OTAsImFjY291bnRJZCI6IjEifQ.TbdyqfODzJngOzLavF3Pb79eGzhuiCDeviRbj8ClU30'
token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyIiwiaWF0IjoxNjUzMDEyOTQ1LCJleHAiOjE2NTMwNTYxNDUsImFjY291bnRJZCI6IjEifQ.wlon-ETOzb3GvveRnetICH5Joa4u7XzaywGcDEbfqtU'
})
return new Promise((resolve, reject)=>{
uni.request({

@ -5,7 +5,7 @@
*/
export default {
baseURL: 'http://39.108.250.202:9000/',
baseURL: 'http://192.168.31.137:9000/',
headers: {
'Content-Type': 'application/json;charset=UTF-8'
},

@ -1,5 +1,13 @@
{
"pages": [
{
"path" : "pages/invite/invite",
"style" :
{
"navigationBarTitleText": "加入团队",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/clients/clients",
"style" :
@ -32,14 +40,6 @@
"enablePullDownRefresh": false
}
},
{
"path" : "pages/invite/invite",
"style" :
{
"navigationBarTitleText": "加入团队",
"enablePullDownRefresh": false
}
},
{
"path" : "pages/addStaff/addStaff",
"style" :
@ -122,7 +122,7 @@
"path" : "pages/ordered/ordered",
"style" :
{
"navigationBarTitleText": "产品订阅",
"navigationBarTitleText": "已订阅产品",
"enablePullDownRefresh": false
}

@ -62,7 +62,7 @@
<uni-icons class="icon" custom-prefix="iconfont" type="icon-edit" size="20" color="#959595"></uni-icons>
<view class="text">编辑</view>
</view>
<view class="item" @click="toPage('../ordered/ordered')">
<view class="item" @click="toPage(`../ordered/ordered?customerId=${customerId}`)">
<uni-icons class="icon" custom-prefix="iconfont" type="icon-product" size="20" color="#959595"></uni-icons>
<view class="text">已订阅产品</view>
</view>
@ -276,9 +276,10 @@
this.$util.to(path)
},
//
submit(ref) {
submit() {
const refs = this.$refs
const { form } = this
// inputv-modelbuginputref
form.name = refs.nameInput.val
form.account = refs.accountInput.val
form.position = refs.positionInput.val

@ -8,28 +8,29 @@
<view class="des">或然科技城市合伙人计划</view>
<view class="des">加入并自动为你创建一个团队群组</view>
<view class="input">
<uni-easyinput v-model="form.contact" placeholder="请填写你的真实姓名" :clearable="false" />
<uni-easyinput v-model="form.userName" placeholder="请填写你的真实姓名" :clearable="false" />
</view>
<view class="input">
<uni-easyinput v-model="form.contact" placeholder="请填写你的手机号" :clearable="false" />
<uni-easyinput v-model="form.phone" placeholder="请填写你的手机号" :clearable="false" />
</view>
<view class="input code-wrap">
<uni-easyinput class="code" v-model="form.contact" placeholder="验证码" :clearable="false" />
<uni-easyinput class="code" v-model="form.code" placeholder="验证码" :clearable="false" />
<view class="send-code" @click="sendCode" :disabled="codeDisabled">{{ btnText }}</view>
</view>
<button class="submit" type="primary" @click="submit('valiForm')">立即加入</button>
<button class="submit" type="primary" size="10" @click="submit">立即加入</button>
</view>
</view>
</template>
<script>
import { savePartnerAccount } from '@/apis/modules/parner.js'
export default {
data() {
return {
form: {
name: '',
provience: '',
city: '',
userName: '',
phone: '',
code: '',
},
codeDisabled: false,
phoneTimer: null,
@ -41,15 +42,17 @@
},
methods: {
submit(ref) {
this.$refs[ref].validate().then(res => {
console.log('success', res);
uni.showToast({
title: `校验通过`
})
}).catch(err => {
console.log('err', err);
})
//
submit() {
const { userName, phone } = this.form
if (!userName) return this.$util.errMsg('请输入姓名!')
if (!phone) return this.$util.errMsg('请输入手机号!')
savePartnerAccount(this.form).then(res => {
this.$util.sucMsg('加入成功')
setTimeout(() => {
// uni.navigateBack()
}, 1500)
}).catch(res => {})
},
//
phoneCountdown() {
@ -70,7 +73,7 @@
}
},
//
sendPhoneCode(bind) {
sendCode() {
const { phone } = this.form
if (!phone) return this.$util.errMsg('请填写手机号!')
if (!/^1[3456789]\d{9}$/.test(phone) && !/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(phone)) return this.$util.errMsg('请填写正确的手机号!')

@ -1,8 +1,11 @@
<template>
<view>
<view class="top">
<uni-search-bar class="search" radius="5" placeholder="请输入产品名称" clearButton="auto" cancelButton="none" @confirm="search" />
<uni-icons class="icon" custom-prefix="iconfont" type="icon-filter" size="18" color="#007eff"></uni-icons>
<uni-card :is-shadow="false" :border="false" padding="0" is-full>
<uni-search-bar class="search" radius="5" placeholder="请输入产品名称" clearButton="auto" cancelButton="none" v-model="keyword" />
</uni-card>
<view class="filter">
<sl-filter :independence="true" :menuList="menuList" @result="result"></sl-filter>
</view>
<ul class="tab">
@ -10,7 +13,7 @@
</ul>
<ul class="list">
<li @click="toDetail">
<li v-for="item in list" @click="toDetail">
<view class="line thead">
<view class="text">产品名称</view>
<view class="text">起止日期</view>
@ -18,10 +21,10 @@
<view class="text">产品状态</view>
</view>
<view class="line tbody">
<view class="text">数据平台</view>
<view class="text">2022-01-01 ~ 2022-02-02</view>
<view class="text uni-success">生效</view>
<view class="text uni-error">禁用</view>
<view class="text">{{ item.productName }}</view>
<view class="text">{{ item.startAndEndTime }}</view>
<view class="text uni-success">{{ item.status }}</view>
<view class="text uni-error">{{ item.isEnable }}</view>
</view>
</li>
</ul>
@ -29,14 +32,59 @@
</template>
<script>
import { getProductsSubscribedByCustomers } from '@/apis/modules/client.js'
import slFilter from '@/components/sl-filter/sl-filter.vue'
export default {
data() {
return {
curTab: 0,
customerId: '',
menuList: [
{
'title': '订阅状态',
'detailTitle': '请选择订阅状态',
'key': 'orderStatus',
'isMutiple': false,
'detailList': [
{
'title': '全部',
'value': ''
},
{
'title': '生效',
'value': 1
},
{
'title': '过期',
'value': 2
}
]
},
{
'title': '产品状态',
'detailTitle': '请选择产品状态',
'key': 'productStatus',
'isMutiple': false,
'detailList': [
{
'title': '全部',
'value': ''
},
{
'title': '启用',
'value': 1
},
{
'title': '禁用',
'value': 2
}
]
}
],
curTab: '',
tabs: [
{
name: '全部',
id: 0
id: ''
},
{
name: '实训课程',
@ -44,44 +92,137 @@
},
{
name: '理论课程',
id: 2
id: 0
},
{
name: '数据产品',
id: 3
}
]
],
searchTimer: null,
orderStatus: '',
productStatus: '',
keyword: '',
list: [],
listAll: [],
page: 1,
pageSize: 10
}
},
components: {
slFilter
},
watch: {
keyword () {
clearTimeout(this.searchTimer)
this.searchTimer = setTimeout(() => {
this.filter()
}, 500)
}
},
//
onPullDownRefresh() {
this.getList()
setTimeout(() => {
uni.stopPullDownRefresh()
}, 1500)
},
onShow() {
const pages = getCurrentPages()
this.customerId = pages[pages.length - 1].options.customerId
this.getList()
},
methods: {
search(res) {
uni.showToast({
title: '搜索:' + res.value,
icon: 'none'
})
getList() {
getProductsSubscribedByCustomers({
customeId: this.customerId
}).then(({ data }) => {
const { tabs } = this
data.map(e => {
const list = e.startAndEndTimeList
let connect = true //
list.map((n, i) => {
//
if (i) {
if (new Date(n.startTime).getTime() - 86400000 !== new Date(list[i - 1].endTime).getTime()) connect = false
}
})
//
const now = Date.now()
if (now < list[0].startTime) {
e.startTime = list[0].startTime
e.endTime = connect ? list[list.length - 1].endTime : list[0].endTime
e.status = '未生效'
} else if (now > list[list.length - 1].endTime) {
e.status = '已过期'
} else {
//
if (connect) {
e.startTime = list[0].startTime
e.endTime = list[list.length - 1].endTime
e.status = '生效中'
e.orderEnable = list[0].isEnable
} else {
for (const i in list) {
const n = list[i]
if (now >= new Date(n.startTime).getTime() && now <= new Date(n.endTime).getTime()) {
//
e.startTime = n.startTime
e.endTime = n.endTime
e.status = '生效中'
e.orderEnable = n.isEnable
break
} else if (i && now > new Date(list[i - 1].endTime).getTime() && now < new Date(n.startTime).getTime()) {
//
e.startTime = n.startTime
e.endTime = n.endTime
e.status = '未生效'
e.orderEnable = n.isEnable
break
}
}
}
}
const date = new Date()
date.setHours(0)
date.setMinutes(0)
date.setSeconds(0)
e.startAndEndTime = e.startTime + ' ~ ' + e.endTime
// 1 0
e.isEnable = (e.status === '已过期' || !e.orderEnable) ? '禁用' : '启用'
})
this.list = data
this.listAll = data
}).catch(e => {})
},
//
filter() {
const list = this.listAll
const { orderStatus, productStatus, keyword, curTab } = this
this.list = list.filter(e => (orderStatus === '' || ((orderStatus === 2 && e.status === '已过期') || (orderStatus === 1 && e.status === '生效中'))) && (productStatus === '' || ((productStatus === 2 && e.isEnable === '禁用') || (productStatus === 1 && e.isEnable === '启用'))) && e.productName.includes(keyword) && (curTab === '' || (curTab === e.productType)))
},
//
result(val) {
this.orderStatus = val.orderStatus || ''
this.productStatus = val.productStatus || ''
this.filter()
},
// tab
tabChange(tab) {
this.curTab = tab.id
this.filter()
},
//
toDetail() {
this.$util.to('../clientDetail/clientDetail')
toDetail(item) {
this.$util.to(`../clientDetail/clientDetail?customerId=${item.customerId}&show=1`)
}
}
}
</script>
<style scoped lang="scss">
.top {
display: flex;
align-items: center;
padding: 5px 15px 5px 5px;
.filter {
margin-bottom: 10px;
background-color: #fff;
.search {
flex: 1;
}
}
.list {
background-color: #fff;
@ -95,9 +236,13 @@
margin-bottom: 10px;
}
.text {
width: 25%;
width: 30%;
font-size: 14px;
&:first-child {
margin-right: 10px;
}
&:nth-child(3), &:last-child {
width: 20%;
text-align: center;
}
}

@ -5,7 +5,7 @@
</ul>
<uni-card :is-shadow="false" :border="false" padding="0" is-full>
<uni-search-bar class="search" radius="5" placeholder="请输入姓名、订单号" clearButton="auto" cancelButton="none" @confirm="search" />
<uni-search-bar class="search" radius="5" placeholder="请输入姓名、订单号" clearButton="auto" cancelButton="none" />
</uni-card>
<view class="filter">

Loading…
Cancel
Save