Commit a07810777ccd3894dcf9fb04edd2b3c5fd000596

Authored by 史婷婷
1 parent 35c8e73f

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

... ... @@ -81,9 +81,9 @@ export default {
81 81 right: 0;
82 82 bottom: 0;
83 83 background: #fff;
84   - padding: 16rpx 24rpx;
  84 + padding: 32rpx;
85 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 87 display: flex;
88 88 align-items: center;
89 89 gap: 24rpx;
... ... @@ -106,16 +106,26 @@ export default {
106 106
107 107 .action-button {
108 108 text-align: center;
109   - padding: 20rpx 0;
  109 + height: 80rpx;
  110 + line-height: 80rpx;
110 111 border-radius: 12rpx;
111 112 white-space: nowrap;
112 113 overflow: hidden;
113 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 129 .is-disabled { opacity: 0.5; }
120 130
121 131 .popover-mask {
... ...
... ... @@ -61,7 +61,14 @@
61 61 "navigationBarBackgroundColor": "#ffffff",
62 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 72 "path": "pages/dev_manage/add",
66 73 "style": {
67 74 "navigationBarTitleText": "新增客户开发",
... ...
... ... @@ -45,15 +45,15 @@
45 45 </view>
46 46 </view>
47 47 </scroll-view>
48   - <detail-buttons :buttons="buttons" @click="handleButtonClick" />
  48 + <detail-buttons :buttons="displayButtons" @click="handleButtonClick" />
49 49 </view>
50 50 </template>
51 51
52 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 57 import {
58 58 getDicName
59 59 } from '@/utils/dic.js'
... ... @@ -67,62 +67,75 @@
67 67 components: {
68 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 139 created() {
127 140 this.loadCustomerTypeOptions()
128 141 },
... ... @@ -132,10 +145,12 @@
132 145 onUnload() {
133 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 154 methods: {
140 155 onReload(payload) {
141 156 const id = (payload && (payload.id || payload.code)) || this.form.id || this.form.code || ''
... ... @@ -191,9 +206,28 @@
191 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 233 </script>
... ...
... ... @@ -449,7 +449,7 @@
449 449 onCardClick(item) {
450 450 const id = (item && (item.id || item.code)) || ''
451 451 if (!id) return
452   - const query = '?id=' + encodeURIComponent(id)
  452 + const query = '?id=' + encodeURIComponent(id) + '&todoType=' + encodeURIComponent(this.todoType || '')
453 453 uni.navigateTo({ url: '/pages/dev_manage/detail' + query })
454 454 },
455 455
... ...
... ... @@ -473,9 +473,9 @@
473 473 title: '保存成功',
474 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 479 }).catch(e => {
480 480 uni.showToast({
481 481 title: e.msg || '提交失败',
... ...
... ... @@ -171,4 +171,12 @@ button[type="primary"]:active {
171 171 .uni-easyinput .uni-easyinput__content.is-focused .uni-easyinput__content-textarea {
172 172 /* H5 支持光标颜色;小程序端不影响 */
173 173 caret-color: $theme-primary;
174   -}
\ No newline at end of file
  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 */
\ No newline at end of file
... ...