Commit a07810777ccd3894dcf9fb04edd2b3c5fd000596

Authored by 史婷婷
1 parent 35c8e73f

feat: 开发管理-编辑&详情&取消&详情按钮组件&全局样式

@@ -81,9 +81,9 @@ export default { @@ -81,9 +81,9 @@ export default {
81 right: 0; 81 right: 0;
82 bottom: 0; 82 bottom: 0;
83 background: #fff; 83 background: #fff;
84 - padding: 16rpx 24rpx; 84 + padding: 32rpx;
85 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.03); 85 box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.03);
86 - padding-bottom: calc(16rpx + env(safe-area-inset-bottom)); 86 + padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
87 display: flex; 87 display: flex;
88 align-items: center; 88 align-items: center;
89 gap: 24rpx; 89 gap: 24rpx;
@@ -106,16 +106,26 @@ export default { @@ -106,16 +106,26 @@ export default {
106 106
107 .action-button { 107 .action-button {
108 text-align: center; 108 text-align: center;
109 - padding: 20rpx 0; 109 + height: 80rpx;
  110 + line-height: 80rpx;
110 border-radius: 12rpx; 111 border-radius: 12rpx;
111 white-space: nowrap; 112 white-space: nowrap;
112 overflow: hidden; 113 overflow: hidden;
113 text-overflow: ellipsis; 114 text-overflow: ellipsis;
114 } 115 }
115 116
116 - .action-button--outline { border: 2rpx solid $theme-primary; color: $theme-primary; background: #fff; }  
117 - .action-button--primary { border: 2rpx solid $theme-primary; background: $theme-primary; color: #fff; }  
118 - .action-button--danger { border: 2rpx solid #ff4d4f; background: #ff4d4f; color: #fff; } 117 + .action-button--outline {
  118 + border: 2rpx solid $theme-primary; color: $theme-primary; background: #fff;
  119 + line-height: 78rpx;
  120 + }
  121 + .action-button--primary {
  122 + border: 2rpx solid $theme-primary; background: $theme-primary; color: #fff;
  123 + line-height: 78rpx;
  124 + }
  125 + .action-button--danger {
  126 + border: 2rpx solid #ff4d4f; background: #ff4d4f; color: #fff;
  127 + line-height: 78rpx;
  128 + }
119 .is-disabled { opacity: 0.5; } 129 .is-disabled { opacity: 0.5; }
120 130
121 .popover-mask { 131 .popover-mask {
@@ -61,7 +61,14 @@ @@ -61,7 +61,14 @@
61 "navigationBarBackgroundColor": "#ffffff", 61 "navigationBarBackgroundColor": "#ffffff",
62 "navigationBarTextStyle": "black" 62 "navigationBarTextStyle": "black"
63 } 63 }
64 - }, { 64 + }, {
  65 + "path": "pages/dev_manage/modify",
  66 + "style": {
  67 + "navigationBarTitleText": "编辑客户开发",
  68 + "navigationBarBackgroundColor": "#ffffff",
  69 + "navigationBarTextStyle": "black"
  70 + }
  71 + }, {
65 "path": "pages/dev_manage/add", 72 "path": "pages/dev_manage/add",
66 "style": { 73 "style": {
67 "navigationBarTitleText": "新增客户开发", 74 "navigationBarTitleText": "新增客户开发",
@@ -45,15 +45,15 @@ @@ -45,15 +45,15 @@
45 </view> 45 </view>
46 </view> 46 </view>
47 </scroll-view> 47 </scroll-view>
48 - <detail-buttons :buttons="buttons" @click="handleButtonClick" /> 48 + <detail-buttons :buttons="displayButtons" @click="handleButtonClick" />
49 </view> 49 </view>
50 </template> 50 </template>
51 51
52 <script> 52 <script>
53 - import {  
54 - getDetailApi,  
55 - statusOptions  
56 - } from '@/api/devManage.js' 53 + import {
  54 + getDetailApi,
  55 + cancelApi
  56 + } from '@/api/devManage.js'
57 import { 57 import {
58 getDicName 58 getDicName
59 } from '@/utils/dic.js' 59 } from '@/utils/dic.js'
@@ -67,62 +67,75 @@ @@ -67,62 +67,75 @@
67 components: { 67 components: {
68 DetailButtons 68 DetailButtons
69 }, 69 },
70 - data() {  
71 - return {  
72 - form: {  
73 - workshop: {},  
74 - office: {},  
75 - customer: {},  
76 - customerType: '',  
77 - chargeUserId: '',  
78 - chargeUserIdName: '',  
79 - productVariety: {},  
80 - monthlyUsage: '',  
81 - targetQuantity: '',  
82 - industry: '',  
83 - mark: '',  
84 - thickness: '',  
85 - width: '',  
86 - materialRequire: '',  
87 - qualityRequire: '',  
88 - peer: '',  
89 - pricingMode: '',  
90 - settleDays: '',  
91 - createTime: '',  
92 - status: ''  
93 - },  
94 - customerTypeOptions: [],  
95 - buttons: [{  
96 - text: '编辑',  
97 - visible: true,  
98 - variant: 'outline',  
99 - event: 'edit',  
100 - style: {  
101 - color: 'red',  
102 - border: '2rpx dashed #2979ff'  
103 - }  
104 - },  
105 - {  
106 - text: '审核详情',  
107 - visible: true,  
108 - variant: 'outline',  
109 - event: 'auditDetail'  
110 - },  
111 - {  
112 - text: '审核',  
113 - visible: true,  
114 - variant: 'danger',  
115 - event: 'audit'  
116 - },  
117 - {  
118 - text: '取消',  
119 - visible: true,  
120 - variant: 'outline',  
121 - event: 'cancel'  
122 - }  
123 - ],  
124 - }  
125 - }, 70 + data() {
  71 + return {
  72 + form: {
  73 + workshop: {},
  74 + office: {},
  75 + customer: {},
  76 + customerType: '',
  77 + chargeUserId: '',
  78 + chargeUserIdName: '',
  79 + productVariety: {},
  80 + monthlyUsage: '',
  81 + targetQuantity: '',
  82 + industry: '',
  83 + mark: '',
  84 + thickness: '',
  85 + width: '',
  86 + materialRequire: '',
  87 + qualityRequire: '',
  88 + peer: '',
  89 + pricingMode: '',
  90 + settleDays: '',
  91 + createTime: '',
  92 + status: ''
  93 + },
  94 + customerTypeOptions: [],
  95 + todoType: '',
  96 + buttons: [{
  97 + text: '编辑',
  98 + visible: true,
  99 + variant: 'outline',
  100 + event: 'edit',
  101 + },
  102 + {
  103 + text: '审核详情',
  104 + visible: true,
  105 + variant: 'outline',
  106 + event: 'auditDetail'
  107 + },
  108 + {
  109 + text: '审核',
  110 + visible: true,
  111 + variant: 'primary',
  112 + event: 'audit'
  113 + },
  114 + {
  115 + text: '取消',
  116 + visible: true,
  117 + variant: 'outline',
  118 + event: 'cancel',
  119 + style: {
  120 + color: 'rgba(0,0,0,0.9)',
  121 + border: '1px solid #DCDCDC'
  122 + }
  123 + }
  124 + ],
  125 + }
  126 + },
  127 + computed: {
  128 + displayButtons() {
  129 + const s = Number(this.form && this.form.status || 0)
  130 + const t = this.todoType || ''
  131 + return [
  132 + { ...this.buttons[0], visible: (s === 3 && t === '') },
  133 + { ...this.buttons[1] },
  134 + { ...this.buttons[2], visible: (s === 1 && t === 'WAIT') },
  135 + { ...this.buttons[3], visible: (s === 3 && t === '') }
  136 + ]
  137 + }
  138 + },
126 created() { 139 created() {
127 this.loadCustomerTypeOptions() 140 this.loadCustomerTypeOptions()
128 }, 141 },
@@ -132,10 +145,12 @@ @@ -132,10 +145,12 @@
132 onUnload() { 145 onUnload() {
133 uni.$off('dev_manage_detail_reload', this.onReload) 146 uni.$off('dev_manage_detail_reload', this.onReload)
134 }, 147 },
135 - onLoad(query) {  
136 - const id = (query && (query.id || query.code)) || ''  
137 - if (id) this.loadDetail(id)  
138 - }, 148 + onLoad(query) {
  149 + const id = (query && (query.id || query.code)) || ''
  150 + const t = (query && (query.todoType)) || ''
  151 + this.todoType = t
  152 + if (id) this.loadDetail(id)
  153 + },
139 methods: { 154 methods: {
140 onReload(payload) { 155 onReload(payload) {
141 const id = (payload && (payload.id || payload.code)) || this.form.id || this.form.code || '' 156 const id = (payload && (payload.id || payload.code)) || this.form.id || this.form.code || ''
@@ -191,9 +206,28 @@ @@ -191,9 +206,28 @@
191 icon: 'none' 206 icon: 'none'
192 }) 207 })
193 }, 208 },
194 - onCancel() {  
195 - uni.navigateBack()  
196 - } 209 + onCancel() {
  210 + const id = this.form && (this.form.id || this.form.code) || ''
  211 + if (!id) return
  212 + uni.showModal({
  213 + title: '系统提示',
  214 + content: '是否确定取消该流程?',
  215 + confirmText: '确定',
  216 + cancelText: '取消',
  217 + success: (res) => {
  218 + if (res && res.confirm) {
  219 + cancelApi(id).then(() => {
  220 + uni.showToast({ title: '已取消', icon: 'none' })
  221 + setTimeout(() => {
  222 + uni.redirectTo({ url: '/pages/dev_manage/index' })
  223 + }, 300)
  224 + }).catch(() => {
  225 + uni.showToast({ title: '取消失败', icon: 'none' })
  226 + })
  227 + }
  228 + }
  229 + })
  230 + }
197 } 231 }
198 } 232 }
199 </script> 233 </script>
@@ -449,7 +449,7 @@ @@ -449,7 +449,7 @@
449 onCardClick(item) { 449 onCardClick(item) {
450 const id = (item && (item.id || item.code)) || '' 450 const id = (item && (item.id || item.code)) || ''
451 if (!id) return 451 if (!id) return
452 - const query = '?id=' + encodeURIComponent(id) 452 + const query = '?id=' + encodeURIComponent(id) + '&todoType=' + encodeURIComponent(this.todoType || '')
453 uni.navigateTo({ url: '/pages/dev_manage/detail' + query }) 453 uni.navigateTo({ url: '/pages/dev_manage/detail' + query })
454 }, 454 },
455 455
@@ -473,9 +473,9 @@ @@ -473,9 +473,9 @@
473 title: '保存成功', 473 title: '保存成功',
474 icon: 'success' 474 icon: 'success'
475 }) 475 })
476 - const id = payload.id || this.currentId || ''  
477 - uni.$emit('dev_manage_detail_reload', { id })  
478 - setTimeout(() => uni.navigateBack(), 300) 476 + setTimeout(() => {
  477 + uni.redirectTo({ url: '/pages/dev_manage/index' })
  478 + }, 300)
479 }).catch(e => { 479 }).catch(e => {
480 uni.showToast({ 480 uni.showToast({
481 title: e.msg || '提交失败', 481 title: e.msg || '提交失败',
@@ -171,4 +171,12 @@ button[type="primary"]:active { @@ -171,4 +171,12 @@ button[type="primary"]:active {
171 .uni-easyinput .uni-easyinput__content.is-focused .uni-easyinput__content-textarea { 171 .uni-easyinput .uni-easyinput__content.is-focused .uni-easyinput__content-textarea {
172 /* H5 支持光标颜色;小程序端不影响 */ 172 /* H5 支持光标颜色;小程序端不影响 */
173 caret-color: $theme-primary; 173 caret-color: $theme-primary;
174 -}  
  174 +}
  175 +
  176 +/* H5 全局:系统弹框 uni.showModal 的“确定”按钮使用主题色 */
  177 +/* #ifdef H5 */
  178 +.uni-modal__ft .uni-modal__btn:last-child,
  179 +.uni-modal__ft .uni-modal__btn_primary {
  180 + color: $theme-primary !important;
  181 +}
  182 +/* #endif */