edit.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <style>
  2. .table-body {
  3. padding: 20px 20px;
  4. background-color: #fff;
  5. }
  6. .table-body .top-input {
  7. margin-top: 34px;
  8. }
  9. .input-item {
  10. width: 200px;
  11. margin-right: 20px;
  12. }
  13. .input-item .el-input__inner {
  14. border-right: 0;
  15. }
  16. .input-item .el-input__inner:hover {
  17. border: 1px solid #dcdfe6;
  18. border-right: 0;
  19. outline: 0;
  20. }
  21. .input-item .el-input__inner:focus {
  22. border: 1px solid #dcdfe6;
  23. border-right: 0;
  24. outline: 0;
  25. }
  26. .input-item .el-input-group__append {
  27. background-color: #fff;
  28. border-left: 0;
  29. width: 10%;
  30. padding: 0;
  31. }
  32. .input-item .el-input-group__append .el-button {
  33. padding: 0;
  34. }
  35. .input-item .el-input-group__append .el-button {
  36. margin: 0;
  37. }
  38. /* #app .table-body .el-table .el-button {
  39. border-radius: 16px;
  40. } */
  41. .create {
  42. height: 36px;
  43. line-height: 36px;
  44. float: right;
  45. color: #BCBCBC;
  46. margin-left: 20px;
  47. }
  48. .name {
  49. cursor: pointer;
  50. color: #49A9FF;
  51. }
  52. .el-input-group__append {
  53. /* background-color: #fff; */
  54. }
  55. /* 卡片 */
  56. .plugin-list {
  57. margin: 0 0 0 -20px;
  58. /* padding-right: 100px; */
  59. display: flex;
  60. flex-wrap: wrap;
  61. }
  62. .plugin-list .plugin-item {
  63. width: 20%;
  64. min-width: 400px;
  65. }
  66. .plugin-item {
  67. border: 1px solid #ebebeb;
  68. background: #FFFFFF;
  69. box-shadow: 3px 5px 15px rgba(80, 80, 80, 0.16);
  70. opacity: 1;
  71. border-radius: 5px;
  72. padding: 20px;
  73. margin: 0 0 20px 20px;
  74. transition: 250ms;
  75. position: relative;
  76. /* min-width: 300px; */
  77. }
  78. .plugin-item .item-status {
  79. position: absolute;
  80. top: 0;
  81. right: 0;
  82. width: 94px;
  83. height: 30px;
  84. background: #E8EAEC;
  85. opacity: 1;
  86. border-radius: 0px 5px 0px 5px;
  87. font-size: 14px;
  88. font-family: Microsoft YaHei;
  89. font-weight: 400;
  90. line-height: 30px;
  91. color: #9398A4;
  92. text-align: center;
  93. }
  94. .item-status-permanent {
  95. width: 94px;
  96. }
  97. .item-status-effective {
  98. width: 164px;
  99. }
  100. .plugin-item .item-info {
  101. display: flex;
  102. align-items: center;
  103. }
  104. /* .plugin-item .item-info .item-right{
  105. min-width: 500px;
  106. } */
  107. .plugin-item .item-btns {
  108. display: flex;
  109. align-items: center;
  110. justify-content: flex-end;
  111. margin-top: 12px;
  112. }
  113. .plugin-item .mall-logo {
  114. width: 70px;
  115. height: 70px;
  116. margin-right: 12px;
  117. }
  118. .plugin-item .mall-logo img {
  119. width: 100%;
  120. height: 100%;
  121. display: block;
  122. border-radius: 50%;
  123. }
  124. .plugin-item .display-name {
  125. font-size: 18pt;
  126. margin-top: 10px;
  127. margin-bottom: 4px;
  128. font-family: Microsoft YaHei;
  129. font-weight: bold;
  130. line-height: 30px;
  131. color: #3F495D;
  132. opacity: 1;
  133. width: 200px;
  134. white-space: nowrap;
  135. overflow: hidden;
  136. text-overflow: ellipsis;
  137. }
  138. .plugin-item .name {
  139. color: #909399;
  140. }
  141. .plugin-item:hover {
  142. cursor: pointer;
  143. border-color: #bfddff;
  144. }
  145. /* .plugin-item:hover .display-name {
  146. color: #409EFF;
  147. } */
  148. .plugin-item .plugin-option-btn {
  149. height: 25px;
  150. width: 25px;
  151. font-size: 12px;
  152. padding: 0;
  153. }
  154. .plugin-item .detail-option.detail-option {
  155. color: #909399;
  156. background: #F2F6FC;
  157. }
  158. .plugin-item .detail-option:hover {
  159. color: #fff;
  160. background: #909399;
  161. }
  162. </style>
  163. <?php
  164. use common\helpers\ComponentHelper;
  165. ComponentHelper::loadComponentView('com-rich-text');
  166. ?>
  167. <div id="app" v-cloak>
  168. <el-card shadow="never" style="border:0;min-width: 1200px;"
  169. body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  170. <div slot="header">
  171. <div>
  172. <span>订购须知/协议编辑</span>
  173. </div>
  174. </div>
  175. <div class="table-body">
  176. <el-form :model="ruleForm" :rules="rules" ref="ruleForm" @close="handleClose('ruleForm')">
  177. <el-form-item label="协议名称" :label-width="formLabelWidth" prop="name">
  178. <el-input v-model="ruleForm.name" autocomplete="off"></el-input>
  179. </el-form-item>
  180. <el-form-item label="备注" :label-width="formLabelWidth" prop="remark">
  181. <el-input v-model="ruleForm.remark" autocomplete="off"></el-input>
  182. </el-form-item>
  183. <el-form-item label="排序" :label-width="formLabelWidth" prop="sort">
  184. <el-input v-model="ruleForm.sort" type="number" autocomplete="off"></el-input>
  185. </el-form-item>
  186. <el-form-item label="协议内容" :label-width="formLabelWidth" prop="content">
  187. <com-rich-text v-model="ruleForm.content"></com-rich-text>
  188. </el-form-item>
  189. </el-form>
  190. <div slot="footer" class="dialog-footer">
  191. <el-button type="primary" @click="postAdd('ruleForm')">确 定</el-button>
  192. </div>
  193. </div>
  194. </el-card>
  195. </div>
  196. <script>
  197. new Vue({
  198. el: '#app',
  199. data() {
  200. return {
  201. formLabelWidth:'150px',
  202. tableData: [],
  203. rules: {
  204. name: [{
  205. required: true,
  206. message: '请输入协议名称',
  207. trigger: 'blur'
  208. },
  209. {
  210. validator: (rule, value, callback) => {
  211. if (value.length > 255) {
  212. callback('1~255个字符');
  213. }
  214. callback();
  215. }
  216. }
  217. ],
  218. content: [{
  219. required: true,
  220. message: '请输入内容',
  221. trigger: 'blur'
  222. },
  223. {
  224. validator: (rule, value, callback) => {
  225. if (value.length <0) {
  226. callback('请输入内容');
  227. }
  228. callback();
  229. }
  230. }
  231. ],
  232. },
  233. ruleForm: {
  234. id: '',
  235. name: '',
  236. remark: '',
  237. sort: 0,
  238. content: '',
  239. },
  240. }
  241. },
  242. created() {
  243. this.getList();
  244. },
  245. methods: {
  246. postAdd(formName) {
  247. this.$refs[formName].validate((valid) => {
  248. if (valid) {
  249. this.$request({
  250. method: "post",
  251. params: {
  252. r: 'mall/service-agreement/edit',
  253. },
  254. data: this.ruleForm
  255. }).then(e => {
  256. if (e.data.code == 0) {
  257. this.$message({
  258. message: e.data.msg,
  259. type: 'success'
  260. });
  261. navigateTo("/index.php?r=mall/service-agreement/index")
  262. } else {
  263. this.$message.error(e.data.msg);
  264. }
  265. }).catch(e => {
  266. });
  267. }
  268. });
  269. },
  270. getList() {
  271. if(getQuery('id')){
  272. this.$request({
  273. params: {
  274. r: 'mall/service-agreement/edit',
  275. id: getQuery('id')
  276. },
  277. }).then(e => {
  278. if (e.data.code == 0) {
  279. this.ruleForm = e.data.data;
  280. } else {
  281. this.$message.error(e.data.msg);
  282. }
  283. }).catch(e => {
  284. });
  285. }
  286. },
  287. },
  288. });
  289. </script>