info.blade.php 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. @extends('layouts.base')
  2. @section('title', '品牌详情')
  3. @section('content')
  4. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}"/>
  5. <div class="all">
  6. <div id="app" v-cloak>
  7. <div class="vue-crumbs">
  8. <a @click="goParent">商品品牌</a> > 品牌详情
  9. </div>
  10. <div class="vue-main">
  11. <div class="vue-main-title">
  12. <div class="vue-main-title-left"></div>
  13. <div class="vue-main-title-content">品牌详情</div>
  14. </div>
  15. <div class="vue-main-form">
  16. <el-form ref="form" :model="form" :rules="rules" label-width="15%">
  17. <el-form-item label="品牌名称" prop="name">
  18. <el-input v-model="form.name" style="width:70%;"></el-input>
  19. </el-form-item>
  20. <el-form-item label="品牌别名" prop="alias">
  21. <el-input v-model="form.alias" style="width:70%;"></el-input>
  22. </el-form-item>
  23. <el-form-item label="LOGO" prop="logo">
  24. <!-- 1:图片的上传类型 -->
  25. <div class="upload-box" @click="openUpload('logo',1,'one')" v-if="!form.logo_url">
  26. <i class="el-icon-plus" style="font-size:32px"></i>
  27. </div>
  28. <div @click="openUpload('logo',1,'one')" class="upload-boxed" v-if="form.logo_url">
  29. <img :src="form.logo_url" alt="" style="width:150px;height:150px;border-radius: 5px;cursor: pointer;">
  30. <div class="upload-boxed-text">点击重新上传1</div>
  31. <i class="el-icon-close" @click.stop="clearImg('logo')" title="点击清除图片"></i>
  32. </div>
  33. <div class="tip">建议尺寸: 100*100,或正方型图片</div>
  34. </el-form-item>
  35. <el-form-item label="是否推荐" prop="is_recommend">
  36. <el-switch v-model="form.is_recommend" :active-value="1" :inactive-value="0"></el-switch>
  37. </el-form-item>
  38. <el-form-item label="品牌描述" prop="desc">
  39. <tinymceee v-model="form.desc" style="width:70%"></tinymceee>
  40. </el-form-item>
  41. </el-form>
  42. </div>
  43. </div>
  44. <!-- 分页 -->
  45. <div class="vue-page">
  46. <div class="vue-center">
  47. <el-button type="primary" @click="submitForm('form')">保存设置</el-button>
  48. <el-button @click="goBack">返回</el-button>
  49. </div>
  50. </div>
  51. <upload-multimedia-img :upload-show="uploadShow" :type="type" :name="chooseImgName" :sel-Num="selNum" @replace="changeProp" @sure="sureImg"></upload-multimedia-img>
  52. </div>
  53. </div>
  54. <script src="{{resource_get('static/yunshop/tinymce4.7.5/tinymce.min.js')}}"></script>
  55. <!-- <script src="{{resource_get('static/yunshop/tinymceTemplate.js')}}"></script> -->
  56. @include('public.admin.tinymceee')
  57. @include('public.admin.uploadMultimediaImg')
  58. <script>
  59. var app = new Vue({
  60. el:"#app",
  61. delimiters: ['[[', ']]'],
  62. name: 'test',
  63. data() {
  64. let id = {!! $id?:0 !!};
  65. console.log(id);
  66. return{
  67. id:id,
  68. form:{
  69. },
  70. uploadShow:false,
  71. chooseImgName:'',
  72. submit_url:'',
  73. showVisible:false,
  74. loading: false,
  75. uploadImg1:'',
  76. rules:{
  77. name:{ required: true, message: '请输入品牌名称'}
  78. },
  79. type:'',
  80. selNum:'',
  81. }
  82. },
  83. created() {
  84. },
  85. mounted() {
  86. // this.getData();
  87. if(this.id) {
  88. this.getData();
  89. this.submit_url = '{!! yzWebFullUrl('goods.brand.edit') !!}';
  90. }
  91. else {
  92. this.submit_url = '{!! yzWebFullUrl('goods.brand.add') !!}';
  93. }
  94. },
  95. methods: {
  96. clearImg(str,type,index) {
  97. if(!type) {
  98. this.form[str] = "";
  99. this.form[str+'_url'] = "";
  100. }
  101. else {
  102. this.form[str].splice(index,1);
  103. this.form[str+'_url'].splice(index,1);
  104. }
  105. this.$forceUpdate();
  106. },
  107. goParent() {
  108. window.location.href = `{!! yzWebFullUrl('goods.brand.index') !!}`;
  109. },
  110. getData() {
  111. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  112. this.$http.post('{!! yzWebFullUrl('goods.brand.edit') !!}',{id:this.id}).then(function (response) {
  113. if (response.data.result){
  114. this.form = {
  115. ...response.data.data,
  116. };
  117. }
  118. else {
  119. this.$message({message: response.data.msg,type: 'error'});
  120. }
  121. loading.close();
  122. },function (response) {
  123. this.$message({message: response.data.msg,type: 'error'});
  124. loading.close();
  125. }
  126. );
  127. },
  128. submitForm(formName) {
  129. console.log(this.form)
  130. let that = this;
  131. let json = {
  132. name:this.form.name,
  133. alias:this.form.alias,
  134. logo:this.form.logo,
  135. is_recommend:this.form.is_recommend || 0,
  136. desc:this.form.desc,
  137. };
  138. let json1 = {
  139. brand:json
  140. }
  141. if(this.id) {
  142. json1.id = this.id
  143. }
  144. this.$refs[formName].validate((valid) => {
  145. if (valid) {
  146. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  147. this.$http.post(this.submit_url,json1).then(response => {
  148. if (response.data.result) {
  149. this.$message({type: 'success',message: '操作成功!'});
  150. this.goBack();
  151. } else {
  152. this.$message({message: response.data.msg,type: 'error'});
  153. }
  154. loading.close();
  155. },response => {
  156. loading.close();
  157. });
  158. }
  159. else {
  160. console.log('error submit!!');
  161. return false;
  162. }
  163. });
  164. },
  165. goBack() {
  166. history.go(-1)
  167. },
  168. openUpload(str,type,sel) {
  169. console.log(type,'11111');
  170. this.chooseImgName = str;
  171. this.uploadShow = true;
  172. this.type = type
  173. this.selNum = sel
  174. },
  175. changeProp(val) {
  176. if(val == true) {
  177. this.uploadShow = false;
  178. }
  179. else {
  180. this.uploadShow = true;
  181. }
  182. },
  183. // 参数:fileList 上传文件的列表信息
  184. sureImg(name,uploadShow,fileList) {
  185. if(fileList.length <= 0) {
  186. return
  187. }
  188. console.log(name)
  189. console.log(fileList)
  190. this.form[name] =fileList[0].attachment;
  191. this.form[name+'_url'] = fileList[0].url;
  192. console.log(this.form[name],'aaaaa')
  193. console.log( this.form[name+'_url'],'bbbbb')
  194. },
  195. clearImg(str) {
  196. this.form[str] = "";
  197. this.form[str+'_url'] = "";
  198. this.$forceUpdate();
  199. },
  200. },
  201. })
  202. </script>
  203. @endsection