From fe1ea4c1ed20b5375020b0400bee713f20a15c5c Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期一, 28 八月 2023 16:08:34 +0800
Subject: [PATCH] #
---
pages/business/saleManage/addSaleManage.vue | 261 ++++++++++++++++++++++++++++++++
pages/business/saleManage/saleManage.vue | 199 ++++++++++++++++++++++++
2 files changed, 460 insertions(+), 0 deletions(-)
diff --git a/pages/business/saleManage/addSaleManage.vue b/pages/business/saleManage/addSaleManage.vue
new file mode 100644
index 0000000..819b12c
--- /dev/null
+++ b/pages/business/saleManage/addSaleManage.vue
@@ -0,0 +1,261 @@
+<template>
+ <view>
+ <view class="container">
+ <uni-forms ref="baseForm" :modelValue="baseFormData">
+ <uni-forms-item label="椤圭洰鍚嶇О" required name="name">
+ <uni-easyinput v-model="baseFormData.name" placeholder="璇疯緭鍏ラ」鐩悕绉�" />
+ </uni-forms-item>
+ <uni-forms-item label="鎵�灞炲叕鍙�" required name="company">
+ <view @click="autoLoad('company','')">
+ <uni-combox :candidates="companies" placeholder="璇烽�夋墍灞炲叕鍙�"
+ v-model="baseFormData.company" @input="autoLoad('company',baseFormData.company)"></uni-combox>
+ </view>
+ </uni-forms-item>
+ <uni-forms-item label="鐪佸競鍖�" name="citysData">
+ <uni-data-picker @change="areaChange" placeholder="璇烽�夋嫨鐪佸競鍖�" popup-title="璇烽�夋嫨鎵�鍦ㄥ湴鍖�" :localdata="citysData" v-model="baseFormData.pcd">
+ </uni-data-picker>
+ </uni-forms-item>
+ <uni-forms-item label="璐熻矗浜�" name="director">
+ <view @click="autoLoad('user','')">
+ <uni-combox :candidates="directors" placeholder="璇烽�夋嫨璐熻矗浜�"
+ v-model="baseFormData.director" @input="autoLoad('user',baseFormData.director)"></uni-combox>
+ </view>
+ </uni-forms-item>
+ <uni-forms-item label="鐢叉柟鍗曚綅" name="cstmr">
+ <view @click="autoLoad('cstmr','')">
+ <uni-combox :candidates="cstmrs" placeholder="璇烽�夋嫨鐢叉柟鍗曚綅"
+ v-model="baseFormData.cstmr" @input="autoLoad('user',baseFormData.cstmr)"></uni-combox>
+ </view>
+ </uni-forms-item>
+ <uni-forms-item label="椤圭洰鎬婚噾棰�" name="money">
+ <uni-easyinput v-model="baseFormData.money" placeholder="璇疯緭鍏ラ」鐩�婚噾棰�" />
+ </uni-forms-item>
+ <uni-forms-item label="椤圭洰鍦板潃" name="addr">
+ <uni-easyinput v-model="baseFormData.addr" placeholder="璇疯緭鍏ラ」鐩湴鍧�" />
+ </uni-forms-item>
+
+ <uni-forms-item label="澶囨敞" name="remarks">
+ <uni-easyinput type="textarea" v-model="baseFormData.remarks" placeholder="璇疯緭鍏ュ娉�" />
+ </uni-forms-item>
+ </uni-forms>
+ <button type="primary" @click="addCstmr()">娣诲姞</button>
+ </view>
+ </view>
+</template>
+
+<script>
+ import test from '../../../static/js/citys-data.js'
+ export default {
+ data() {
+ return {
+ cstmrTypes: [],
+ cstmrType: '',
+ companies: [],
+ company: '',
+ directors: [],
+ director: '',
+ cstmrs: [],
+ cstmr: '',
+ cstmrTypeList: [],
+ directorList: [],
+ baseFormData: {
+ citysData: [],
+ cstmrType: '',
+ company: '',
+ director: '',
+ rela: '',
+ remarks: '',
+ cstmr: ''
+ },
+ rules: {
+ name: {
+ rules: [{
+ required: true,
+ errorMessage: '璇峰~鍐欏鎴峰悕绉�',
+ }]
+ },
+ rela: {
+ rules: [{
+ required: false,
+ errorMessage: '璇峰~鍐欏鎴峰悕绉�',
+ }]
+ },
+ cstmrType: {
+ rules: [{
+ required: true,
+ errorMessage: '璇烽�夋嫨瀹㈡埛绫诲埆',
+ }]
+ },
+ company: {
+ rules: [{
+ required: true,
+ errorMessage: '璇烽�夋墍灞炲叕鍙�',
+ }]
+ },
+ type: {
+ rules: [{
+ required: true,
+ errorMessage: '璇烽�夋嫨鍖哄垎',
+ }]
+ },
+ tel: {
+ rules: [{
+ required: true,
+ errorMessage: '璇疯緭鍏ョ數璇濆彿鐮�',
+ }]
+ },
+ contacts: {
+ rules: [{
+ required: true,
+ errorMessage: '璇疯緭鍏ュ鎴疯仈绯讳汉',
+ }]
+ },
+ remarks: {
+ rules: [{
+ required: false,
+ errorMessage: '璇疯緭鍏ュ鎴疯仈绯讳汉',
+ }]
+ }
+ },
+ // 鍗曢�夋暟鎹簮
+ type$: [{
+ text: '鍐呴攢',
+ value: 1
+ }, {
+ text: '澶栭攢',
+ value: 2
+ }],
+ citysData: [],
+ citysDataTemp: ''
+ }
+ },
+ onReady() {
+ // 闇�瑕佸湪onReady涓缃鍒�
+ this.$refs.baseForm.setRules(this.rules)
+ },
+ onShow() {
+ // 鑾峰彇鐪佸競鍖�
+ this.citysData = test.citysData
+ this.autoLoad('company','')
+ this.autoLoad('user','')
+ },
+ methods: {
+ bindPickerChange: function(e) {
+ this.cstmrTypeIndex = e.detail.value
+ this.baseFormData.cstmrType = this.cstmrTypes[e.detail.value].id
+ },
+ areaChange(e) {
+ this.citysDataTemp = e.detail.value[0].value + ',' + e.detail.value[1].value + ',' + e.detail.value[2].value
+ },
+ autoLoad(type,condition) {
+ let that = this
+ that.cstmrTypes = []
+ that.companies = []
+ that.directors = []
+ that.directorList = []
+ that.cstmrs = []
+ var a = that.baseUrl + '/' + type + 'Query/auth'
+ uni.request({
+ url: that.baseUrl + '/' + type + 'Query' +'/auth',
+ header:{'token':uni.getStorageSync('token')},
+ data: {condition:condition},
+ method: 'GET',
+ success(result) {
+ var res = result.data
+ if (res.code === 200) {
+ var element;
+ if (type == 'cstmrType') {
+ for(element of res.data) {
+ that.cstmrTypes.push(element.value)
+ that.cstmrTypeList.push(element)
+ }
+ return
+ }
+ if (type == 'user') {
+ for(element of res.data) {
+ that.directors.push(element.value)
+ that.directorList.push(element)
+ }
+ return
+ }
+ if (type == 'company') {
+ for (element of res.data) {
+ that.companies.push(element.name)
+
+ }
+ return
+ }
+ if (type == 'cstmr') {
+ for (element of res.data) {
+ that.cstmrs.push(element.value)
+
+ }
+ return
+ }
+
+ }
+ }
+ })
+ },
+ // 娣诲姞鐢ㄦ埛
+ addCstmr() {
+ let that = this
+ var element;
+ for (element of that.directorList) {
+ if(element.value == that.baseFormData.director) {
+ that.baseFormData.director = element.id
+ }
+ }
+ for (element of that.cstmrTypeList) {
+ if(element.value == that.baseFormData.cstmrType) {
+ that.baseFormData.cstmrType = element.id
+ }
+ }
+ this.$refs.baseForm.validate().then(res=>{
+ if (res.rela == undefined) {
+ res.rela = ''
+ }
+ if(res.remarks == undefined) {
+ res.remarks = ''
+ }
+ res.pcd = this.citysDataTemp
+ uni.request({
+ url: that.baseUrl + '/cstmr/add/auth',
+ header:{
+ 'token':uni.getStorageSync('token'),
+ 'content-type':'application/x-www-form-urlencoded',
+ },
+ data: res,
+ method: 'POST',
+ success(result) {
+ var res = result.data
+ if (res.code === 200) {
+ uni.navigateBack()
+ } else if (res.code === 403) {
+ uni.showToast({title: res.msg, icon: "none", position: 'top'})
+ setTimeout(() => {
+ uni.reLaunch({
+ url: '../../login/login'
+ });
+ }, 1000);
+ } else {
+ uni.showToast({title: res.msg, icon: "none",position: 'top'})
+ }
+ }
+ })
+ }).catch(err =>{
+ })
+ }
+ }
+
+ }
+</script>
+
+<style>
+ .container {
+ min-height: 50rpx;
+ padding: 15px;
+ background-color: #fff;
+ /* background-color: aqua; */
+ }
+</style>
\ No newline at end of file
diff --git a/pages/business/saleManage/saleManage.vue b/pages/business/saleManage/saleManage.vue
new file mode 100644
index 0000000..fa9ef39
--- /dev/null
+++ b/pages/business/saleManage/saleManage.vue
@@ -0,0 +1,199 @@
+<template>
+ <view>
+ <!-- 鎼滅储妗� -->
+ <view class="search-bg">
+ <uni-search-bar placeholder="瀹㈡埛浠e彿/鍚嶇О" bgColor="#f4f4f4" @confirm="search" />
+ </view>
+ <view>
+ <!-- 瀹㈡埛鍒楄〃 -->
+ <view class="c-list" @click="getDetails(item.id)" v-for="(item,index) in csmtrList" :key="index">
+ <view class="titles">
+ <y-title :title="item.name"></y-title>
+ </view>
+ <view style="display: grid;grid-template-columns: 1fr 3fr;">
+ <view class="list-item1">瀹㈡埛浠e彿</view><view class="list-item2">{{item.uuid}}</view>
+ <view class="list-item1">璇︾粏鍦板潃</view><view class="list-item2">{{item.addr}}</view>
+ <view class="list-item1">鐢佃瘽</view><view class="list-item2">{{item.tel}}</view>
+ <view class="list-item1">澶囨敞</view><view class="list-item2">{{item.remarks ? item.remarks : '--'}}</view>
+ <view class="list-item1">瀹㈡埛绫诲埆</view><view class="list-item2">{{item.cstmrType$}}</view>
+ <view class="list-item1">鍒涘缓浜�</view><view class="list-item2">{{item.createBy$}}</view>
+ <view class="list-item1">鍒涘缓鏃堕棿</view><view class="list-item2">{{item.createTime$}}</view>
+ </view>
+ </view>
+ </view>
+ <uni-load-more :status="status" :icon-size="16" :content-text="contentText" />
+ </view>
+</template>
+
+<script>
+ export default {
+ data() {
+ return {
+ csmtrList: [],
+ last_id: '',
+ reload: false,
+ status: 'more',
+ curr:2,
+ contentText: {
+ contentdown: '涓婃媺鍔犺浇鏇村',
+ contentrefresh: '鍔犺浇涓�',
+ contentnomore: '娌℃湁鏇村'
+ },
+
+ }
+ },
+ // 鏂板缓鎸夐挳浜嬩欢
+ onNavigationBarButtonTap(e) {
+ uni.navigateTo({
+ url:'/pages/business/saleManage/addSaleManage',
+ })
+
+ },
+ onLoad() {
+
+ },
+ onShow() {
+ setTimeout(()=> {
+ this.getCsmtr1()
+ },500)
+ },
+ onReachBottom() {
+ this.status = 'more';
+ this.getCsmtr()
+ },
+ methods: {
+ getCsmtr1(e) {
+ let that = this
+ that.csmtrList = []
+ uni.request({
+ url: that.baseUrl + '/cstmr/page/auth',
+ header: {'token' : uni.getStorageSync('token'),},
+ data: {curr:1,limit:4},
+ method:'GET',
+ success(result) {
+ if (result.statusCode === 404) {
+ uni.showToast({title: '璇烽噸鏂扮櫥褰�', icon: "none", position: 'top'})
+ return
+ }
+ var res = result.data
+ if (res.code === 200) {
+ let list = res.data.records
+ that.csmtrList = that.reload ? list : that.csmtrList.concat(list);
+ if (res.data.records.length == 0) {
+ that.status = 'noMore'
+ }
+ } else if (res.code === 403) {
+ uni.showToast({title: res.msg, icon: "none", position: 'top'})
+ setTimeout(() => {
+ uni.reLaunch({
+ url: '../../login/login'
+ });
+ }, 1000);
+ } else {
+ uni.showToast({title: res.msg, icon: "none",position: 'top'})
+ }
+ },
+ fail(result) {
+ uni.showToast({title: '璇锋眰澶辫触'})
+ setTimeout(() => {
+ uni.reLaunch({
+ url: '../../login/login'
+ });
+ }, 1000);
+ },
+ })
+ },
+ getCsmtr() {
+ let that = this
+ uni.request({
+ url: that.baseUrl + '/cstmr/page/auth',
+ header: {'token' : uni.getStorageSync('token'),},
+ data: {curr:that.curr,limit:4},
+ method:'GET',
+ success(result) {
+ if (result.statusCode === 404) {
+ uni.showToast({title: '璇烽噸鏂扮櫥褰�', icon: "none", position: 'top'})
+ return
+ }
+ var res = result.data
+ if (res.code === 200) {
+ let list = res.data.records
+ that.csmtrList = that.reload ? list : that.csmtrList.concat(list);
+ that.curr = that.curr + 1
+ if (res.data.records.length == 0) {
+ that.status = 'noMore'
+ }
+ } else if (res.code === 403) {
+ uni.showToast({title: res.msg, icon: "none", position: 'top'})
+ setTimeout(() => {
+ uni.reLaunch({
+ url: '../../login/login'
+ });
+ }, 1000);
+ } else {
+ uni.showToast({title: res.msg, icon: "none",position: 'top'})
+ }
+ },
+ fail(result) {
+ uni.showToast({title: '璇锋眰澶辫触'})
+ setTimeout(() => {
+ uni.reLaunch({
+ url: '../../login/login'
+ });
+ }, 1000);
+ },
+ })
+ },
+ getDetails(id) {
+ uni.navigateTo({
+ url: '/pages/business/cstmr/cstmrDetails?id=' + id
+ })
+ },
+ // ---
+ search() {
+
+ }
+ }
+ }
+</script>
+
+<style>
+ .c-list {
+ width: 96%;
+ min-height: 100rpx;
+ background-color: #fff;
+ border-radius: 10rpx;
+ margin: 20rpx 2% 0 2%;
+ display: flex;
+ flex-direction: column;
+ font-size: 24rpx;
+ }
+ /* 鐖秜iew 鎹� scroll-view */
+ .c-list:last-child {
+ margin-bottom: 20px;
+ }
+ .list-item1 {
+
+ height: 45rpx;
+ line-height: 45rpx;
+ color: #909399;
+ text-indent: 30rpx;
+ }
+ .list-item2 {
+ height: 45rpx;
+ line-height: 45rpx;
+ color: black;
+ }
+ .titles {
+ padding-left: 10rpx;
+ text-indent: 5rpx;
+ margin-top: 10rpx;
+ }
+ /* .title {
+ height: 60rpx;
+ line-height: 70rpx;
+ font-size: 28rpx;
+ font-weight: 900;
+ color: #303133;
+ } */
+</style>
\ No newline at end of file
--
Gitblit v1.9.1