goods-import-v2.blade.php 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007
  1. @extends('layouts.base')
  2. @section('content')
  3. @section('title', trans('商品导入'))
  4. <style>
  5. [v-cloak]{
  6. display:none;
  7. }
  8. .vue-page {
  9. border-radius: 5px;
  10. width: calc(100% - 266px);
  11. float: right;
  12. margin-right: 10px;
  13. position: fixed;
  14. bottom: 0;
  15. right: 0;
  16. padding: 6px 5% 6px 20px;
  17. background: #fff;
  18. /* height: 60px; */
  19. z-index: 999;
  20. margin-top: 0;
  21. box-shadow: 0 2px 9px rgba(51, 51, 51, 0.1);
  22. }
  23. .content{background-color: #eff3f6;}
  24. .caret-wrapper {
  25. display: inline-flex;
  26. flex-direction: column;
  27. align-items: center;
  28. height: 25px;
  29. width: 11px;
  30. vertical-align: middle;
  31. cursor: pointer;
  32. overflow: initial;
  33. position: relative;
  34. }
  35. .caret-top{
  36. border: 5px solid transparent;
  37. border-bottom-color: #333;
  38. margin:1px 0;
  39. }
  40. .caret-bottom{
  41. border: 5px solid transparent;
  42. border-top-color: #333;
  43. margin:1px 0;
  44. }
  45. </style>
  46. <style>
  47. /* .flex{display:flex;width:100%;flex-wrap: wrap;justify-content: space-between; text-align: justify;} */
  48. .flex{display: grid;grid-template-columns: repeat(auto-fit,240px);grid-column-gap: 20px;min-height: 100vh;margin-bottom: 60px;}
  49. /* .flex{display:flex;margin:10px;} */
  50. .box-lis{min-width: 240px;width:240px}
  51. .box-li{width:240px;border:1px solid #ccc;transition: all .3s;position: relative;overflow:hidden;margin-bottom:20px;height: 354px;}
  52. .box-li:hover{border-color: #df0f0f;margin-bottom: 0px;height: 374px;}
  53. .box-li:hover .box-li-detail,.box-li:hover .isshow-item{display:flex;}
  54. .box-li-img{width:240px;height:240px;position: relative;}
  55. .box-li-img img{width:238px;height:100%;border:0px solid #333;}
  56. .box-li-detail{ display: none;width: 100%;font-size: 12px;position: absolute;bottom: 0;line-height:30px;z-index:2;background: #e1564c;color: #fff;font-weight: 600;text-align: center;}
  57. .box-li-detail .is_selected{flex: 1;}
  58. .box-li-detail .watch-detail{width: 66.6%;text-align: center;border-right:2px solid #ccc;cursor: pointer;}
  59. .isshow-item{display: none;text-align: center;font-size:12px;width:100%;}
  60. .text-vertical{display: -webkit-box;-webkit-line-clamp: 1;overflow: hidden;text-overflow: ellipsis;-webkit-box-orient: vertical;}
  61. .box-li-title{height:40px;color:#333;font-weight: 500;font-size: 14px;overflow: hidden;display: -webkit-box;-webkit-line-clamp: 2;overflow: hidden;text-overflow: ellipsis;line-height:20px;-webkit-box-orient: vertical;}
  62. .box-li-title>span{cursor: pointer;}
  63. .box-li-price{display:flex;flex-wrap: wrap;color:#333;font-weight: 500;margin:0 8px;}
  64. .box-li-price-one{width:50%;text-align: center;font-size: 12px;}
  65. .box-li-sel{position: absolute;top:0;right: 7px;}
  66. .el-checkbox__inner {border-color:#29ba9b}
  67. .table-responsive{padding: 6px 15px;}
  68. </style>
  69. <style>
  70. @font-face {
  71. font-family: ‘iconfont’; /* Project id 432132 */
  72. src: url(‘//at.alicdn.com/t/font_432132_078f875xdhok.woff2?t=1636442453208’) format(‘woff2’),
  73. url(‘//at.alicdn.com/t/font_432132_078f875xdhok.woff?t=1636442453208’) format(‘woff’),
  74. url(‘//at.alicdn.com/t/font_432132_078f875xdhok.ttf?t=1636442453208’) format(‘truetype’);
  75. }
  76. .panel-info{line-height: 40px;margin-bottom:6px;border-radius:8px;padding: 6px;}
  77. .panel-info-lable{width: 100px;font-size:12px;color: #2d2d2d;white-space:nowrap;}
  78. .panel-info-content{flex:1;display: flex;flex-wrap: wrap;min-width: 1000px;}
  79. .panel-info-content>div:nth-child(n+1){margin-right: 20px;}
  80. .Marketing-item-box{overflow-x: auto;flex-wrap: nowrap;}
  81. .el-radio-button__inner{height: 40px;width: 120px;}
  82. .import-class{display: flex;flex-wrap: nowrap;line-height: 32px;}
  83. .import-class>div{padding:10px;white-space:nowrap;}
  84. .import-class .el-input{width:160px;}
  85. .panel-item{display: flex;margin: 6px 0;line-height: 40px;}
  86. .panel-item .iconfont{margin-right: 6px;font-size: 16px;}
  87. .tips{color: red;width: 560px;line-height:30px;padding-left:20px;white-space:nowrap;}
  88. </style>
  89. <div class="w1200 ">
  90. <link rel="stylesheet" type="text/css" href="{{static_url('css/font-awesome.min.css')}}">
  91. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/goods.css')}}"/>
  92. <div id="goods-index" class=" rightlist ">
  93. <div class="right-titpos">
  94. <ul class="add-snav">
  95. <li class="active"><a href="#">商品列表</a></li>
  96. <li class="active"><a href="{{yzWebFullUrl('plugin.jd-supply.admin.label-import.index')}}">标签导入</a></li>
  97. </ul>
  98. </div>
  99. <div class="right-addbox">
  100. <div id="app" v-cloak>
  101. <div class="panel panel-info">
  102. <div class="panel-item" >
  103. <div class="panel-info-lable">
  104. <i class="iconfont icon-ht_basis_goodgroup"></i>
  105. <span>商品来源</span>
  106. </div>
  107. <div class="panel-info-content" style="flex-wrap: nowrap;">
  108. <el-select v-model="search_form.commission_agent" clearable placeholder="请选择商品库" @change="changeWarehouse" clearable>
  109. <el-option v-for="(item,i) in goods_agent" :key="i" :label="item.label" :value="item.value"></el-option>
  110. </el-select>
  111. <el-radio-group v-model="search_form.source" @change="changeNav">
  112. <el-radio-button v-for="(item,i) in goods_source" :label="item.value" :key="item.value">
  113. <img v-if="item.url" :src='goods_source_url(item.url)'>
  114. <div v-else>[[item.label]]</div>
  115. </el-radio-button>
  116. </el-radio-group>
  117. </div>
  118. </div>
  119. <div class="panel-item">
  120. <div class="panel-info-lable">
  121. <i class="iconfont icon-fontclass-fenlei"></i>
  122. <span>类目</span>
  123. </div>
  124. <div class="panel-info-content" style="flex: 1;display:flex;">
  125. <el-select v-model="search_form.cate_v1" placeholder="请选择一级分类" clearable @change="searchCateV2">
  126. <el-option v-for="item in search_cate_v1" :key="item.id" :label="item.title" :value="item.id"></el-option>
  127. </el-select>
  128. <el-select v-model="search_form.cate_v2" placeholder="请选择二级分类" clearable @change="searchCateV3">
  129. <el-option v-for="item in search_cate_v2" :key="item.id" :label="item.title" :value="item.id"></el-option>
  130. </el-select>
  131. <el-select v-model="search_form.cate_v3" placeholder="请选择三级分类" clearable>
  132. <el-option v-for="item in search_cate_v3" :key="item.id" :label="item.title" :value="item.id"></el-option>
  133. </el-select>
  134. </div>
  135. </div>
  136. <div class="panel-item" style="margin-bottom: 0;">
  137. <div class="panel-info-lable">
  138. <i class="iconfont icon-ht_left_diymodeladmin"></i>
  139. <span>商品属性</span>
  140. </div>
  141. <div class="panel-info-content">
  142. <template>
  143. <item text="毛利率:" :list="gross_profit_rate" unit="%" keys="gross_profit_rate" @change="changeItem" ref="item0"></item>
  144. <item text="利润率:" :list="promote_rate" unit="%" keys="promote_rate" @change="changeItem" ref="item1"></item>
  145. <item text="协议价:" :list="agreement_price" unit="元" keys="agreement_price" @change="changeItem" ref="item2"></item>
  146. <item text="指导价:" :list="guide_price" unit="元" keys="guide_price" @change="changeItem" ref="item3"></item>
  147. <item text="营销价:" :list="guide_price" unit="元" keys="activity_price" @change="changeItem" ref="item4"></item>
  148. <item text="折扣:" :list="discount" unit="折" keys="discount" @change="changeItem" ref="item5"></item>
  149. </template>
  150. <div style="margin-bottom: 6px;" >
  151. <span>是否包邮:</span>
  152. <el-select v-model="search_form.shipping" clearable placeholder="是否包邮" clearable >
  153. <el-option v-for="(item,index) in goods_shipping"
  154. :key="index" :label="item.label" :value="item.value">
  155. </el-option>
  156. </el-select>
  157. </div>
  158. <div style="margin-bottom: 6px;">
  159. <span>是否已导入:</span>
  160. <el-select v-model="search_form.goods_import" clearable placeholder="是否已导入" clearable >
  161. <el-option v-for="(item,index) in goods_import"
  162. :key="index" :label="item.label" :value="item.value">
  163. </el-option>
  164. </el-select>
  165. </div>
  166. </div>
  167. </div>
  168. <div v-if="search_form.commission_agent != 0" class="panel-item" style="margin-top: 0;">
  169. <div class="panel-info-lable">
  170. <i class="iconfont icon-ht_marketing_article"></i>
  171. <span>营销活动</span>
  172. </div>
  173. <div class="panel-info-content Marketing-item-box">
  174. <template v-for="(item,i) in goods_group">
  175. <el-button :type="item.id==search_form.goods_group?'primary':''"
  176. @click="changeMarketing(item.id)">
  177. [[item.name]]
  178. </el-button>
  179. </template>
  180. </div>
  181. </div>
  182. <div class="panel-item">
  183. <div class="panel-info-lable">
  184. <i class="iconfont icon-ht_basis_searchframe"></i>
  185. <span>关键词</span>
  186. </div>
  187. <div class="panel-info-content">
  188. <el-input v-model="search_form.word" placeholder="商品名称、品牌id" style="width: 200px;"></el-input>
  189. <el-input v-model="search_form.shop_words" placeholder="店铺名称、id" style="width: 200px;"></el-input>
  190. <div>
  191. <el-button style="width: 100px;" @click="Reset">重置</el-button>
  192. <el-button icon="el-icon-search" type="primary" style="width: 100px;" @click="search()">搜索</el-button>
  193. </div>
  194. </div>
  195. </div>
  196. </div>
  197. <div class="panel panel-default" style="border-radius:8px">
  198. <div class=" table-responsive">
  199. <div v-loading="loading">
  200. <div>
  201. <el-checkbox v-model.number="is_all_choose" :true-label="1" :false-label="0" @change="allChoose">[[is_all_choose==1?'全不选':'全选']]</el-checkbox>
  202. <div style="display:inline-block;margin:0 10px;cursor: pointer;" :style="{color:search_form.goods_type=='created_time'?'#29BA9C':'#333'}" @click="changeOrderBy('created_time')">
  203. <span style="font-weight:500">最新上架</span>
  204. <span class="caret-wrapper">
  205. <i class="el-icon-bottom" style="line-height: 25px;font-weight:700"></i>
  206. </span>
  207. </div>
  208. <div style="display:inline-block;margin:0 10px;cursor: pointer;" :style="{color:search_form.goods_type=='real_month_sale'?'#29BA9C':'#333'}" @click="changeOrderBy('real_month_sale')">
  209. <span style="font-weight:500">本月销量</span>
  210. <span class="caret-wrapper">
  211. <i class="el-icon-bottom" style="line-height: 25px;font-weight:700"></i>
  212. </span>
  213. </div>
  214. <div style="display:inline-block;margin:0 10px;cursor: pointer;" :style="{color:(search_form.goods_type=='agreement_price')?'#29BA9C':'#333'}" @click="changeOrderBy('agreement_price')">
  215. <span style="font-weight:500">协议价</span>
  216. <span class="caret-wrapper">
  217. <i class="caret-top" :style="{borderBottomColor:search_form.agreement_price_sort=='asc'?'#29BA9C':'#333'}"></i>
  218. <i class="caret-bottom" :style="{borderTopColor:search_form.agreement_price_sort=='desc'?'#29BA9C':'#333'}"></i>
  219. </span>
  220. </div>
  221. <div style="display:inline-block;margin:0 10px;cursor: pointer;" :style="{color:(search_form.goods_type=='guide_price')?'#29BA9C':'#333'}" @click="changeOrderBy('guide_price')">
  222. <span style="font-weight:500">指导价</span>
  223. <span class="caret-wrapper">
  224. <i class="caret-top" :style="{borderBottomColor:search_form.guide_price_sort=='asc'?'#29BA9C':'#333'}"></i>
  225. <i class="caret-bottom" :style="{borderTopColor:search_form.guide_price_sort=='desc'?'#29BA9C':'#333'}"></i>
  226. </span>
  227. </div>
  228. <div style="display:inline-block;margin:0 10px;cursor: pointer;" :style="{color:(search_form.goods_type=='activity_price')?'#29BA9C':'#333'}" @click="changeOrderBy('activity_price')">
  229. <span style="color:#333;font-weight:500">营销价</span>
  230. <span class="caret-wrapper">
  231. <i class="caret-top" :style="{borderBottomColor:search_form.activity_price_sort=='asc'?'#29BA9C':'#333'}"></i>
  232. <i class="caret-bottom" :style="{borderTopColor:search_form.activity_price_sort=='desc'?'#29BA9C':'#333'}"></i>
  233. </span>
  234. </div>
  235. <div style="display:inline-block;margin:0 10px;cursor: pointer;" :style="{color:(search_form.goods_type=='promotion_rate')?'#29BA9C':'#333'}" @click="changeOrderBy('promotion_rate')">
  236. <span style="color:#333;font-weight:500">常规利润率</span>
  237. <span class="caret-wrapper">
  238. <i class="caret-top" :style="{borderBottomColor:search_form.promotion_rate_sort=='asc'?'#29BA9C':'#333'}"></i>
  239. <i class="caret-bottom" :style="{borderTopColor:search_form.promotion_rate_sort=='desc'?'#29BA9C':'#333'}"></i>
  240. </span>
  241. </div>
  242. <div style="display:inline-block;margin:0 10px;cursor: pointer;" :style="{color:(search_form.goods_type=='activity_rate')?'#29BA9C':'#333'}" @click="changeOrderBy('activity_rate')">
  243. <span style="color:#333;font-weight:500">营销利润率</span>
  244. <span class="caret-wrapper">
  245. <i class="caret-top" :style="{borderBottomColor:search_form.activity_rate_sort=='asc'?'#29BA9C':'#333'}"></i>
  246. <i class="caret-bottom" :style="{borderTopColor:search_form.activity_rate_sort=='desc'?'#29BA9C':'#333'}"></i>
  247. </span>
  248. </div>
  249. </div>
  250. <div class="flex">
  251. <div class="box-lis" v-for="(item,index) in list" :key="index">
  252. <div class="box-li" >
  253. <div class="box-li-img">
  254. <img :src="item.cover" :alt="item.title" :title="item.title">
  255. <div class="box-li-detail">
  256. <div @click="watchDetail(item)" class="watch-detail">查看详情</div>
  257. <div class="is_selected">
  258. <template v-if="item.is_presence">已导入</template>
  259. <el-checkbox v-else v-model.number="item.is_choose" :true-label="1" :false-label="0" @change="oneChange(item)"></el-checkbox>
  260. </div>
  261. </div>
  262. </div>
  263. <div class="box-li-title" style="margin:5px;">
  264. <span @click="watchDetail(item)">[[item.title]]</span>
  265. </div>
  266. <div class="box-li-price">
  267. <div class="box-li-price-one">
  268. <div>协议价</div>
  269. <div style="color:#FF0000">¥[[item.agreement_price || '--']]</div>
  270. </div>
  271. <div class="box-li-price-one">
  272. <div>利润率</div>
  273. <div style="color:#FF0000">[[item.promotion_rate || '--']]%</div>
  274. </div>
  275. <div class="isshow-item">
  276. <div style="min-width: 25%;">
  277. <div>指导价</div>
  278. <div class="text-vertical" style="color:#FF0000">¥[[item.guide_price||'--']]</div>
  279. </div>
  280. <div style="min-width: 25%;">
  281. <div>最小利润</div>
  282. <div class="text-vertical" style="color:#FF0000">¥[[item.min_profits||'--']]</div>
  283. </div>
  284. <div style="flex: 1;">
  285. <div>折扣</div>
  286. <div class="text-vertical" style="color:#FF0000">[[item.discount||'--']]折</div>
  287. </div>
  288. <div style="flex:1;">
  289. <div>毛利率</div>
  290. <div class="text-vertical" style="color:#FF0000">[[item.gross_profit_rate||'--']]%</div>
  291. </div>
  292. </div>
  293. </div>
  294. </div>
  295. </div>
  296. </div>
  297. <div class="vue-page">
  298. <div style="display:flex;">
  299. <div v-if="create_category == 1" class="tips">
  300. 已开启自动匹配分类,如不选择导入分类则自动匹配或创建分类!(阿里商品不支持)
  301. </div>
  302. <div style="text-align: right;flex:1;">
  303. <el-pagination layout="sizes,prev, pager, next,jumper" @current-change="search" v-if="total/per_size >=50" :total="per_size*50"
  304. :page-size="per_size" :current-page="current_page" background :page-sizes="goods_page_size"
  305. @size-change="handleSizeChange" v-loading="loading">
  306. </el-pagination>
  307. <el-pagination layout="sizes,prev, pager, next,jumper" @current-change="search" v-if="total/per_size <50" :total="total"
  308. :page-size="per_size" :current-page="current_page" background :page-sizes="goods_page_size"
  309. @size-change="handleSizeChange" v-loading="loading">
  310. </el-pagination>
  311. </div>
  312. </div>
  313. <div class="import-class" >
  314. <div>选择导入分类</div>
  315. <el-select size="small" v-model="category_form.id_v1" placeholder="请选择一级分类" clearable @change="changeV1()">
  316. <el-option v-for="item in category_list" :key="item.id" :label="item.name" :value="item.id"></el-option>
  317. </el-select>
  318. <el-select size="small" v-model="category_form.id_v2" placeholder="请选择二级分类" clearable @change="changeV2()">
  319. <el-option v-for="item in category_list_v2" :key="item.id" :label="item.name" :value="item.id"></el-option>
  320. </el-select>
  321. <el-select size="small" v-model="category_form.id_v3" placeholder="请选择三级分类" clearable v-if="category_level == 3">
  322. <el-option v-for="item in category_list_v3" :key="item.id" :label="item.name" :value="item.id"></el-option>
  323. </el-select>
  324. <div>选择导入商品标签</div>
  325. <el-select size="small" v-model="category_form.fid_v1" placeholder="请选择标签组" clearable @change="filteringV1()">
  326. <el-option v-for="item in filtering_list" :key="item.id" :label="item.name" :value="item.id"></el-option>
  327. </el-select>
  328. <el-select size="small" v-model="category_form.fid_v2" placeholder="请选择标签值" clearable >
  329. <el-option v-for="item in filtering_list_v2" :key="item.id" :label="item.name" :value="item.id"></el-option>
  330. </el-select>
  331. <div>
  332. <el-button size="small" type="primary" @click="confirm" :disabled="is_import_disabled">导入商品[[changeTotal==0?"":"("+changeTotal+")"]]</el-button>
  333. <el-button size="small" type="primary" @click="show_all_import" :disabled="is_import_disabled">导入全部筛选商品([[total>=2500?2500:total]])</el-button>
  334. </div>
  335. </div>
  336. </div>
  337. </div>
  338. </div>
  339. <div class='panel-footer'>
  340. </div>
  341. </div>
  342. <el-dialog :visible.sync="all_import_show" width="750px" title="导入全部商品">
  343. <el-col style="color: red">共计商品数为[[total]]个,因条件限制该操作只能导入前2500款商品</el-col>
  344. <el-span v-if="import_status">正在导入,请勿刷新当前页面</el-span>
  345. <el-progress v-if="import_status" :percentage="process" ></el-progress>
  346. <span slot="footer" class="dialog-footer">
  347. <el-button @click="all_import_show = false">取 消</el-button>
  348. <el-button type="primary" :disabled="all_import_disabled" @click="all_confirm">确认导入</el-button>
  349. </span>
  350. </el-dialog>
  351. </div>
  352. </div>
  353. </div>
  354. </div>
  355. </div>
  356. <script>
  357. let goods_source = [
  358. {value: "",label: '全部',},
  359. {value: 2,label: '京东',url:"jd",},
  360. {value: 6,label: '阿里',url:"alibaba"},
  361. {value: 7,label: '天猫',url:"tmall"},
  362. {value: 1,label: '云仓',url:"yuncang"},
  363. {value: 8,label: '苏宁'},
  364. {value: 11,label: '华南一仓'},
  365. {value: 14,label: '华东一仓'},
  366. {value: 15,label: '淘宝'},
  367. {value: 12,label: '特卖一仓'},
  368. {value: 16,label: '跨境一仓'},
  369. ];
  370. let item = {
  371. props:["text","list","unit","keys"],
  372. delimiters: ['[[', ']]'],
  373. template:`<div style="margin-bottom: 6px;display:flex;">
  374. <span>[[text]]</span>
  375. <template v-if="value!='自定义区间'">
  376. <el-select v-model="value" placeholder="请选择" @change="change">
  377. <el-option v-for="(item,i) in list" :label="item" :value="item" :key="i"> </el-option>
  378. </el-select>
  379. </template>
  380. <template v-else>
  381. <el-input type="number" placeholder="区间开始" v-model="search.from" style="width: 170px;" @blur="blur">
  382. </el-input>
  383. <div class="line" style="border:0;font-size:25px;">-</div>
  384. <el-input type="number" placeholder="区间结束" v-model="search.to" style="width: 190px;" @blur="blur">
  385. <el-button slot="append">[[unit]]</el-button>
  386. </el-input>
  387. </template>
  388. </div>`,
  389. data(){
  390. return {
  391. value:"",
  392. search:{from:null,to:null}
  393. }
  394. },
  395. methods:{
  396. change(){
  397. if (this.value=="全部") return this.$emit("change",{key:this.keys,isdel:true});
  398. if (this.value=="自定义区间") return;
  399. let val = this.value.split("-");
  400. val[1] = val[1]?parseFloat(val[1]):99999;
  401. this.$emit("change",{search:{from:parseFloat(val[0]),to:val[1]},key:this.keys});
  402. },
  403. blur(){
  404. let search = {};
  405. search.from = this.search.from ? parseFloat(this.search.from):0,
  406. search.to = this.search.to ? parseFloat(this.search.to):99999,
  407. this.$emit("change",{search,key:this.keys});
  408. },
  409. Reset(){
  410. this.value = "",
  411. this.search={from:"",to:""};
  412. }
  413. }
  414. }
  415. var app = new Vue({
  416. el:"#app",
  417. delimiters: ['[[', ']]'],
  418. components:{item},
  419. directives: {
  420. 'el-select-loadmore': {
  421. bind(el, binding) {
  422. // 获取element-ui定义好的scroll盒子
  423. const SELECTWRAP_DOM = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap');
  424. SELECTWRAP_DOM.addEventListener('scroll', function () {
  425. /**
  426. * scrollHeight 获取元素内容高度(只读)
  427. * scrollTop 获取或者设置元素的偏移值,常用于, 计算滚动条的位置, 当一个元素的容器没有产生垂直方向的滚动条, 那它的scrollTop的值默认为0.
  428. * clientHeight 读取元素的可见高度(只读)
  429. * 如果元素滚动到底, 下面等式返回true, 没有则返回false:
  430. * ele.scrollHeight - ele.scrollTop === ele.clientHeight;
  431. */
  432. const condition = this.scrollHeight - this.scrollTop <= this.clientHeight;
  433. if (condition) {
  434. binding.value();
  435. }
  436. });
  437. }
  438. }
  439. },
  440. data() {
  441. let category_level = {!! $category_level !!};
  442. let create_category = {!! $create_category !!};
  443. let filtering_list = {!! $filtering_list?:'{}' !!};
  444. let category_list = {!! $category_list?:'{}' !!};
  445. let search_cate_v1 = '{}';
  446. console.log("search_cate_v1",search_cate_v1);
  447. let group_list = {!! $group_list?:'{}' !!};
  448. let app_group_list = {!! $app_group_list?:'{}' !!};
  449. let all_import = {!! $import?:'{}' !!};
  450. let topic_id = {!! $topic_id !!};
  451. return{
  452. changeTotal:0,
  453. is_all_choose:0,
  454. loading:false,
  455. all_loading:false,
  456. page_number: 20, //每页显示条数
  457. all_import_show:false,
  458. import_status:false,
  459. process:0,
  460. list: [],
  461. all_import: all_import,
  462. search_form: {
  463. goods_source:"",
  464. cate_v1:'',
  465. cate_v2:'',
  466. cate_v3:'',
  467. range_type:'',
  468. range_from:'',
  469. range_to:'',
  470. source:'',
  471. commission_agent:'1',
  472. goods_import:"",
  473. topic_id : topic_id,
  474. },
  475. category_page: {
  476. pageIndex: 1,
  477. pageSize: 20,
  478. },
  479. category_form:{
  480. id_v1:"",
  481. id_v2:"",
  482. id_v3:"",
  483. fid_v1:"",
  484. fid_v2:"",
  485. },
  486. goods_source,
  487. gross_profit_rate:["全部","0-35%","35%-50%","50%-75%","75%及以上","自定义区间"],//毛利率
  488. promote_rate:["全部","0-50%","50%-150%","150%-300%","300%及以上","自定义区间"],//利润率
  489. discount:["全部","0-3折","3-5折","5-8折","8折及以上","自定义区间"],//折扣
  490. agreement_price:["全部","0-200元","200-500元","500-1000元","1000元以上","自定义区间"],//协议价
  491. guide_price:["全部","0-200元","200-500元","500-1000元","1000元以上"],//指导价、营销价
  492. goods_shipping:[{
  493. value: '',
  494. label: '全部',
  495. }, {
  496. value: '0',
  497. label: '不包邮'
  498. }, {
  499. value: '1',
  500. label: '包邮'
  501. }],
  502. goods_page_size:[20,50],
  503. goods_import:[{
  504. value: '',
  505. label: '全部'
  506. }, {
  507. value: '1',
  508. label: '未导入'
  509. }, {
  510. value: '2',
  511. label: '已导入'
  512. }],
  513. goods_agent:[{
  514. value: '0',
  515. label: '选品库商品',
  516. }, {
  517. value: '1',
  518. label: '精选商品'
  519. }, {
  520. value: '2',
  521. label: '全部商品'
  522. }],
  523. is_import_disabled : false,
  524. all_import_disabled:false,
  525. filtering_list:filtering_list, //商品标签
  526. filtering_list_v2:[], //商品标签
  527. category_level:category_level,//分类等级
  528. create_category:create_category,//分类等级
  529. category_list:category_list,
  530. category_list_v2:[],
  531. category_list_v3:[],
  532. selectionGoodsIds: [],
  533. goods_group: group_list,
  534. app_goods_group: app_group_list,
  535. search_cate_v1: search_cate_v1,
  536. search_cate_v2: [],
  537. search_cate_v3: [],
  538. //分页
  539. total: 0,
  540. per_size: 0,
  541. current_page: 0,
  542. }
  543. },
  544. created() {
  545. this.getGoodsList({search:{topic_id:this.search_form.topic_id}});
  546. this.changeSource();
  547. },
  548. methods: {
  549. //营销活动切换
  550. changeMarketing(id){
  551. this.$set(this.search_form,'goods_group',id);
  552. this.getGoodsList({search:this.search_form});
  553. },
  554. //每页多少条数据
  555. handleSizeChange(page_number){
  556. this.is_all_choose = 0;
  557. this.changeTotal = 0;
  558. this.page_number = page_number;
  559. this.search();
  560. },
  561. Reset(){
  562. //重置
  563. this.search_form = {
  564. commission_agent:'1',
  565. source:"",
  566. cate_v1:'',
  567. cate_v2:'',
  568. cate_v3:'',
  569. goods_group:"",
  570. word:"",
  571. shop_words:"",
  572. goods_page_size:"",
  573. goods_source:"",
  574. range_type:'',
  575. range_from:'',
  576. range_to:'',
  577. goods_import:"",
  578. };
  579. for (let i = 0; i < 5; i++) {
  580. this.$refs["item"+i].Reset();
  581. };
  582. },
  583. changeItem(obj){
  584. // if (obj.isdel) delete this.search_form[obj.key];
  585. this.search_form[obj.key] = obj.search;
  586. },
  587. //图片地址
  588. goods_source_url(url){
  589. url = `{{resource_get('plugins/jd-supply/assent/image/${url}.png')}}`
  590. return url
  591. },
  592. //查看详情
  593. watchDetail(item){
  594. window.open("{!! yzWebUrl('plugin.jd-supply.admin.goods-import.detail') !!}" + "&id=" + item.id);
  595. },
  596. // 获得商品列表
  597. getGoodsList(json={}) {
  598. json.search.goods_page_size = this.page_number;
  599. let loading = this.$loading({
  600. lock: true,
  601. text:"数据加载中",
  602. spinner: 'el-icon-loading',
  603. background: 'rgba(0, 0, 0, 0.7)'
  604. });
  605. this.all_loading = true;
  606. this.$http.post("{!! yzWebFullUrl('plugin.jd-supply.admin.goods-import.goods-pagination') !!}",json).then(response => {
  607. if(response.data.result==1){
  608. this.list = response.data.data.data;
  609. this.list.forEach((item,index) => {
  610. item.is_choose = 0;
  611. // this.list[index].is_choose = 0;
  612. })
  613. this.current_page = response.data.data.current_page;
  614. this.per_size = response.data.data.per_page;
  615. this.total = response.data.data.total;
  616. this.changeTotal = 0;
  617. this.all_loading = false;
  618. } else{
  619. this.$message.error(response.data.msg);
  620. this.all_loading = false;
  621. }
  622. loading.close();
  623. }),(res)=>{
  624. loading.close();
  625. this.all_loading = false;
  626. };
  627. },
  628. show_all_import()
  629. {
  630. this.all_import_show = true;
  631. },
  632. search(page) {
  633. this.getGoodsList({page:page,search:this.search_form});
  634. },
  635. // 上一页
  636. prev() {
  637. let page = parseInt(this.current_page) - 1;
  638. if (page < 1) {
  639. return false;
  640. }
  641. this.getGoodsList({page:page,search:this.search_form});
  642. },
  643. //下一页
  644. next() {
  645. let page = parseInt(this.current_page) + 1;
  646. if (this.per_size < this.page_number) {
  647. return false;
  648. }
  649. this.getGoodsList({page:page,search:this.search_form});
  650. },
  651. //跳页
  652. jumpPage() {
  653. if (this.current_page <= 1) {
  654. this.current_page = 1;
  655. }
  656. this.getGoodsList({page:this.current_page,search:this.search_form});
  657. },
  658. //选择商品
  659. handleSelectionChange(val) {
  660. var arr = [];
  661. for(var j = 0,len = val.length; j < len; j++){
  662. arr.push(val[j].id);
  663. }
  664. this.selectionGoodsIds = arr;
  665. },
  666. // 一级分类改变
  667. changeV1(){
  668. this.category_form.id_v2 = "";
  669. this.category_form.id_v3 = "";
  670. this.category_list_v2 = [];
  671. this.category_list_v3 = [];
  672. this.category_list.find(item => {
  673. if(item.id == this.category_form.id_v1) {
  674. this.category_list_v2 = item.childrens;
  675. }
  676. });
  677. },
  678. // 二级分类改变
  679. changeV2(){
  680. this.category_form.id_v3 = "";
  681. this.category_list_v3 = [];
  682. if(this.category_level==3) {
  683. this.category_list_v2.find(item => {
  684. if(item.id == this.category_form.id_v2) {
  685. this.category_list_v3 = item.childrens;
  686. }
  687. })
  688. }
  689. },
  690. // 一级分类改变
  691. searchCateV2(){
  692. this.search_form.cate_v2 = "";
  693. this.search_form.cate_v3 = "";
  694. this.search_cate_v2 = [];
  695. this.search_cate_v3 = [];
  696. //搜索二级分类
  697. var source = this.search_form.source;
  698. var parent_id = this.search_form.cate_v1;
  699. // 这里是接口请求数据, 带分页条件
  700. this.$http.post('{!! yzWebFullUrl('plugin.jd-supply.admin.goods-import.getChildrenCategory') !!}',{'source':source,'parent_id':parent_id}).then(response => {
  701. console.log(response.data);
  702. if(response.data.result==1){
  703. this.search_cate_v2 = response.data.data;
  704. }
  705. }),function(res){
  706. console.log(res);
  707. };
  708. },
  709. // 二级分类改变
  710. searchCateV3(){
  711. this.search_form.cate_v3 = "";
  712. this.search_cate_v3 = [];
  713. //搜索三级分类
  714. var source = this.search_form.source;
  715. var parent_id = this.search_form.cate_v2;
  716. // 这里是接口请求数据, 带分页条件
  717. this.$http.post("{!! yzWebFullUrl('plugin.jd-supply.admin.goods-import.getChildrenCategory') !!}",{'source':source,'parent_id':parent_id}).then(response => {
  718. if(response.data.result==1){
  719. this.search_cate_v3 = response.data.data;
  720. }
  721. }),function(res){
  722. console.log(res);
  723. };
  724. },
  725. changeSource() {
  726. let that = this;
  727. that.search_form.cate_v1 = "";
  728. that.search_form.cate_v2 = "";
  729. that.search_form.cate_v3 = "";
  730. that.search_cate_v1 = [];
  731. that.search_cate_v2 = [];
  732. that.search_cate_v3 = [];
  733. let source = that.search_form.source;
  734. that.$http.post("{!! yzWebFullUrl('plugin.jd-supply.admin.goods-import.getChildrenCategory') !!}",{source}).then(response => {
  735. if(response.data.result==1)that.search_cate_v1 = response.data.data;
  736. }),function(res){
  737. console.log(res);
  738. };
  739. },
  740. changeWarehouse() {
  741. if (this.search_form.commission_agent == 0) {
  742. this.search_form.goods_source = "";
  743. this.goods_source = [
  744. {value: '',label: '全部'},
  745. {value: 0,label: '未分组'}
  746. ];
  747. this.app_goods_group.forEach(item => {
  748. this.goods_source.push({
  749. value:item.id,
  750. label:item.name
  751. });
  752. });
  753. } else this.goods_source = goods_source;
  754. },
  755. changeNav(){
  756. this.getGoodsList({search:this.search_form});
  757. this.changeSource();
  758. },
  759. loadmore() {
  760. this.category_page.pageIndex++;
  761. var source = this.search_form.source;
  762. // 这里是接口请求数据, 带分页条件
  763. this.$http.post('{!! yzWebFullUrl('plugin.jd-supply.admin.goods-import.getThirdPartyCategory') !!}',{'source':source,'page':this.category_page.pageIndex}).then(response => {
  764. console.log(response.data);
  765. if(response.data.result==1){
  766. this.thirdPartyCategory = [...this.thirdPartyCategory, ...response.data.data];
  767. }
  768. }),function(res){
  769. console.log(res);
  770. };
  771. },
  772. // 一级标签改变
  773. filteringV1(){
  774. this.category_form.fid_v2 = "";
  775. this. filtering_list_v2 = [];
  776. this.filtering_list.find(item => {
  777. if(item.id == this.category_form.fid_v1) {
  778. this.filtering_list_v2 = item.value;
  779. }
  780. });
  781. },
  782. //导入商品
  783. confirm(){
  784. var that = this;
  785. var arr = {
  786. 'parentid': [],
  787. 'childid':[],
  788. 'thirdid':[],
  789. };
  790. if(this.category_form.fid_v1){
  791. if (!this.category_form.fid_v2) {
  792. this.$message.error("商品标签值不能为空");
  793. return false;
  794. }
  795. }
  796. let loading = this.$loading({
  797. lock: true,
  798. text:`正在导入${this.changeTotal}个商品中`,
  799. spinner: 'el-icon-loading',
  800. background: 'rgba(0, 0, 0, 0.7)'
  801. });
  802. arr.parentid.push(this.category_form.id_v1);
  803. arr.childid.push(this.category_form.id_v2);
  804. if(this.category_form.id_v3){
  805. arr.thirdid.push(this.category_form.id_v3);
  806. }
  807. // let json = {category:arr,goods_ids:this.selectionGoodsIds,f_value_id:this.category_form.fid_v2,commission_agent:this.search_form.commission_agent};
  808. let json = {category:arr,goods_ids:[],f_value_id:this.category_form.fid_v2,commission_agent:this.search_form.commission_agent};
  809. console.log(json)
  810. this.list.forEach(item => {
  811. if(item.is_choose) json.goods_ids.push(item.id);
  812. })
  813. that.is_import_disabled = true;
  814. that.all_loading = true;
  815. that.$http.post("{!! yzWebFullUrl('plugin.jd-supply.admin.goods-import.select') !!}",json).then(response => {
  816. console.log(response);
  817. // that.is_import_disabled = true;
  818. that.all_loading = false;
  819. if(response.data.result==1) {
  820. that.$message.success(response.data.msg);
  821. that.is_import_disabled = false;
  822. this.getGoodsList({page:this.current_page,search:this.search_form});
  823. this.changeTotal = 0;
  824. } else{
  825. that.$message.error(response.data.msg);
  826. that.is_import_disabled = false;
  827. }
  828. loading.close();
  829. }),function(res){
  830. console.log(res);
  831. loading.close();
  832. that.is_import_disabled = true;
  833. that.all_loading = false;
  834. };
  835. },
  836. all_confirm()
  837. {
  838. var that = this;
  839. var arr = {
  840. 'parentid': [],
  841. 'childid':[],
  842. 'thirdid':[],
  843. };
  844. if(this.category_form.fid_v1){
  845. if (!this.category_form.fid_v2) {
  846. this.$message.error("商品标签值不能为空");
  847. return false;
  848. }
  849. }
  850. this.import_status = true
  851. process = 0;
  852. arr.parentid.push(this.category_form.id_v1);
  853. arr.childid.push(this.category_form.id_v2);
  854. if(this.category_form.id_v3){
  855. arr.thirdid.push(this.category_form.id_v3);
  856. }
  857. let json = {category:arr,f_value_id:this.category_form.fid_v2,search:this.search_form};
  858. // that.is_import_disabled = true;
  859. that.all_loading = true;
  860. this.all_import_disabled = true
  861. that.$http.post("{!! yzWebFullUrl('plugin.jd-supply.admin.goods-import.all-select') !!}",json).then(response => {
  862. console.log(response);
  863. that.is_import_disabled = true;
  864. that.all_loading = false;
  865. if(response.data.result==1) {
  866. this.process = parseInt(response.data.data.process)
  867. if (response.data.data.status == true) {
  868. this.process = 0;
  869. this.import_status = false;
  870. this.all_import_show = false;
  871. this.all_import_disabled = false;
  872. this.is_import_disabled = false;
  873. this.$message({type: 'success',message: '导入成功!'});
  874. } else {
  875. this.loop(json, response.data.data.page ,response.data.data.page_cent);
  876. }
  877. } else{
  878. that.$message.error(response.data.msg);
  879. }
  880. }),function(res){
  881. console.log(res);
  882. that.is_import_disabled = true;
  883. that.all_loading = false;
  884. };
  885. },
  886. loop (json,page,page_cent) {
  887. json['page'] = page;
  888. json['page_cent'] = page_cent;
  889. this.$http.post("{!! yzWebFullUrl('plugin.jd-supply.admin.goods-import.all-select') !!}",json)
  890. .then(response => {
  891. if (response.data.result) {
  892. if (response.data.data) {
  893. this.process = parseInt(response.data.data.process);
  894. }
  895. if (response.data.data.status == true) {
  896. this.process = 0;
  897. this.import_status = false;
  898. this.all_import_show = false;
  899. this.all_import_disabled = false;
  900. this.is_import_disabled = false;
  901. this.$message({type: 'success',message: '导入成功!'});
  902. } else {
  903. this.loop(json,response.data.data.page,response.data.data.page_cent);
  904. }
  905. } else {
  906. this.$message({type: 'error',message: response.data.msg});
  907. this.showProgress = false;
  908. }
  909. },response => {
  910. this.$message({type: 'error',message: response.data.msg});
  911. this.showProgress = false;
  912. });
  913. },
  914. oneChange(item) {
  915. let that = this;
  916. this.$forceUpdate();
  917. let is_all = 0;
  918. console.log(item);
  919. this.changeTotal = item.is_choose == 1?this.changeTotal+1:this.changeTotal-1;
  920. that.list.some((item,index) => {
  921. if(item.is_choose == 1) {
  922. is_all = 1;
  923. }
  924. else {
  925. is_all = 0;
  926. return true;
  927. }
  928. })
  929. that.is_all_choose = is_all;
  930. },
  931. // 全选
  932. allChoose() {
  933. let total = 0;
  934. let status = this.is_all_choose == 1?1:0;
  935. this.list.forEach((item,index) => {
  936. if (item.is_presence!=1)total+=1;
  937. item.is_choose = status;
  938. })
  939. this.changeTotal = status? total: 0;
  940. },
  941. changeOrderBy(type) {
  942. var sort = type + '_sort';
  943. var current_sort = this.search_form['goods_type'] + '_sort';
  944. this.search_form[current_sort] = '';
  945. if (type == this.search_form['goods_type']) {
  946. if (this.search_form['goods_sort'] == 'asc') {
  947. this.search_form[sort] = 'desc';
  948. } else {
  949. this.search_form[sort] = 'asc';
  950. }
  951. } else {
  952. this.search_form[sort] = 'desc';
  953. }
  954. this.search_form['goods_sort'] = this.search_form[sort];
  955. this.search_form['goods_type'] = type;
  956. if (type == 'created_time' || type == 'real_month_sale') {
  957. this.search_form['goods_sort'] = 'desc';
  958. }
  959. this.$forceUpdate();
  960. this.getGoodsList({page:1,search:this.search_form});
  961. },
  962. },
  963. })
  964. </script>
  965. @endsection('content')