8fc817836ac8aa087779a6a8af3d62b1.php 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840
  1. <?php /*a:1:{s:65:"D:\phpstudy_pro\WWW\CRMEB\app\admin\view\auction\auction\edit.php";i:1647936702;}*/ ?>
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  7. <link href="/system/frame/css/font-awesome.min.css" rel="stylesheet">
  8. <link href="/system/plug/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
  9. <script type="text/javascript" src="/system/plug/umeditor/third-party/jquery.min.js"></script>
  10. <script type="text/javascript" src="/system/plug/umeditor/third-party/template.min.js"></script>
  11. <script type="text/javascript" charset="utf-8" src="/system/plug/umeditor/umeditor.config.js"></script>
  12. <script type="text/javascript" charset="utf-8" src="/system/plug/umeditor/umeditor.min.js"></script>
  13. <script type="text/javascript" src="/system/plug/umeditor/lang/zh-cn/zh-cn.js"></script>
  14. <link rel="stylesheet" href="/static/plug/layui/css/layui.css">
  15. <script src="/static/plug/layui/layui.js"></script>
  16. <script src="/static/plug/vue/dist/vue.min.js"></script>
  17. <script src="/static/plug/axios.min.js"></script>
  18. <script src="/system/module/widget/aliyun-oss-sdk-4.4.4.min.js"></script>
  19. <script src="/system/module/widget/cos-js-sdk-v5.min.js"></script>
  20. <script src="/system/module/widget/qiniu-js-sdk-2.5.5.js"></script>
  21. <script src="/system/module/widget/plupload.full.min.js"></script>
  22. <script src="/system/module/widget/videoUpload.js"></script>
  23. <style>
  24. .layui-form-item {
  25. margin-bottom: 0px;
  26. }
  27. .pictrueBox {
  28. display: inline-block !important;
  29. }
  30. .pictrue {
  31. width: 60px;
  32. height: 60px;
  33. border: 1px dotted rgba(0, 0, 0, 0.1);
  34. margin-right: 15px;
  35. display: inline-block;
  36. position: relative;
  37. cursor: pointer;
  38. }
  39. .pictrue img {
  40. width: 100%;
  41. height: 100%;
  42. }
  43. .upLoad {
  44. width: 58px;
  45. height: 58px;
  46. line-height: 58px;
  47. border: 1px dotted rgba(0, 0, 0, 0.1);
  48. border-radius: 4px;
  49. background: rgba(0, 0, 0, 0.02);
  50. cursor: pointer;
  51. display: flex;
  52. justify-content: center;
  53. align-items: center;
  54. }
  55. .rulesBox {
  56. display: flex;
  57. flex-wrap: wrap;
  58. margin-left: 10px;
  59. }
  60. .layui-tab-content {
  61. margin-top: 15px;
  62. }
  63. .ml110 {
  64. margin: 18px 0 4px 110px;
  65. }
  66. .rules {
  67. display: flex;
  68. }
  69. .rules-btn-sm {
  70. height: 30px;
  71. line-height: 30px;
  72. font-size: 12px;
  73. width: 109px;
  74. }
  75. .rules-btn-sm input {
  76. width: 79% !important;
  77. height: 84% !important;
  78. padding: 0 10px;
  79. }
  80. .ml10 {
  81. margin-left: 10px !important;
  82. }
  83. .ml40 {
  84. margin-left: 40px !important;
  85. }
  86. .closes {
  87. position: absolute;
  88. left: 86%;
  89. top: -18%;
  90. }
  91. .red {
  92. color: red;
  93. }
  94. .layui-input-block .layui-video-box{
  95. width: 22%;
  96. height: 180px;
  97. border-radius: 10px;
  98. background-color: #707070;
  99. margin-top: 10px;
  100. position: relative;
  101. overflow: hidden;
  102. }
  103. .layui-input-block .layui-video-box i{
  104. color: #fff;
  105. line-height: 180px;
  106. margin: 0 auto;
  107. width: 50px;
  108. height: 50px;
  109. display: inherit;
  110. font-size: 50px;
  111. }
  112. .layui-input-block .layui-video-box .mark{
  113. position: absolute;
  114. width: 100%;
  115. height: 30px;
  116. top: 0;
  117. background-color: rgba(0,0,0,.5);
  118. text-align: center;
  119. }
  120. .store_box{
  121. display: flex;
  122. }
  123. .info{
  124. color: #c9c9c9;
  125. padding-left: 10px;
  126. line-height: 30px;
  127. }
  128. </style>
  129. </head>
  130. <body>
  131. <div class="layui-fluid">
  132. <div class="layui-row layui-col-space15" id="app" v-cloak="">
  133. <div class="layui-card">
  134. <div class="layui-card-header">
  135. <span class="">竞拍添加</span>
  136. <button style="margin-left: 20px" type="button" class="layui-btn layui-btn-primary layui-btn-xs" @click="goBack">返回列表</button>
  137. </div>
  138. <div class="layui-card-body">
  139. <form class="layui-form" action="" v-cloak="">
  140. <div class="layui-tab layui-tab-brief" lay-filter="docTabBrief">
  141. <div class="layui-tab-content">
  142. <div class="layui-tab-item layui-show">
  143. <div class="layui-row layui-col-space15">
  144. <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
  145. <div class="grid-demo grid-demo-bg1">
  146. <div class="layui-form-item">
  147. <label class="layui-form-label">商品名称<i class="red">*</i></label>
  148. <div class="layui-input-block">
  149. <input type="text" name="nickname" lay-verify="title" autocomplete="off"
  150. placeholder="竞拍名称" class="layui-input" v-model="formData.nickname" maxlength="100">
  151. </div>
  152. </div>
  153. </div>
  154. </div>
  155. <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
  156. <div class="grid-demo grid-demo-bg1">
  157. <div class="layui-form-item">
  158. <label class="layui-form-label">竞拍封面图<i class="red">*</i></label>
  159. <div class="pictrueBox">
  160. <div class="pictrue" v-if="formData.image" @click="uploadImage('image')">
  161. <img :src="formData.image"></div>
  162. <div class="upLoad" @click="uploadImage('image')" v-else>
  163. <i class="layui-icon layui-icon-camera" class="iconfont"
  164. style="font-size: 26px;"></i>
  165. </div>
  166. </div>
  167. </div>
  168. </div>
  169. </div>
  170. <!-- <div class="layui-row layui-col-space15">-->
  171. <!-- <div class="layui-col-xs12 layui-col-sm4 layui-col-md4">-->
  172. <!-- <div class="grid-demo grid-demo-bg1">-->
  173. <!-- <div class="layui-form-item">-->
  174. <!-- <label class="layui-form-label">商品状态</label>-->
  175. <!-- <div class="layui-input-block">-->
  176. <!-- <input id="status" type="radio" name="status" lay-filter="status" value="1" title="正常" :checked="formData.status == 1 ? true : false">-->
  177. <!-- <input id="status" type="radio" name="status" lay-filter="status" value="0" title="禁用" :checked="formData.status == 0 ? true : false">-->
  178. <!-- </div>-->
  179. <!-- </div>-->
  180. <!-- </div>-->
  181. <!-- </div>-->
  182. <!-- </div>-->
  183. <div class="layui-row layui-col-space15">
  184. <div class="layui-col-xs12 layui-col-sm4 layui-col-md4">
  185. <div class="grid-demo grid-demo-bg1">
  186. <div class="layui-form-item">
  187. <label class="layui-form-label">预约时间<i class="red ">*</i></label>
  188. <div class="layui-input-inline">
  189. <input type="text" class="layui-input" name="time" id="time" value="" placeholder="-">
  190. </div>
  191. </div>
  192. </div>
  193. </div>
  194. </div>
  195. <div class="layui-row layui-col-space15">
  196. <div class="layui-col-xs12 layui-col-sm4 layui-col-md4">
  197. <div class="grid-demo grid-demo-bg1">
  198. <div class="layui-form-item">
  199. <label class="layui-form-label">进场时间<i class="red">*</i></label>
  200. <div class="layui-input-inline">
  201. <input type="text" class="layui-input" name="rtime" id="rtime" value="" placeholder="-">
  202. </div>
  203. </div>
  204. </div>
  205. </div>
  206. </div>
  207. <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
  208. <div class="grid-demo grid-demo-bg1">
  209. <div class="layui-form-item">
  210. <label class="layui-form-label">排序<i class="red">*</i></label>
  211. <div class="layui-input-inline">
  212. <input type="number" name="sort" lay-verify="title" autocomplete="off" class="layui-input" v-model="formData.sort" maxlength="100" value="0">
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. </div>
  218. </div>
  219. <div class="layui-tab-content">
  220. <div class="layui-row layui-col-space15">
  221. <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
  222. <button class="layui-btn layui-btn-normal layui-btn-sm" id="submit" type="button" @click="handleSubmit()">提交</button>
  223. </div>
  224. </div>
  225. </div>
  226. </div>
  227. </form>
  228. </div>
  229. </div>
  230. </div>
  231. </div>
  232. <script>
  233. var id = <?php echo htmlentities($id); ?>;
  234. var add_time = '<?php echo htmlentities($dataList['add_time']); ?>';
  235. var end_time = '<?php echo htmlentities($dataList['end_time']); ?>';
  236. var radd_time = '<?php echo htmlentities($dataList['radd_time']); ?>';
  237. var rend_time = '<?php echo htmlentities($dataList['rend_time']); ?>';
  238. layui.use('laydate', function(){
  239. var laydate = layui.laydate;
  240. laydate.render({
  241. elem: '#time'
  242. ,type: 'time'
  243. ,range: true
  244. ,value: add_time+'-'+end_time
  245. });
  246. laydate.render({
  247. elem: '#rtime'
  248. ,type: 'time'
  249. ,range: true
  250. ,value: radd_time+'-'+rend_time
  251. });
  252. })
  253. //Demo
  254. layui.use('form', function(){
  255. var form = layui.form;
  256. //监听提交
  257. form.on('submit(formDemo)', function(data){
  258. layer.msg(JSON.stringify(data.field));
  259. return false;
  260. });
  261. });
  262. new Vue({
  263. el: '#app',
  264. data: {
  265. id:id,
  266. //分类列表
  267. cateList: [],
  268. //运费模板
  269. tempList: [],
  270. upload:{
  271. videoIng:false
  272. },
  273. formData: {
  274. },
  275. rule: { //多图选择规则
  276. slider_image: {
  277. maxLength: 1
  278. }
  279. },
  280. attr: [],//临时属性
  281. newRule: false,//是否添加新规则
  282. radioRule: ['status'],//radio 当选规则
  283. ruleList:[],
  284. ruleIndex:-1,
  285. progress: 0,
  286. um: null,//编译器实例化
  287. form: null,//layui.form
  288. layTabId: 1,
  289. ruleBool: id ? true : false,
  290. },
  291. watch:{
  292. 'formData.is_sub':function (n) {
  293. if (n == 1) {
  294. this.formHeader.push({title:'一级返佣(元)'});
  295. this.formHeader.push({title:'二级级返佣(元)'});
  296. } else {
  297. this.formHeader.pop();
  298. this.formHeader.pop();
  299. }
  300. },
  301. 'formData.spec_type':function (n) {
  302. if (n) {
  303. this.render();
  304. }
  305. },
  306. // 'formData.image':function (n) {
  307. // if(!this.batchAttr.pic){
  308. // this.batchAttr.pic = n;
  309. // }
  310. // if(!this.formData.attr.pic){
  311. // this.formData.attr.pic = n;
  312. // }
  313. // }
  314. },
  315. methods: {
  316. back:function(){
  317. var that = this;
  318. layui.use(['element'], function () {
  319. layui.element.tabChange('docTabBrief', that.layTabId == 1 ? 1 : parseInt(that.layTabId) - 1);
  320. });
  321. },
  322. next:function(){
  323. var that = this;
  324. layui.use(['element'], function () {
  325. layui.element.tabChange('docTabBrief', that.layTabId == 3 ? 3 : parseInt(that.layTabId) + 1);
  326. });
  327. },
  328. goBack:function(){
  329. location.href = this.U({c:'auction.auction',a:'index'});
  330. },
  331. U: function (opt) {
  332. var m = opt.m || 'admin', c = opt.c || window.controlle || '', a = opt.a || 'index', q = opt.q || '',
  333. p = opt.p || {};
  334. var params = Object. keys(p).map(function (key) {
  335. return key + '/' + p[key];
  336. }).join('/');
  337. var gets = Object.keys(q).map(function (key) {
  338. return key+'='+ q[key];
  339. }).join('&');
  340. return '/' + m + '/' + c + '/' + a + (params == '' ? '' : '/' + params) + (gets == '' ? '' : '?' + gets);
  341. },
  342. /**
  343. * 提示
  344. * */
  345. showMsg: function (msg, success) {
  346. $('#submit').removeAttr('disabled').text('提交');
  347. layui.use(['layer'], function () {
  348. layui.layer.msg(msg, success);
  349. });
  350. },
  351. addBrokerage:function(){
  352. if (this.brokerage.brokerage >= 0 && this.brokerage.brokerage_two >= 0){
  353. var that = this;
  354. this.$set(this.formData,'attrs',this.formData.attrs.map(function (item) {
  355. item.brokerage = that.brokerage.brokerage;
  356. item.brokerage_two = that.brokerage.brokerage_two;
  357. return item;
  358. }));
  359. } else {
  360. return this.showMsg('请填写返佣金额在进行批量添加');
  361. }
  362. },
  363. batchClear:function(){
  364. this.$set(this,'batchAttr',{
  365. pic: '',
  366. price: 0,
  367. cost: 0,
  368. ot_price: 0,
  369. stock: 0,
  370. bar_code: '',
  371. weight: 0,
  372. volume: 0,
  373. });
  374. },
  375. /**
  376. * 批量添加
  377. * */
  378. batchAdd:function(){
  379. var that = this;
  380. this.$set(this.formData,'attrs',this.formData.attrs.map(function (item) {
  381. if (that.batchAttr.pic) {
  382. item.pic = that.batchAttr.pic;
  383. }
  384. if (that.batchAttr.price > 0){
  385. item.price = that.batchAttr.price;
  386. }
  387. if (that.batchAttr.cost > 0){
  388. item.cost = that.batchAttr.cost;
  389. }
  390. if (that.batchAttr.ot_price > 0){
  391. item.ot_price = that.batchAttr.ot_price;
  392. }
  393. if (that.batchAttr.stock > 0){
  394. item.stock = that.batchAttr.stock;
  395. }
  396. if (that.batchAttr.bar_code != ''){
  397. item.bar_code = that.batchAttr.bar_code;
  398. }
  399. if (that.batchAttr.weight > 0){
  400. item.weight = that.batchAttr.weight;
  401. }
  402. if (that.batchAttr.volume > 0){
  403. item.volume = that.batchAttr.volume;
  404. }
  405. return item;
  406. }));
  407. },
  408. /**
  409. * 获取商品信息
  410. * */
  411. getProductInfo: function () {
  412. var that = this;
  413. that.requestGet(that.U({c:"auction.auction",a:'get_auction',q:{id:that.id}})).then(function (res) {
  414. var productInfo = res.data.productInfo || {};
  415. if(productInfo.id && that.id){
  416. that.$set(that,'formData',productInfo);
  417. that.generate();
  418. }
  419. that.getRuleList();
  420. that.init();
  421. }).catch(function (res) {
  422. that.showMsg(res.msg);
  423. })
  424. },
  425. /**
  426. * 给某个属性添加属性值
  427. * @param item
  428. * */
  429. addDetail: function (item) {
  430. if (!item.detailValue) return false;
  431. if (item.detail.find(function (val) {
  432. if(item.detailValue == val){
  433. return true;
  434. }
  435. })) {
  436. return this.showMsg('添加的属性值重复');
  437. }
  438. item.detail.push(item.detailValue);
  439. item.detailValue = '';
  440. },
  441. /**
  442. * 删除某个属性值
  443. * @param item 父级循环集合
  444. * @param inx 子集index
  445. * */
  446. deleteValue: function (item, inx) {
  447. if (item.detail.length > 1) {
  448. item.detail.splice(inx, 1);
  449. } else {
  450. return this.showMsg('请设置至少一个属性');
  451. }
  452. },
  453. /**
  454. * 删除某条属性
  455. * @param index
  456. * */
  457. deleteItem: function (index) {
  458. this.formData.items.splice(index, 1);
  459. },
  460. /**
  461. * 删除某条属性
  462. * @param index
  463. * */
  464. deleteAttrs: function (index) {
  465. var that = this;
  466. if(that.id > 0){
  467. that.requestGet(that.U({c:"store.StoreProduct",a:'check_activity',q:{id:that.id}})).then(function (res) {
  468. that.showMsg(res.msg);
  469. }).catch(function (res) {
  470. if (that.formData.attrs.length > 1) {
  471. that.formData.attrs.splice(index, 1);
  472. } else {
  473. return that.showMsg('请设置至少一个规则');
  474. }
  475. })
  476. }else{
  477. if (that.formData.attrs.length > 1) {
  478. that.formData.attrs.splice(index, 1);
  479. } else {
  480. return that.showMsg('请设置至少一个规则');
  481. }
  482. }
  483. },
  484. /**
  485. * 创建属性
  486. * */
  487. createAttrName: function () {
  488. if (this.formDynamic.attrsName && this.formDynamic.attrsVal) {
  489. if (this.formData.items.find(function (val) {
  490. if (val.value == this.formDynamic.attrsName) {
  491. return true;
  492. }
  493. }.bind(this))) {
  494. return this.showMsg('添加的属性重复');
  495. }
  496. this.formData.items.push({
  497. value: this.formDynamic.attrsName,
  498. detailValue: '',
  499. attrHidden: false,
  500. detail: [this.formDynamic.attrsVal]
  501. });
  502. this.formDynamic.attrsName = '';
  503. this.formDynamic.attrsVal = '';
  504. this.newRule = false;
  505. } else {
  506. return this.showMsg('请添加完整的规格!');
  507. }
  508. },
  509. /**
  510. * 删除图片
  511. * */
  512. deleteImage: function (key, index) {
  513. var that = this;
  514. if (index != undefined) {
  515. that.formData[key].splice(index, 1);
  516. that.$set(that.formData, key, that.formData[key]);
  517. } else {
  518. that.$set(that.formData, key, '');
  519. }
  520. },
  521. createFrame: function (title, src, opt) {
  522. opt === undefined && (opt = {});
  523. var h = 0;
  524. if (window.innerHeight < 800 && window.innerHeight >= 700) {
  525. h = window.innerHeight - 50;
  526. } else if (window.innerHeight < 900 && window.innerHeight >= 800) {
  527. h = window.innerHeight - 100;
  528. } else if (window.innerHeight < 1000 && window.innerHeight >= 900) {
  529. h = window.innerHeight - 150;
  530. } else if (window.innerHeight >= 1000) {
  531. h = window.innerHeight - 200;
  532. } else {
  533. h = window.innerHeight;
  534. }
  535. var area = [(opt.w || window.innerWidth / 2) + 'px', (!opt.h || opt.h > h ? h : opt.h) + 'px'];
  536. layui.use('layer',function () {
  537. return layer.open({
  538. type: 2,
  539. title: title,
  540. area: area,
  541. fixed: false, //不固定
  542. maxmin: true,
  543. moveOut: false,//true 可以拖出窗外 false 只能在窗内拖
  544. anim: 5,//出场动画 isOutAnim bool 关闭动画
  545. offset: 'auto',//['100px','100px'],//'auto',//初始位置 ['100px','100px'] t[ 上 左]
  546. shade: 0,//遮罩
  547. resize: true,//是否允许拉伸
  548. content: src,//内容
  549. move: '.layui-layer-title'
  550. });
  551. });
  552. },
  553. changeIMG: function (name, value) {
  554. if (this.getRule(name).maxLength !== undefined) {
  555. var that = this;
  556. value.map(function (v) {
  557. that.formData[name].push(v);
  558. });
  559. this.$set(this.formData, name, this.formData[name]);
  560. } else {
  561. if(name == 'batchAttr.pic'){
  562. this.batchAttr.pic = value;
  563. } else {
  564. if (name.indexOf('.') !== -1) {
  565. var key = name.split('.');
  566. if (key.length == 2){
  567. this.formData[key[0]][key[1]] = value;
  568. } else if(key.length == 3){
  569. this.formData[key[0]][key[1]][key[2]] = value;
  570. } else if(key.length == 4){
  571. this.$set(this.formData[key[0]][key[1]][key[2]],key[3],value)
  572. }
  573. } else {
  574. this.formData[name] = value;
  575. }
  576. }
  577. }
  578. },
  579. getRule: function (name) {
  580. return this.rule[name] || {};
  581. },
  582. uploadImage: function (name) {
  583. return this.createFrame('选择图片',this.U({c:"widget.images",a:'index',p:{fodder:name}}),{h:545,w:900});
  584. },
  585. uploadVideo: function () {
  586. if (this.videoLink) {
  587. this.formData.video_link = this.videoLink;
  588. } else {
  589. $(this.$refs.filElem).click();
  590. }
  591. },
  592. delVideo: function () {
  593. var that = this;
  594. that.$set(that.formData, 'video_link', '');
  595. },
  596. insertEditor: function (list) {
  597. this.um.execCommand('insertimage', list);
  598. },
  599. insertEditorVideo: function (src) {
  600. this.um.setContent('<div><video style="width: 99%" src="'+src+'" class="video-ue" controls="controls" width="100"><source src="'+src+'"></source></video></div><br>',true);
  601. },
  602. getContent: function () {
  603. return this.um.getContent();
  604. },
  605. /**
  606. * 监听radio字段
  607. */
  608. eeventRadio: function () {
  609. var that = this;
  610. that.radioRule.map(function (val) {
  611. that.form.on('radio(' + val + ')', function (res) {
  612. that.formData[val] = res.value;
  613. });
  614. })
  615. },
  616. init: function () {
  617. var that = this;
  618. window.UMEDITOR_CONFIG.toolbar = [
  619. // 加入一个 test
  620. 'source | undo redo | bold italic underline strikethrough | superscript subscript | forecolor backcolor | removeformat |',
  621. 'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontfamily fontsize',
  622. '| justifyleft justifycenter justifyright justifyjustify |',
  623. 'link unlink | emotion selectimgs video | map',
  624. '| horizontal print preview fullscreen', 'drafts', 'formula'
  625. ];
  626. UM.registerUI('selectimgs', function (name) {
  627. var me = this;
  628. var $btn = $.eduibutton({
  629. icon: 'image',
  630. click: function () {
  631. that.createFrame('选择图片', "<?php echo Url('widget.images/index',['fodder'=>'editor']); ?>");
  632. },
  633. title: '选择图片'
  634. });
  635. this.addListener('selectionchange', function () {
  636. //切换为不可编辑时,把自己变灰
  637. var state = this.queryCommandState(name);
  638. $btn.edui().disabled(state == -1).active(state == 1)
  639. });
  640. return $btn;
  641. });
  642. UM.registerUI('video', function (name) {
  643. var me = this;
  644. var $btn = $.eduibutton({
  645. icon: 'video',
  646. click: function () {
  647. that.createFrame('选择视频', "<?php echo Url('widget.video/index',['fodder'=>'video']); ?>");
  648. },
  649. title: '选择视频'
  650. });
  651. this.addListener('selectionchange', function () {
  652. //切换为不可编辑时,把自己变灰
  653. var state = this.queryCommandState(name);
  654. $btn.edui().disabled(state == -1).active(state == 1)
  655. });
  656. return $btn;
  657. });
  658. //实例化编辑器
  659. this.um = UM.getEditor('myEditor', {initialFrameWidth: '99%', initialFrameHeight: 400});
  660. this.um.setContent(that.formData.description);
  661. that.$nextTick(function () {
  662. layui.use(['form','element'], function () {
  663. that.form = layui.form;
  664. that.form.render();
  665. that.form.on('select(temp_id)', function (data) {
  666. that.$set(that.formData, 'temp_id', data.value);
  667. });
  668. that.form.on('select(rule_index)', function (data) {
  669. that.ruleIndex = data.value;
  670. });
  671. layui.element.on('tab(docTabBrief)', function(){
  672. that.layTabId = this.getAttribute('lay-id');
  673. });
  674. that.eeventRadio();
  675. });
  676. })
  677. },
  678. requestPost: function (url, data) {
  679. return new Promise(function (resolve, reject) {
  680. axios.post(url, data).then(function (res) {
  681. if (res.status == 200 && res.data.code == 200) {
  682. resolve(res.data)
  683. } else {
  684. reject(res.data);
  685. }
  686. }).catch(function (err) {
  687. reject({msg:err})
  688. });
  689. })
  690. },
  691. requestGet: function (url) {
  692. return new Promise(function (resolve, reject) {
  693. axios.get(url).then(function (res) {
  694. if (res.status == 200 && res.data.code == 200) {
  695. resolve(res.data)
  696. } else {
  697. reject(res.data);
  698. }
  699. }).catch(function (err) {
  700. reject({msg:err})
  701. });
  702. })
  703. },
  704. generates: function () {
  705. var that = this;
  706. that.generate(1);
  707. },
  708. handleSubmit:function () {
  709. var that = this;
  710. var time = $('#time').val();
  711. var rtime = $('#rtime').val();
  712. var status = $('#status').val();
  713. that.formData.status = status;
  714. that.formData.time = time;
  715. that.formData.rtime = rtime;
  716. console.log(status);
  717. if (!that.formData['nickname']){
  718. return that.showMsg('请填写名称');
  719. }
  720. if (!that.formData['image']){
  721. return that.showMsg('请上传图片');
  722. }
  723. if (!that.formData['time']){
  724. return that.showMsg('请选择预约时间');
  725. }
  726. if (!that.formData['rtime']){
  727. return that.showMsg('请选择进场时间');
  728. }
  729. $('#submit').attr('disabled', 'disabled').text('保存中...');
  730. that.requestPost(that.U({c:'auction.auction',a:'update',p:{id:that.id}}),that.formData).then(function (res) {
  731. that.confirm();
  732. }).catch(function (res) {
  733. that.showMsg(res.msg);
  734. });
  735. },
  736. confirm: function(){
  737. var that = this;
  738. layui.use(['layer'], function () {
  739. var layer = layui.layer;
  740. layer.confirm(that.id ? '修改成功是否返回产品列表' : '添加成功是否返回产品列表', {
  741. btn: ['返回列表',that.id ? '继续修改' : '继续添加'] //按钮
  742. }, function(){
  743. location.href = that.U({c:'auction.auction',a:'index'});
  744. }, function(){
  745. location.reload();
  746. });
  747. });
  748. },
  749. render:function(){
  750. this.$nextTick(function(){
  751. layui.use(['form'], function () {
  752. layui.form.render('select');
  753. });
  754. })
  755. },
  756. // 移动
  757. handleDragStart (e, item) {
  758. this.dragging = item;
  759. },
  760. handleDragEnd (e, item) {
  761. this.dragging = null
  762. },
  763. handleDragOver (e) {
  764. e.dataTransfer.dropEffect = 'move'
  765. },
  766. handleDragEnter (e, item) {
  767. e.dataTransfer.effectAllowed = 'move'
  768. if (item === this.dragging) {
  769. return
  770. }
  771. var newItems = [...this.formData.activity];
  772. var src = newItems.indexOf(this.dragging);
  773. var dst = newItems.indexOf(item);
  774. newItems.splice(dst, 0, ...newItems.splice(src, 1))
  775. this.formData.activity = newItems;
  776. },
  777. addRule:function(){
  778. return this.createFrame('添加商品规则',this.U({c:'store.StoreProductRule',a:'create'}));
  779. },
  780. allRule:function () {
  781. if (this.ruleIndex != -1) {
  782. var rule = this.ruleList[this.ruleIndex];
  783. if (rule) {
  784. this.ruleBool = true;
  785. var rule_value = rule.rule_value.map(function (item) {
  786. return item;
  787. });
  788. this.$set(this.formData,'items',rule_value);
  789. this.$set(this.formData,'attrs',[]);
  790. this.$set(this,'formHeader',[]);
  791. return true;
  792. }
  793. }
  794. this.showMsg('选择的属性无效');
  795. }
  796. },
  797. mounted: function () {
  798. var that = this;
  799. that.getProductInfo();
  800. window.changeIMG = that.changeIMG;
  801. window.$vm = that;
  802. }
  803. });
  804. </script>
  805. </body>
  806. </html>
  807. <script>
  808. </script>