link-category-edit.blade.php 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808
  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. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-ohter.css')}}"/>
  6. <link rel="stylesheet" href="{{static_url('css/public-number.css')}}">
  7. <style>
  8. .el-checkbox-group {
  9. position: relative;
  10. z-index: 0;
  11. }
  12. .el-checkbox {
  13. margin-top: 10px !important;
  14. }
  15. </style>
  16. <div id='re_content'>
  17. <div class="con">
  18. <div class="setting">
  19. <el-form ref="form" label-width="15%">
  20. <div class="block">
  21. <div class="title"><span
  22. style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>分类详情</b>
  23. </div>
  24. <el-form-item label="分类名称">
  25. <el-input placeholder="请输入分类名称" style="width:50%;" v-model="form.title"></el-input>
  26. </el-form-item>
  27. <el-form-item label="排序">
  28. <el-input placeholder="数字越大,排序越靠前" style="width:50%;" v-model="form.sort"></el-input>
  29. </el-form-item>
  30. <el-form-item label="是否启用">
  31. <el-switch
  32. :active-value="1"
  33. :inactive-value="0"
  34. v-model="form.is_show"
  35. active-color="#13ce66"
  36. inactive-color="#C0C0C0"
  37. >
  38. </el-switch>
  39. </el-form-item>
  40. <template v-if="is_max">
  41. <el-form-item label="是否需要登录">
  42. <el-switch
  43. @change="changeAppUrl"
  44. :active-value="1"
  45. :inactive-value="0"
  46. v-model="form.need_login"
  47. active-color="#13ce66"
  48. inactive-color="#C0C0C0"
  49. >
  50. </el-switch>
  51. </el-form-item>
  52. <el-form-item label="分类类型">
  53. <el-select style="width: 150px" filterable v-model="form.target_type" placeholder="请选择"
  54. @change="changeAppUrl">
  55. <el-option label="淘宝" value="-1"></el-option>
  56. <el-option label="京东" value="-2"></el-option>
  57. <el-option label="拼多多" value="-3"></el-option>
  58. <el-option label="网页" value="-4"></el-option>
  59. <el-option label="自定义" value="-5"></el-option>
  60. <el-option label="小程序" value="-6"></el-option>
  61. <el-option label="品牌券" value="-7"></el-option>
  62. <el-option label="品牌券商品" value="-8"></el-option>
  63. <el-option label="京东/淘宝官方活动" value="-9"></el-option>
  64. <el-option label="特色商品列表" value="-10"></el-option>
  65. <el-option label="专辑" value="-11"></el-option>
  66. <el-option label="APP页面" value="-12"></el-option>
  67. </el-select>
  68. </el-form-item>
  69. <div v-if="form.target_type==-9">
  70. <el-form-item label="活动平台">
  71. <el-radio v-model="form.target.another_plat" label="1" @change="changeAppUrl">淘宝
  72. </el-radio>
  73. <el-radio v-model="form.target.another_plat" label="3" @change="changeAppUrl">京东
  74. </el-radio>
  75. </el-form-item>
  76. <el-form-item label="淘宝会场id/京东推广链接">
  77. <el-input placeholder="请输入id或链接" style="width:50%;"
  78. v-model="form.target.activity_info" @change="changeAppUrl"></el-input>
  79. </el-form-item>
  80. </div>
  81. <div v-if="form.target_type==-10">
  82. <el-form-item label="商品列表">
  83. <el-select style="width: 150px" v-model="form.target.list_type" placeholder="请选择"
  84. @change="changeAppUrl">
  85. <el-option label="淘宝特色物料" value="1"></el-option>
  86. <el-option label="京东特色列表" value="2"></el-option>
  87. <el-option label="拼多多特色列表" value="3"></el-option>
  88. {{-- <el-option label="拼多多爆款排行" value="4"></el-option>--}}
  89. </el-select>
  90. </el-form-item>
  91. <el-form-item label="列表类型"
  92. v-if="form.target.list_type!=4&&form.target.list_type!==''&&form.target_type==-10">
  93. <el-select v-if="form.target.list_type==1" filterable style="width: 250px"
  94. v-model="tb_list_id" placeholder="请选择" @change="changeAppUrl">
  95. <el-option v-for="item in special_goods_list.taobao_special_url_type"
  96. :key="item.type" :label="item.name" :value="item.type"></el-option>
  97. </el-select>
  98. <el-select v-if="form.target.list_type==2" filterable style="width: 200px"
  99. v-model="jd_list_id" placeholder="请选择" @change="changeAppUrl">
  100. <el-option v-for="item in special_goods_list.jd_special_url_type"
  101. :key="item.type" :label="item.name" :value="item.type"></el-option>
  102. </el-select>
  103. <el-select v-if="form.target.list_type==3" filterable style="width: 150px"
  104. v-model="pdd_list_id" placeholder="请选择" @change="changeAppUrl">
  105. <el-option v-for="item in special_goods_list.pdd_special_url_type"
  106. :key="item.type" :label="item.name" :value="item.type"></el-option>
  107. </el-select>
  108. </el-form-item>
  109. </div>
  110. <div v-if="form.target_type==-11">
  111. {{-- <el-form-item label="专辑页面类型">--}}
  112. {{-- <el-radio v-model="form.target.album_type" label="1">专辑列表</el-radio>--}}
  113. {{-- <el-radio v-model="form.target.album_type" label="2">专辑详情</el-radio>--}}
  114. {{-- </el-form-item>--}}
  115. <el-form-item label="专辑ID">
  116. <el-input placeholder="请输入专辑id" style="width:50%;"
  117. v-model="form.target.album_id" @change="changeAppUrl"></el-input>
  118. </el-form-item>
  119. </div>
  120. <el-form-item v-if="form.target_type==-1 || form.target_type==-2 || form.target_type==-3"
  121. label="关键词">
  122. <el-input placeholder="请输入关键词" style="width:50%;"
  123. v-model="form.target.keyword" @change="changeAppUrl"></el-input>
  124. </el-form-item>
  125. <el-form-item v-if="form.target_type==-4" label="网页标题">
  126. <el-input placeholder="请输入网页标题" style="width:50%;"
  127. v-model="form.target.web_title" @change="changeAppUrl"></el-input>
  128. </el-form-item>
  129. <el-form-item v-if="form.target_type==-4" label="网页链接">
  130. <el-input placeholder="请输入网页链接" style="width:50%;"
  131. v-model="form.target.web_url" @change="changeAppUrl"></el-input>
  132. <el-button type="primary" @click="showLink('link','web_url')">选择链接</el-button>
  133. </el-form-item>
  134. <el-form-item v-if="form.target_type==-5" label="自定义">
  135. <el-input placeholder="请输入app路径" style="width:50%;"
  136. v-model="form.target.app_route" @change="changeAppUrl"></el-input>
  137. <el-button type="primary" @click="showAppRouteModal()">选择APP路径</el-button>
  138. </el-form-item>
  139. <el-form-item v-if="form.target_type==-6" label="小程序原生id">
  140. <el-input placeholder="请输入小程序原生id" style="width:50%;"
  141. v-model="form.target.mini_id" @change="changeAppUrl"></el-input>
  142. </el-form-item>
  143. <el-form-item v-if="form.target_type==-6" label="小程序路径">
  144. <el-input placeholder="请输入小程序路径" style="width:50%;"
  145. v-model="form.target.mini_route" @change="changeAppUrl"></el-input>
  146. <el-button type="primary" @click="showLink('mini','mini_route')">选择小程序链接</el-button>
  147. </el-form-item>
  148. <el-form-item v-if="form.target_type==-7" label="品牌券id">
  149. <el-input placeholder="请输入品牌券id" style="width:50%;"
  150. v-model="form.target.brand_id" @change="changeAppUrl"></el-input>
  151. <el-button type="primary" @click="showBrandModal()">选择品牌券</el-button>
  152. </el-form-item>
  153. <el-form-item v-if="form.target_type==-8" label="品牌券商品第三方id">
  154. <el-input placeholder="请输入品牌券商品第三方id" style="width:50%;"
  155. v-model="form.target.brand_goods_id" @change="changeAppUrl"></el-input>
  156. <el-button type="primary" @click="showBrandGoodsModal()">选择品牌券商品</el-button>
  157. </el-form-item>
  158. </template>
  159. <el-form-item label="分类图标">
  160. <div class="upload-box" @click="openUpload('cover',1,'one')" v-if="!form.cover_url">
  161. <i class="el-icon-plus" style="font-size:32px"></i>
  162. </div>
  163. <div @click="openUpload('cover',1,'one')" class="upload-boxed" v-if="form.cover_url"
  164. style="height:150px;">
  165. <img :src="form.cover_url" alt=""
  166. style="width:150px;height:150px;border-radius: 5px;cursor: pointer;">
  167. <div class="upload-boxed-text">点击重新上传</div>
  168. <i class="el-icon-close" @click.stop="clearImg('cover')" title="点击清除图片"></i>
  169. </div>
  170. <div v-if="form.parent_id==0" class="tip">一级分类可不上传图标</div>
  171. </el-form-item>
  172. <template v-if="form.target_type==-12">
  173. <el-form-item label="APP页面路由">
  174. <el-input placeholder="" style="width:50%;" :disabled="true"
  175. v-model="form.target.app_path">
  176. </el-input>
  177. <el-button type="primary" @click="showAppPathModal">选择</el-button>
  178. </el-form-item>
  179. <el-form-item label="APP页面参数" v-if="app_path_param!=undefined&&app_path_param.length!=0">
  180. <template v-for="(v,k) in app_path_param">
  181. <el-input @change="appPathParamChange" placeholder="" style="width:50%;"
  182. v-model="v.value">
  183. <template slot="prepend">[[v.name]]</template>
  184. </el-input>
  185. <br>
  186. </template>
  187. </el-form-item>
  188. </template>
  189. <el-form-item label="装修DIY-APP页面链接" v-if="app_url_show">
  190. <el-input placeholder="装修DIY-APP页面链接" style="width:50%;"
  191. v-model="app_url"></el-input>
  192. <el-button type="primary" @click="copyUrl(app_url,'复制成功')">复制</el-button>
  193. </el-form-item>
  194. <upload-multimedia-img :upload-show="uploadShow" :type="type" :name="chooseImgName"
  195. :sel-Num="selNum" @replace="changeProp"
  196. @sure="sureImg"></upload-multimedia-img>
  197. </div>
  198. </el-form>
  199. </div>
  200. <div class="confirm-btn">
  201. <el-button :loading="submit_loading" type="primary" @click="submit">提交</el-button>
  202. </div>
  203. </div>
  204. <el-dialog title="" :visible.sync="app_modal_show" width="60%">
  205. <div>
  206. <el-tabs v-model="appModalShowTab">
  207. <el-tab-pane label="自定义路径" name="app_route"></el-tab-pane>
  208. <el-tab-pane label="品牌券" name="brand"></el-tab-pane>
  209. <el-tab-pane label="品牌券商品" name="brand_goods"></el-tab-pane>
  210. <el-tab-pane label="大促活动转链" name="activity_url"></el-tab-pane>
  211. <el-tab-pane label="APP页面" name="app_path"></el-tab-pane>
  212. </el-tabs>
  213. </div>
  214. <div v-if="appModalShowTab=='activity_url'">
  215. <el-form label-width="15%" style="margin-top: 50px">
  216. <el-form-item label="第三方平台">
  217. <el-radio v-model="form.goods_search_plat" label="1">京东</el-radio>
  218. <el-radio v-model="form.goods_search_plat" label="2">拼多多</el-radio>
  219. </el-form-item>
  220. </el-form>
  221. </div>
  222. <div v-if="appModalShowTab=='app_route'">
  223. <el-table :data="app_route_list" style="width: 100%;max-height:500px;overflow:auto;" :fit="true">
  224. <el-table-column label="" align="center">
  225. <template slot-scope="scope">
  226. <el-row :gutter="10">
  227. <el-col :span="5">
  228. <el-button v-if="scope.row[0]" @click="confirmAppRoute(scope.row[0].route)">
  229. [[scope.row[0].title]]
  230. </el-button>
  231. </el-col>
  232. <el-col :span="5">
  233. <el-button v-if="scope.row[1]" @click="confirmAppRoute(scope.row[1].route)">
  234. [[scope.row[1].title]]
  235. </el-button>
  236. </el-col>
  237. <el-col :span="5">
  238. <el-button v-if="scope.row[2]" @click="confirmAppRoute(scope.row[2].route)">
  239. [[scope.row[2].title]]
  240. </el-button>
  241. </el-col>
  242. <el-col :span="5">
  243. <el-button v-if="scope.row[3]" @click="confirmAppRoute(scope.row[3].route)">
  244. [[scope.row[3].title]]
  245. </el-button>
  246. </el-col>
  247. </el-row>
  248. </template>
  249. </el-table-column>
  250. </el-table>
  251. </div>
  252. <div v-if="appModalShowTab=='brand'">
  253. <div style="margin-top: 10px">
  254. <el-input v-model="brand_modal.keyword" style="width:60%;" placeholder="品牌id/品牌名"></el-input>
  255. <el-button @click="searchBrand">搜索</el-button>
  256. </div>
  257. <el-table :data="brand_modal.list" style="width: 100%;max-height:500px;overflow:auto" :fit="true">
  258. <el-table-column label="品牌id" prop="b_id" align="center" min-width="15%"></el-table-column>
  259. <el-table-column label="品牌logo" min-width="30%">
  260. <template slot-scope="scope">
  261. <div style="display:flex;align-items: center;">
  262. <div v-if="scope.row.logo" style="width:40px;">
  263. <el-image :src="scope.row.logo" alt=""
  264. style="width:40px;height:40px;border-radius:50%"></el-image>
  265. </div>
  266. </div>
  267. </template>
  268. </el-table-column>
  269. <el-table-column label="品牌名" prop="name" align="center" min-width="25%"></el-table-column>
  270. ></el-table-column>
  271. <el-table-column label="操作" align="center" min-width="30%">
  272. <template slot-scope="scope">
  273. <el-button @click="chooseBrandOrGoods(scope.row)">
  274. 选择
  275. </el-button>
  276. </template>
  277. </el-table-column>
  278. </el-table>
  279. </div>
  280. <div v-if="appModalShowTab=='app_path'">
  281. <el-table :data="app_path" style="width: 100%;max-height:500px;overflow:auto" :fit="true">
  282. <el-table-column label="页面" prop="name" align="center" min-width="10%"></el-table-column>
  283. <el-table-column label="路径" prop="route" align="center" min-width="10%"></el-table-column>
  284. <el-table-column label="操作" align="center" min-width="30%">
  285. <template slot-scope="scope">
  286. <el-button @click="chooseBrandOrGoods(scope.row)">
  287. 选择
  288. </el-button>
  289. </template>
  290. </el-table-column>
  291. </el-table>
  292. </div>
  293. <div v-if="appModalShowTab=='brand_goods'">
  294. <div style="margin-top: 10px">
  295. <el-input v-model="brand_goods_modal.keyword" style="width:60%;" placeholder="商品id/商品名"></el-input>
  296. <el-button @click="searchBrandGoods">搜索</el-button>
  297. </div>
  298. <el-table :data="brand_goods_modal.list" style="width: 100%;max-height:500px;overflow:auto" :fit="true">
  299. <el-table-column label="商品id" prop="goods_id" align="center" min-width="10%"></el-table-column>
  300. <el-table-column label="第三方id" prop="b_id" align="center" min-width="10%"></el-table-column>
  301. <el-table-column label="商品logo" min-width="25%">
  302. <template slot-scope="scope">
  303. <div style="display:flex;align-items: center;">
  304. <div v-if="scope.row.logo" style="width:40px;">
  305. <el-image :src="scope.row.logo" alt=""
  306. style="width:40px;height:40px;border-radius:50%"></el-image>
  307. </div>
  308. </div>
  309. </template>
  310. </el-table-column>
  311. <el-table-column label="商品名" prop="name" align="center" min-width="25%"></el-table-column>
  312. ></el-table-column>
  313. <el-table-column label="操作" align="center" min-width="30%">
  314. <template slot-scope="scope">
  315. <el-button @click="chooseBrandOrGoods(scope.row)">
  316. 选择
  317. </el-button>
  318. </template>
  319. </el-table-column>
  320. </el-table>
  321. </div>
  322. <span slot="footer" class="dialog-footer">
  323. <el-button @click="app_modal_show = false">取 消</el-button>
  324. </span>
  325. </el-dialog>
  326. <pop :show="show" @replace="changeLink" @add="parHref"></pop>
  327. <program :pro="pro" @replacepro="changeprogram" @addpro="parpro"></program>
  328. </div>
  329. <script src="{{resource_get('static/yunshop/tinymce4.7.5/tinymce.min.js')}}"></script>
  330. @include('public.admin.uploadMultimediaImg')
  331. @include('public.admin.tinymceee')
  332. @include('public.admin.pop')
  333. @include('public.admin.program')
  334. <script>
  335. var app = new Vue({
  336. el: "#re_content",
  337. delimiters: ['[[', ']]'],
  338. name: 'test',
  339. data() {
  340. let id = {!!($id) !!} ? {!!($id) !!} : 0;
  341. let parent_id = "{!!($parent_id) !!}" ? "{!!($parent_id) !!}" : 0;
  342. return {
  343. 'show': false,//是否开启公众号弹窗
  344. 'pro': false,//是否开启小程序弹窗
  345. 'brand_modal_show': false,
  346. 'brand_goods_modal_show': false,
  347. 'chooseLink': '',
  348. 'chooseMiniLink': '',
  349. 'app_modal_show': false,
  350. 'appModalShowTab': 'app_route',
  351. 'app_route_modal': {
  352. 'show': false,
  353. 'list':{!! $app_route !!},
  354. },
  355. 'app_route_show': false,
  356. 'app_route_list': {!! $app_route !!},
  357. 'app_path':{!! $app_path !!},
  358. 'brand_modal': {
  359. 'list': [],
  360. 'show': false,
  361. 'keyword': '',
  362. },
  363. 'brand_goods_modal': {
  364. 'list': [],
  365. 'show': false,
  366. 'keyword': '',
  367. },
  368. 'form': {
  369. 'id': id,
  370. 'parent_id': parent_id,
  371. 'cover': '',
  372. 'cover_url': '',
  373. 'title': '',
  374. 'sort': '0',
  375. 'is_show': '0',
  376. 'target': {},
  377. 'target_type': '-1',
  378. 'need_login': '0',
  379. },
  380. 'pdd_list_id': '',
  381. 'tb_list_id': '',
  382. 'jd_list_id': '',
  383. 'special_goods_list': {
  384. 'jd_special_url_type':{!! $jd_special_url_type !!},
  385. 'taobao_special_url_type':{!! $taobao_special_url_type !!},
  386. 'pdd_special_url_type':{!! $pdd_special_url_type !!},
  387. },
  388. // 'web_cps': {
  389. // 'show': false,
  390. // 'url': '',
  391. // },
  392. 'is_max': 0,
  393. 'uploadShow': false,
  394. 'type': '',
  395. 'selNum': '',
  396. 'chooseImgName': '',
  397. 'submit_loading': false,
  398. 'app_url': '',
  399. 'app_url_show': false,
  400. 'app_path_param': [],
  401. }
  402. },
  403. created() {
  404. this.getData();
  405. },
  406. mounted() {
  407. },
  408. methods: {
  409. chooseAppPath(data) {
  410. this.form.target_type = '-12';
  411. this.form.target.app_path = data.route;
  412. this.app_path_param = data.param;
  413. this.appPathParamChange();
  414. },
  415. appPathParamChange() {
  416. var json = {};
  417. console.log(this.app_path_param);
  418. if(this.app_path_param === undefined){
  419. return false;
  420. }
  421. if (this.app_path_param.length > 0) {
  422. this.app_path_param.forEach(function (v) {
  423. if (v.type === 'int') {
  424. json[v.key] = parseInt(v.value);
  425. } else if (v.type === 'string') {
  426. json[v.key] = v.value.toString();
  427. } else if (v.type === 'float') {
  428. json[v.key] = parseFloat(v.value);
  429. } else {
  430. json[v.key] = v.value;
  431. }
  432. })
  433. }
  434. this.form.target.pathParam = JSON.stringify(json);
  435. console.log(json);
  436. console.log(this.form.target.pathParam);
  437. this.changeAppUrl();
  438. },
  439. changeAppUrl() {
  440. console.log(123);
  441. this.app_url_show = false;
  442. if (!this.is_max) {
  443. return false;
  444. }
  445. let url = '';
  446. url += 'target_type=' + this.form.target_type;
  447. url += '&need_login=' + this.form.need_login;
  448. url += '&is_show=1';
  449. url += '&title=' + this.form.title + '&';
  450. let target = {};
  451. if (this.form.target_type === '-1' || this.form.target_type === '-2' || this.form.target_type === '-3') {
  452. target.keyword = this.form.target.keyword;
  453. } else if (this.form.target_type === '-4') {
  454. target.web_title = this.form.target.web_title;
  455. target.web_url = this.form.target.web_url;
  456. } else if (this.form.target_type === '-5') {
  457. target.app_route = this.form.target.app_route;
  458. } else if (this.form.target_type === '-6') {
  459. target.mini_id = this.form.target.mini_id;
  460. target.mini_route = this.form.target.mini_route;
  461. } else if (this.form.target_type === '-7') {
  462. target.brand_id = this.form.target.brand_id;
  463. } else if (this.form.target_type === '-8') {
  464. target.brand_goods_id = this.form.target.brand_goods_id;
  465. } else if (this.form.target_type === '-9') {
  466. target.another_plat = this.form.target.another_plat;
  467. target.activity_info = this.form.target.activity_info;
  468. } else if (this.form.target_type === '-10') {
  469. target.list_type = this.form.target.list_type;
  470. if (this.form.target.list_type === '1') {
  471. target.list_id = this.tb_list_id;
  472. } else if (this.form.target.list_type === '2') {
  473. target.list_id = this.jd_list_id;
  474. } else if (this.form.target.list_type === '3') {
  475. target.list_id = this.pdd_list_id;
  476. } else {
  477. target.list_id = '';
  478. }
  479. } else if (this.form.target_type === '-11') {
  480. target.album_type = '2';
  481. target.album_id = this.form.target.album_id;
  482. } else if (this.form.target_type === '-12') {
  483. target.app_path = this.form.target.app_path;
  484. target.pathParam = this.form.target.pathParam;
  485. }
  486. for (var k in target) {
  487. if (this.isEmpty(target[k]) && k !== 'web_title') {
  488. console.log(k);
  489. return false;
  490. }
  491. }
  492. url += $.param(target);
  493. this.app_url = url;
  494. this.app_url_show = true;
  495. console.log(this.app_url);
  496. },
  497. isEmpty(word) {
  498. if (word === undefined || word === '' || word === 0 || word === '0') {
  499. return true;
  500. }
  501. return false;
  502. },
  503. copyUrl(url, msg) {
  504. let oInput = document.createElement('input');
  505. oInput.value = url;
  506. document.body.appendChild(oInput);
  507. oInput.select(); // 选择对象;
  508. console.log(oInput.value);
  509. document.execCommand("Copy"); // 执行浏览器复制命令
  510. this.$message({message: msg, type: 'success'});
  511. oInput.remove()
  512. },
  513. showBrandModal() {
  514. this.app_modal_show = true;
  515. this.appModalShowTab = 'brand';
  516. },
  517. showAppPathModal() {
  518. this.app_modal_show = true;
  519. this.appModalShowTab = 'app_path';
  520. },
  521. searchBrand() {
  522. this.$http.post("{!! yzWebUrl('plugin.aggregation-cps.admin.equity.searchBrand') !!}", {keyword: this.brand_modal.keyword}).then(response => {
  523. if (response.data.result) {
  524. this.brand_modal.list = response.data.data
  525. } else {
  526. this.$message({type: 'error', message: response.data.msg});
  527. }
  528. }, response => {
  529. this.$message({type: 'error', message: response.data.msg});
  530. console.log(response);
  531. });
  532. },
  533. chooseBrandOrGoods(data) {
  534. if (this.appModalShowTab == 'brand') {
  535. this.chooseBrand(data);
  536. } else if (this.appModalShowTab == 'brand_goods') {
  537. this.chooseBrandGoods(data);
  538. } else if (this.appModalShowTab == 'app_path') {
  539. this.chooseAppPath(data);
  540. }
  541. },
  542. chooseBrand(data) {
  543. console.log('brand');
  544. this.form.target_type = '-7';
  545. this.form.target.brand_id = data.b_id;
  546. this.app_modal_show = false;
  547. this.changeAppUrl();
  548. },
  549. showBrandGoodsModal() {
  550. this.app_modal_show = true;
  551. this.appModalShowTab = 'brand_goods';
  552. },
  553. searchBrandGoods() {
  554. this.$http.post("{!! yzWebUrl('plugin.aggregation-cps.admin.equity-goods.searchBrandGoods') !!}", {keyword: this.brand_goods_modal.keyword}).then(response => {
  555. if (response.data.result) {
  556. this.brand_goods_modal.list = response.data.data
  557. } else {
  558. this.$message({type: 'error', message: response.data.msg});
  559. }
  560. }, response => {
  561. this.$message({type: 'error', message: response.data.msg});
  562. console.log(response);
  563. });
  564. },
  565. chooseBrandGoods(data) {
  566. this.form.target_type = '-8';
  567. this.form.target.brand_goods_id = data.b_id;
  568. this.app_modal_show = false;
  569. this.changeAppUrl();
  570. },
  571. showLink(type, name) {
  572. if (type == "link") {
  573. this.chooseLink = name;
  574. this.show = true;
  575. } else {
  576. this.chooseMiniLink = name;
  577. this.pro = true;
  578. }
  579. },
  580. //当前链接的增加
  581. parHref(child, confirm) {
  582. this.show = confirm;
  583. // this.form.link=child;
  584. this.form.target[this.chooseLink] = child;
  585. this.changeAppUrl();
  586. },
  587. parpro(child, confirm) {
  588. this.pro = confirm;
  589. // this.form.prolink=child;
  590. this.form.target[this.chooseMiniLink] = child;
  591. this.changeAppUrl();
  592. },
  593. //弹窗显示与隐藏的控制
  594. changeLink(item) {
  595. this.show = item;
  596. },
  597. changeprogram(item) {
  598. this.pro = item;
  599. },
  600. showAppRouteModal() {
  601. this.app_modal_show = true;
  602. this.appModalShowTab = 'app_route';
  603. },
  604. confirmAppRoute(route) {
  605. this.form.target.app_route = route;
  606. this.app_modal_show = false;
  607. this.form.target_type = '-5';
  608. this.changeAppUrl();
  609. },
  610. clearImg(str, type, index) {
  611. if (!type) {
  612. this.form[str] = "";
  613. this.form[str + '_url'] = "";
  614. } else {
  615. this.form[str].splice(index, 1);
  616. this.form[str + '_url'].splice(index, 1);
  617. }
  618. this.$forceUpdate();
  619. }, changeProp(val) {
  620. if (val == true) {
  621. this.uploadShow = false;
  622. } else {
  623. this.uploadShow = true;
  624. }
  625. },
  626. sureImg(name, uploadShow, fileList) {
  627. if (fileList.length <= 0) {
  628. return
  629. }
  630. console.log(name);
  631. console.log(fileList);
  632. this.form[name] = fileList[0].attachment;
  633. this.form[name + '_url'] = fileList[0].url;
  634. },
  635. openUpload(str, type, sel) {
  636. this.chooseImgName = str;
  637. this.uploadShow = true;
  638. this.type = type;
  639. this.selNum = sel;
  640. },
  641. getData() {
  642. this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.link-category.edit') !!}', {
  643. 'parent_id': this.form.parent_id,
  644. 'id': this.form.id,
  645. 'is_json': 1
  646. }).then(response => {
  647. if (response.data.result) {
  648. var category_data = response.data.data.category_data;
  649. this.form.id = category_data.id ? category_data.id : 0;
  650. this.form.cover = category_data.cover ? category_data.cover : '';
  651. this.form.cover_url = category_data.cover_url ? category_data.cover_url : '';
  652. this.form.title = category_data.title ? category_data.title : '';
  653. this.form.sort = category_data.sort ? category_data.sort : 0;
  654. this.form.is_show = category_data.is_show ? category_data.is_show : 0;
  655. this.form.target = category_data.target ? category_data.target : {};
  656. this.form.target_type = category_data.target_type ? String(category_data.target_type) : '-1';
  657. this.form.need_login = category_data.need_login ? category_data.need_login : '0';
  658. this.form.parent_id = response.data.data.parent_id ? response.data.data.parent_id : 0;
  659. this.app_path_param = response.data.data.app_path_param;
  660. this.appPathParamChange();
  661. if (this.form.target_type == -10) {
  662. if (this.form.target.list_type === '1') {
  663. this.tb_list_id = this.form.target.list_id;
  664. } else if (this.form.target.list_type === '2') {
  665. this.jd_list_id = this.form.target.list_id;
  666. } else if (this.form.target.list_type === '3') {
  667. this.pdd_list_id = this.form.target.list_id;
  668. }
  669. }
  670. this.is_max = response.data.data.is_max;
  671. this.changeAppUrl();
  672. } else {
  673. this.$message({message: response.data.msg, type: 'error'});
  674. }
  675. }, response => {
  676. this.$message({message: response.data.msg, type: 'error'});
  677. })
  678. },
  679. submit() {
  680. let that = this;
  681. if (this.form.target_type === '-10') {
  682. if (this.form.target.list_type === '1') {
  683. this.form.target.list_id = this.tb_list_id;
  684. } else if (this.form.target.list_type === '2') {
  685. this.form.target.list_id = this.jd_list_id;
  686. } else if (this.form.target.list_type === '3') {
  687. this.form.target.list_id = this.pdd_list_id;
  688. } else {
  689. this.form.target.list_id = '';
  690. }
  691. if (this.form.target.list_type === '1' || this.form.target.list_type === '2' || this.form.target.list_type === '3') {
  692. if (this.form.target.list_id === undefined || this.form.target.list_id === '' || this.form.target.list_id === 0 || this.form.target.list_id === '0') {
  693. this.$message({message: '请选择列表类型', type: 'error'});
  694. return false;
  695. }
  696. }
  697. }
  698. if (this.form.target_type == '-11') {
  699. this.form.target.album_type = '2';
  700. }
  701. this.submit_loading = true;
  702. this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.link-category.change') !!}', this.form).then(response => {
  703. if (response.data.result) {
  704. console.log(response.data.data);
  705. // this.form.id = response.data.data;
  706. this.$message({message: response.data.msg, type: 'success'});
  707. this.submit_loading = false;
  708. let parent_id = response.data.data.parent_id;
  709. let level = response.data.data.level;
  710. window.location.href = "{!! yzWebUrl('plugin.aggregation-cps.admin.link-category.index') !!}" + '&level=' + level + '&parent_id=' + parent_id;
  711. {{--if (this.form.id == 0) {--}}
  712. {{-- let id = response.data.data;--}}
  713. {{-- this.form.id = id;--}}
  714. {{-- window.location.href = "{!! yzWebUrl('plugin.aggregation-cps.admin.link-category.edit') !!}" + '&id=' + id;--}}
  715. {{--} else {--}}
  716. {{-- this.getData();--}}
  717. {{--}--}}
  718. } else {
  719. this.$message({message: response.data.msg, type: 'error'});
  720. this.submit_loading = false;
  721. }
  722. }, response => {
  723. this.$message({message: response.data.msg, type: 'error'});
  724. this.submit_loading = false;
  725. })
  726. }
  727. },
  728. })
  729. </script>
  730. @endsection