index.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('com-rich-text');
  4. ?>
  5. <style>
  6. @media screen and (min-width:1370px){
  7. .form-body {
  8. padding: 20px 0;
  9. padding-right: 50%;
  10. min-width: 1400px;
  11. }
  12. }
  13. @media screen and (max-width:1369px){
  14. .form-body {
  15. padding: 20px 0;
  16. padding-right: 20%;
  17. }
  18. }
  19. .form-body {
  20. background-color: #fff;
  21. margin-bottom: 20px;
  22. }
  23. .form-button {
  24. margin: 0!important;
  25. }
  26. .form-button .el-form-item__content {
  27. margin-left: 0!important;
  28. }
  29. .button-item {
  30. padding: 9px 25px;
  31. }
  32. .agent-item-input{
  33. display: flex;
  34. align-items: center;
  35. margin-top: 16px;
  36. }
  37. .agent-item-input .item-lab-title{
  38. width: 80px;
  39. margin-right: 20px;
  40. }
  41. .tips-title{
  42. font-size: 12px;
  43. color: #999999;
  44. }
  45. .el-tabs__header{
  46. background-color: #fff;
  47. }
  48. .el-tabs__item{
  49. width: 100px;
  50. text-align: center;
  51. }
  52. .el-table th>.cell{
  53. color: #333;
  54. font-weight: bold;
  55. font-size: 14px;
  56. }
  57. .el-table__footer-wrapper, .el-table__header-wrapper{
  58. border-bottom: 1.4px solid #D6D6D6;
  59. }
  60. .add-image-btn {
  61. width: 100px;
  62. height: 100px;
  63. color: #419EFB;
  64. border: 1px solid #e2e2e2;
  65. cursor: pointer;
  66. }
  67. .pic-url-remark{
  68. font-size: 12px;
  69. color: #999999;
  70. }
  71. .el-image {
  72. position: relative;
  73. display: inline-block;
  74. overflow: hidden;
  75. }
  76. .el-button.is-circle {
  77. border-radius: 50%;
  78. padding: 12px;
  79. }
  80. .el-button--mini.is-circle {
  81. padding: 7px;
  82. }
  83. .del-btn {
  84. position: absolute;
  85. right: 0px;
  86. top: 0px;
  87. padding: 4px 4px;
  88. }
  89. </style>
  90. <div id="app" v-cloak>
  91. <el-card style="border:0;min-width: 1000px;" shadow="never" body-style="background-color: #f3f3f3;padding: 10px 0 0;" v-loading="loading">
  92. <el-tabs v-model="activeName" @tab-click="handleClick">
  93. <el-tab-pane label="基础设置" name="basic"></el-tab-pane>
  94. <div class="form-body">
  95. <div style="display: flex;align-items: center;padding-bottom: 10px;border-bottom: 1px solid #E4E7ED;width: 600px;margin:10px 0 20px 15px;">
  96. <div style="width: 5px;height: 20px;background-color: #409eff;margin-right: 5px;"></div>
  97. <div>基础设置</div>
  98. </div>
  99. <el-form ref="form" :model="form" :rules="rules" label-width="180px" size="small">
  100. <!-- <el-form-item label="招商分红" label-width="180px">-->
  101. <!-- <el-switch-->
  102. <!-- v-model="form.is_open"-->
  103. <!-- :active-value="1"-->
  104. <!-- :inactive-value="0"-->
  105. <!-- inactive-text="关闭"-->
  106. <!-- active-text="开启">-->
  107. <!-- </el-switch>-->
  108. <!-- </el-form-item>-->
  109. <el-form-item label="招商分红首页">
  110. <template>
  111. <el-input disabled v-model="index_url" type="text" style="width: 50%" placeholder="招商分红首页"></el-input>
  112. </template>
  113. <el-button class="button-item" v-on:click="copyText(index_url)">复制链接</el-button>
  114. </el-form-item>
  115. <div style="display: flex;align-items: center;padding-bottom: 10px;border-bottom: 1px solid #E4E7ED;width: 600px;margin:10px 0 20px 15px;">
  116. <div style="width: 5px;height: 20px;background-color: #409eff;margin-right: 5px;"></div>
  117. <div>结算设置</div>
  118. </div>
  119. <el-form-item label="推广中心显示" style="margin-bottom: 0">
  120. <div>
  121. <el-switch v-model="form.is_show_at_center" :active-value="1" :inactive-value="0">
  122. </el-switch>
  123. </div>
  124. </el-form-item>
  125. <el-form-item label="结算方式" label-width="180px">
  126. <el-radio v-model="form.settle_type" :label="1">订单支付后</el-radio>
  127. <el-radio v-model="form.settle_type" :label="2">订单完成后</el-radio>
  128. <br/>
  129. <div class="tips-text" style="line-height: 24px;">
  130. 招商分红结算方式,是门店订单支付后还是必须订单完成后才能结算,分红结算后,招商员才能进行提现
  131. </div>
  132. </el-form-item>
  133. <el-form-item label="结算依据" label-width="180px">
  134. <el-radio v-model="form.settle_base_on" :label="1">订单金额(不包括运费和抵扣金额)</el-radio>
  135. <el-radio v-model="form.settle_base_on" :label="2">利润金额(订单最终价格-成本)负数取0</el-radio>
  136. <el-radio v-model="form.settle_base_on" :label="3">商品售价</el-radio>
  137. <el-radio v-model="form.settle_base_on" :label="4">商家服务费</el-radio>
  138. <br/>
  139. <div class="tips-text" style="line-height: 24px;">
  140. 招商分红比例计算基数,按订单支付的金额进行分红还是订单利润进行分红
  141. </div>
  142. </el-form-item>
  143. <el-form-item label="结算模式" label-width="180px">
  144. <el-radio v-model="form.settle_method" :label="1">自动结算</el-radio>
  145. </el-form-item>
  146. <el-form-item label="结算周期" label-width="180px">
  147. <el-select v-model="form.settle_circle" placeholder="请选择周期">
  148. <el-option v-for="(item, index) in settle_circle_opiton" :label="item.name" :value="item.index" :key="index"></el-option>
  149. </el-select>
  150. <br/>
  151. <div class="tips-text" style="line-height: 24px;">
  152. 招商分红结算周期
  153. </div>
  154. </el-form-item>
  155. <div style="display: flex;align-items: center;padding-bottom: 10px;border-bottom: 1px solid #E4E7ED;width: 600px;margin:10px 0 20px 15px;">
  156. <div style="width: 5px;height: 20px;background-color: #409eff;margin-right: 5px;"></div>
  157. <div>升级设置</div>
  158. </div>
  159. <el-form-item label="结算方式" label-width="180px">
  160. <el-radio v-model="form.upgrade_settle_type" :label="1">订单支付后</el-radio>
  161. <el-radio v-model="form.upgrade_settle_type" :label="2">订单完成后</el-radio>
  162. <br/>
  163. <div class="tips-text" style="line-height: 24px;">
  164. 购物升级为某等级招商员,是订单支付后还是订单完成后进行升级
  165. </div>
  166. </el-form-item>
  167. <el-form-item label="等级说明" label-width="180px">
  168. <com-rich-text style="width: 750px" :simple-attachment="true" v-model="form.level_desc"></com-rich-text>
  169. </el-form-item>
  170. </el-form>
  171. </div>
  172. <el-button class="button-item" :loading="btnLoading" type="primary" size="small" @click="store('form')">保存</el-button>
  173. </el-card>
  174. </div>
  175. <script>
  176. const app = new Vue({
  177. el: '#app',
  178. data() {
  179. var validatePass = (rule, value, callback) => {
  180. if (Number.isInteger(Number(value)) && Number(value) > 0) {
  181. callback();
  182. } else {
  183. callback(new Error('请输入大于0的整数'));
  184. }
  185. };
  186. return {
  187. index_url: `<?= $H5Url ?>` + '/#/plugins/BusinessBonus/index',
  188. // 0.1 设置页数据
  189. activeName: 'first',
  190. loading: false,
  191. load: false,
  192. btnLoading: false,
  193. payed_title : '',
  194. form: {
  195. // 基础设置
  196. is_open : 1, //是否开启
  197. // 结算设置
  198. settle_type: 1, // 结算方式
  199. settle_base_on: 1, // 结算依据
  200. settle_method: 1, // 结算模式
  201. settle_circle: 1, // 结算周期
  202. // 升级设置
  203. upgrade_settle_type: 1, // 结算方式
  204. level_desc: '',
  205. is_show_at_center: 1, // 推广中心显示
  206. },
  207. settle_circle_opiton: [
  208. {index: 1, name: '一天'},
  209. {index: 2, name: '一周'},
  210. {index: 3, name: '一个月'},
  211. ],
  212. rules: {
  213. settle_circle: [
  214. {required: true, message: '请选择结算周期', trigger: 'change'},
  215. ],
  216. },
  217. };
  218. },
  219. created() {
  220. this.getDetail();
  221. },
  222. methods: {
  223. // 0.1.1 获取设置详情
  224. getDetail(){
  225. let that = this;
  226. this.loading = true;
  227. request({
  228. params: {
  229. r: 'business-bonus/setting/detail',
  230. },
  231. method: 'post'
  232. }).then(e => {
  233. this.loading = false;
  234. if (e.data.code == 0) {
  235. if(e.data.data.is_null == 0){
  236. that.form = e.data.data.config
  237. }
  238. } else {
  239. this.$message.error(e.data.msg);
  240. }
  241. }).catch(e => {
  242. this.btnLoading = false;
  243. });
  244. },
  245. // 2.0 提交表单-编辑基础设置
  246. store(formName) {
  247. this.$refs[formName].validate((valid) => {
  248. if (valid) {
  249. this.btnLoading = true;
  250. let postForm = JSON.parse(JSON.stringify(this.form));
  251. request({
  252. params: {
  253. r: 'business-bonus/setting/index',
  254. },
  255. method: 'post',
  256. data: postForm,
  257. }).then(e => {
  258. this.btnLoading = false;
  259. if (e.data.code == 0) {
  260. this.$message.success(e.data.msg);
  261. } else {
  262. this.$message.error(e.data.msg)
  263. }
  264. }).catch(e => {
  265. this.btnLoading = false;
  266. });
  267. } else {
  268. this.btnLoading = false;
  269. return false;
  270. }
  271. })
  272. },
  273. //复制素材中心链接
  274. copyText(url){
  275. var copyInput = document.createElement('input')
  276. copyInput.setAttribute('value', url)
  277. document.body.appendChild(copyInput)
  278. copyInput.select()
  279. try {
  280. var copyed = document.execCommand('copy')
  281. if (copyed) {
  282. document.body.removeChild(copyInput)
  283. this.$message.success('复制成功')
  284. }
  285. } catch {
  286. this.$message.success('复制失败,请检查浏览器兼容')
  287. }
  288. },
  289. handleClick(tab, event) {
  290. this.activeName = tab.name;
  291. },
  292. handle(type, param1 = null, param2 = null) {
  293. switch(type) {
  294. //上传图片
  295. case 'picUrl':
  296. if (param1) {
  297. let self = this;
  298. param1.forEach(function(item, index){
  299. if (!self.form.images && self.form.images.length >= 9) {
  300. return;
  301. }
  302. self.form.images.push(item.url)
  303. })
  304. }
  305. break;
  306. //删除图片
  307. case 'delPic':
  308. this.form.images.splice(param1, 1)
  309. break;
  310. }
  311. },
  312. updatePicUrl(e, params) {
  313. console.log(e);
  314. },
  315. },
  316. filters: {
  317. },
  318. });
  319. </script>