index.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. <?php
  2. ?>
  3. <div id="app" v-cloak>
  4. <el-card shadow="never" style="border:0;min-width: 1200px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  5. <div slot="header">
  6. <div style="display: flex; justify-content:space-between">
  7. <span>基础设置</span>
  8. <div>
  9. <el-button size="small" type="primary" style="padding: 9px 15px !important;" @click="onSubmit">保存配置</el-button>
  10. </div>
  11. </div>
  12. </div>
  13. <div class="table-body">
  14. <el-tabs v-model="activeName" @tab-click="handleClick">
  15. <el-form size="small" ref="form" label-width="180px" :model="form" :rules="rules">
  16. <el-form-item label="是否启用插件" prop="is_enable">
  17. <el-switch
  18. v-model="form.is_enable"
  19. :active-value="1"
  20. :inactive-value="0">
  21. </el-switch>
  22. </el-form-item>
  23. <el-form-item label="自动更新商品售价" prop="auto_update_price">
  24. <el-switch
  25. v-model="form.auto_update_price"
  26. :active-value="1"
  27. :inactive-value="0">
  28. </el-switch>
  29. </el-form-item>
  30. <el-form-item v-if="admin_type == 1" label="标准选品库" prop="is_default">
  31. <el-switch
  32. v-model="form.is_default"
  33. :active-value="1"
  34. :inactive-value="0">
  35. </el-switch>
  36. </el-form-item>
  37. <div v-if="form.is_default">
  38. <el-form-item prop="app_key" label="AppKey" prop="app_key" :rules="[{required:true, message: 'AppKey不能为空'}]">
  39. <el-col :span="24">
  40. <el-input style="width: 500px" v-model="form.app_key"></el-input>
  41. </el-col>
  42. </el-form-item>
  43. <el-form-item prop="secret_key" label="SecretKey" prop="secret_key" :rules="[{required:true, message: 'SecretKey不能为空'}]">
  44. <el-col :span="24">
  45. <el-input style="width: 500px" v-model="form.secret_key"></el-input>
  46. </el-col>
  47. </el-form-item>
  48. <el-form-item label="订单发货通知地址">
  49. <el-col :span="24">
  50. <el-input style="width: 500px" v-model="order_ship_callback_url" disabled>
  51. <template #append><el-button @click="copyLink(order_ship_callback_url)" class="copy_btn">点击复制</el-button></template>
  52. </el-input>
  53. </el-col>
  54. </el-form-item>
  55. <el-form-item label="订单配货通知地址">
  56. <el-col :span="24">
  57. <el-input style="width: 500px" v-model="order_ready_callback_url" disabled>
  58. <template #append><el-button @click="copyLink(order_ready_callback_url)" class="copy_btn">点击复制</el-button></template>
  59. </el-input>
  60. </el-col>
  61. </el-form-item>
  62. <el-form-item label="订单售后通知地址">
  63. <el-col :span="24">
  64. <el-input style="width: 500px" v-model="order_refund_callback_url" disabled>
  65. <template #append><el-button @click="copyLink(order_refund_callback_url)" class="copy_btn">点击复制</el-button></template>
  66. </el-input>
  67. </el-col>
  68. </el-form-item>
  69. <el-form-item label="商品修改通知地址">
  70. <el-col :span="24">
  71. <el-input style="width: 500px" v-model="goods_callback_url" disabled>
  72. <template #append><el-button @click="copyLink(goods_callback_url)" class="copy_btn">点击复制</el-button></template>
  73. </el-input>
  74. </el-col>
  75. </el-form-item>
  76. </div>
  77. <h3 style="padding-left: 107px">定价策略</h3>
  78. <el-form-item label="售价 定价策略" prop="status">
  79. <el-radio-group v-model="form.price.price.type" size="medium" class="redio-center">
  80. <!-- 指导价 -->
  81. <el-radio label="gonghuojia">{{''}}</el-radio>
  82. <span class="redio-input">
  83. <el-input minlength="1" maxlength="3" oninput="value=value.replace(/[^\d]/g,'')" style="width:300px;" v-model="form.price.price.rate.gonghuojia">
  84. <template slot="prepend">供货价 x 定价系数</template>
  85. <template slot="append">%</template>
  86. </el-input>
  87. </span>
  88. <!-- 协议价 -->
  89. <el-radio label="retail_price">{{''}}</el-radio>
  90. <span class="redio-input">
  91. <el-input minlength="1" maxlength="3" oninput="value=value.replace(/[^\d]/g,'')" style="width:300px;" v-model="form.price.price.rate.retail_price">
  92. <template slot="prepend">建议零售价 x 定价系数</template>
  93. <template slot="append">%</template>
  94. </el-input>
  95. </span>
  96. <el-radio label="price">{{''}}</el-radio>
  97. <span class="redio-input">
  98. <el-input minlength="1" maxlength="3" oninput="value=value.replace(/[^\d]/g,'')" style="width:300px;" v-model="form.price.price.rate.price">
  99. <template slot="prepend">商品价格 x 定价系数</template>
  100. <template slot="append">%</template>
  101. </el-input>
  102. </span>
  103. </el-radio-group>
  104. <div class="tab_tpis">
  105. 举例:供货价50元 建议零售价100元<br>
  106. 供货价 x 定价系数 即 50 x 130% = 65 元<br>
  107. 建议零售价 x 定价系数 即 100 x 80% = 80 元<br>
  108. 默认为供货价 x 150%(建议零售价不变,供货价上涨可能导致亏损!)<br>
  109. </div>
  110. </el-form-item>
  111. <!-- 成本价 定价策略 -->
  112. <el-form-item label="成本价 定价策略" prop="status">
  113. <el-radio-group v-model="form.price.cost_price.type" size="medium" class="redio-center">
  114. <!-- 指导价 -->
  115. <el-radio label="gonghuojia">{{''}}</el-radio>
  116. <span class="redio-input">
  117. <el-input minlength="1" maxlength="3" oninput="value=value.replace(/[^\d]/g,'')" style="width:300px;" v-model="form.price.cost_price.rate.gonghuojia">
  118. <template slot="prepend">供货价 x 定价系数</template>
  119. <template slot="append">%</template>
  120. </el-input>
  121. </span>
  122. <!-- 协议价 -->
  123. <el-radio label="retail_price">{{''}}</el-radio>
  124. <span class="redio-input">
  125. <el-input minlength="1" maxlength="3" oninput="value=value.replace(/[^\d]/g,'')" style="width:300px;" v-model="form.price.cost_price.rate.retail_price">
  126. <template slot="prepend">建议零售价 x 定价系数</template>
  127. <template slot="append">%</template>
  128. </el-input>
  129. </span>
  130. <el-radio label="price">{{''}}</el-radio>
  131. <span class="redio-input">
  132. <el-input minlength="1" maxlength="3" oninput="value=value.replace(/[^\d]/g,'')" style="width:300px;" v-model="form.price.cost_price.rate.price">
  133. <template slot="prepend">商品价格 x 定价系数</template>
  134. <template slot="append">%</template>
  135. </el-input>
  136. </span>
  137. </el-radio-group>
  138. </el-form-item>
  139. <!-- 原价 定价策略 -->
  140. <el-form-item label="原价 定价策略" prop="status">
  141. <el-radio-group v-model="form.price.original_price.type" size="medium" class="redio-center">
  142. <!-- 指导价 -->
  143. <el-radio label="gonghuojia">{{''}}</el-radio>
  144. <span class="redio-input">
  145. <el-input minlength="1" maxlength="3" oninput="value=value.replace(/[^\d]/g,'')" style="width:300px;" v-model="form.price.original_price.rate.gonghuojia">
  146. <template slot="prepend">供货价 x 定价系数</template>
  147. <template slot="append">%</template>
  148. </el-input>
  149. </span>
  150. <!-- 协议价 -->
  151. <el-radio label="retail_price">{{''}}</el-radio>
  152. <span class="redio-input">
  153. <el-input minlength="1" maxlength="3" oninput="value=value.replace(/[^\d]/g,'')" style="width:300px;" v-model="form.price.original_price.rate.retail_price">
  154. <template slot="prepend">建议零售价 x 定价系数</template>
  155. <template slot="append">%</template>
  156. </el-input>
  157. </span>
  158. <el-radio label="price">{{''}}</el-radio>
  159. <span class="redio-input">
  160. <el-input minlength="1" maxlength="3" oninput="value=value.replace(/[^\d]/g,'')" style="width:300px;" v-model="form.price.original_price.rate.price">
  161. <template slot="prepend">商品价格 x 定价系数</template>
  162. <template slot="append">%</template>
  163. </el-input>
  164. </span>
  165. </el-radio-group>
  166. </el-form-item>
  167. <div v-if="form.is_default">
  168. <h3 style="padding-left: 107px">收款设置</h3>
  169. <el-form-item label="联系二维码" prop="contact_image" >
  170. <com-attachment v-model="form.contact_image" :multiple="false" :max="1">
  171. <el-tooltip class="item" effect="dark" content="建议尺寸:500 * 500" placement="top">
  172. <el-button size="mini">选择图片</el-button>
  173. </el-tooltip>
  174. </com-attachment>
  175. <div v-if="form.contact_image" class="customize-share-title" style="width: 80px; height: 80px; overflow: hidden">
  176. <el-image mode="aspectFill" width='80px' height='80px' :src="form.contact_image ? form.contact_image : ''"></el-image>
  177. <el-button v-if="form.contact_image" class="del-btn" size="mini" type="danger" icon="el-icon-close" circle @click="form.contact_image = ''"></el-button>
  178. </div>
  179. </el-form-item>
  180. <el-form-item label="联系电话">
  181. <el-input style="width: 200px" v-model="form.mobile" placeholder="请输入联系电话"></el-input>
  182. </el-form-item>
  183. <el-form-item label="资金低于" prop="min_balance" :rules="[{required: true, message:'请输入资金提醒门槛'}]">
  184. <el-input style="width: 400px" v-model="form.min_balance" placeholder="请输入资金提醒门槛">
  185. <template #append>元,红色数值提醒</template>
  186. </el-input>
  187. </el-form-item>
  188. </div>
  189. </el-form>
  190. </el-tabs>
  191. </div>
  192. <!-- 这个是复制用的容器,已隐藏 -->
  193. <textarea id="inputs" style="opacity: 0;width: 0;height: 0;">这是幕后黑手</textarea>
  194. </el-card>
  195. </div>
  196. <script>
  197. const validateNumber = (rule, value, callback) => {
  198. if (!(/^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/).test(value)) {
  199. callback(new Error('请输入数字值'))
  200. } else {
  201. callback()
  202. }
  203. };
  204. const app = new Vue({
  205. el: '#app',
  206. data: {
  207. activeName: '',
  208. form: {
  209. is_enable: 0,
  210. app_key: '',
  211. secret_key: '',
  212. auto_update_price: 0,
  213. contact_image: '',
  214. mobile: '',
  215. min_balance: 0,
  216. price: {
  217. price: {
  218. type: 'gonghuojia',
  219. rate: {
  220. price: 150,
  221. gonghuojia: 150,
  222. retail_price: 150,
  223. },
  224. },
  225. cost_price: {
  226. type: 'gonghuojia',
  227. rate: {
  228. price: 150,
  229. gonghuojia: 150,
  230. retail_price: 150,
  231. },
  232. },
  233. original_price: {
  234. type: 'gonghuojia',
  235. rate: {
  236. price: 150,
  237. gonghuojia: 150,
  238. retail_price: 150,
  239. },
  240. }
  241. }
  242. },
  243. pem_value: '',
  244. rules: {},
  245. order_ship_callback_url: '<?= $order_ship_callback_url ?>',
  246. goods_callback_url: '<?= $goods_callback_url ?>',
  247. order_ready_callback_url: '<?= $order_ready_callback_url ?>',
  248. order_refund_callback_url: '<?= $order_refund_callback_url ?>',
  249. admin_type: '<?= $admin_type ?>',
  250. },
  251. created() {
  252. },
  253. mounted() {
  254. // 获取列表首页数据
  255. this.getData()
  256. },
  257. methods: {
  258. //1.0 跳转详情
  259. handleClick(tab, event) {
  260. },
  261. handleSelectionChange(val) {
  262. let self = this;
  263. self.choose_list = [];
  264. val.forEach(function (item) {
  265. self.choose_list.push(item.id);
  266. })
  267. },
  268. getData() {
  269. this.loading = true
  270. request({
  271. method: 'get',
  272. params: {
  273. r: 'qi-shang-tong/setting/index',
  274. },
  275. }).then(e => {
  276. this.loading = false;
  277. if (e.data.code === 0) {
  278. if (!e.data.data.price) e.data.data.price = this.form.price
  279. this.form = Object.assign(this.form, e.data.data)
  280. } else {
  281. this.$message.error(e.data.msg);
  282. }
  283. }).catch(e => {
  284. this.loading = false;
  285. });
  286. },
  287. onSubmit() {
  288. this.$refs['form'].validate((valid) => {
  289. if (valid) {
  290. this.loading = true
  291. request({
  292. method: 'post',
  293. params: {
  294. r: 'qi-shang-tong/setting/index',
  295. },
  296. data: this.form
  297. }).then(e => {
  298. this.loading = false;
  299. if (e.data.code === 0) {
  300. this.$message.success(e.data.msg);
  301. } else {
  302. this.$message.error(e.data.msg);
  303. }
  304. }).catch(e => {
  305. this.loading = false;
  306. });
  307. } else {
  308. console.log(valid)
  309. }
  310. })
  311. },
  312. copyLink(url) { //复制链接
  313. var clipboard = new ClipboardJS('.copy_btn', {
  314. text: function() {
  315. return url;
  316. }
  317. });
  318. clipboard.on('success', (e) => {
  319. this.$message.success('复制成功!');
  320. clipboard.destroy()
  321. });
  322. clipboard.on('error', (e) => {
  323. this.$message.error('复制失败!');
  324. this.clipboard.destroy()
  325. });
  326. },
  327. }
  328. });
  329. </script>
  330. <style>
  331. .el-tabs__header {
  332. font-size: 16px;
  333. }
  334. .table-body {
  335. padding: 20px;
  336. background-color: #fff;
  337. }
  338. .table-body .el-button {
  339. padding: 0 !important;
  340. border: 0;
  341. margin: 0 5px;
  342. }
  343. .input-item {
  344. width: 250px;
  345. margin: 0 0 20px;
  346. display: inline-block;
  347. }
  348. .input-item .el-input__inner {
  349. border-right: 0;
  350. }
  351. .input-item .el-input__inner:hover {
  352. border: 1px solid #dcdfe6;
  353. border-right: 0;
  354. outline: 0;
  355. }
  356. .input-item .el-input__inner:focus {
  357. border: 1px solid #dcdfe6;
  358. border-right: 0;
  359. outline: 0;
  360. }
  361. .input-item .el-input-group__append {
  362. background-color: #fff;
  363. border-left: 0;
  364. width: 10%;
  365. padding: 0;
  366. }
  367. .input-item .el-input-group__append .el-button {
  368. padding: 0;
  369. }
  370. .input-item .el-input-group__append .el-button {
  371. margin: 0;
  372. }
  373. .batch {
  374. margin: 0 0 20px;
  375. display: inline-block;
  376. }
  377. .batch .el-button {
  378. padding: 9px 15px !important;
  379. }
  380. .item-box{
  381. margin-right: 20px;
  382. }
  383. .item-box .label{
  384. margin-right: 8px;
  385. }
  386. .item-box .symbol{
  387. margin: 0 6px;
  388. }
  389. .form-nickname{
  390. width: 180px;
  391. white-space:nowrap;
  392. overflow:hidden;
  393. text-overflow:ellipsis;
  394. }
  395. .index-video-url{
  396. width: 300px;
  397. }
  398. .index-video-url video{
  399. width: 100%;
  400. }
  401. .index-related-info{
  402. width: 500px;
  403. }
  404. .video-top{
  405. width: 100%;
  406. display: flex;
  407. align-items: flex-start;
  408. box-sizing: border-box;
  409. padding: 20px;
  410. /* opacity: .5; */
  411. background-color: #FFFFFF;
  412. }
  413. .video-top .top-right{
  414. line-height: 26px;
  415. }
  416. .video-top .top-right .top-title{
  417. font-size: 18px;
  418. white-space:nowrap;
  419. overflow:hidden;
  420. text-overflow:ellipsis;
  421. width: 360px;
  422. }
  423. .video-top .top-right .wrapper{
  424. display: flex;
  425. /* align-items: flex-start; */
  426. }
  427. .video-top .top-right .wrapper .to-copy{
  428. /* color: #03C5FF; */
  429. margin-left: 20px;
  430. }
  431. .video-top .top-right .detail-price{
  432. color: #BC0100;
  433. font-size: 18px;
  434. font-family: Microsoft YaHei;
  435. font-weight: bold;
  436. }
  437. /* .atooltip {
  438. background: #FFFFFF !important;
  439. border: none !important;
  440. } */
  441. .el-table th>.cell{
  442. color: #333;
  443. font-weight: bold;
  444. font-size: 14px;
  445. }
  446. .el-table__footer-wrapper, .el-table__header-wrapper{
  447. border-bottom: 1.4px solid #D6D6D6;
  448. }
  449. .price_col{
  450. color: #FF5D05;
  451. }
  452. .redio-center {
  453. display: flex;
  454. align-items: center;
  455. }
  456. .redio-input {
  457. margin-left: -28px;
  458. margin-right: 20px;
  459. }
  460. </style>