投屏pc端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

559 lines
19 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. <template>
  2. <div class="global-width">
  3. <div class="container">
  4. <!--当前位置-->
  5. <div class="hc-breadcrumb">
  6. <router-link to="/currency/trade" class="otc-index-btn">{{$t('交易大厅')}}</router-link>
  7. <router-link to="/currency/release" class="otc-index-btn hc-btn-active">{{$t('发布广告')}}</router-link>
  8. <router-link to="/order/currency" class="otc-index-btn">{{$t('订单管理')}}</router-link>
  9. </div>
  10. <div class="hc-breadcrumb trade-center-top">
  11. <span>{{$t('发布广告详情')}}</span>
  12. <div class="order-top-div2 margin-t0">
  13. <span class="hc-color4" @click="$router.push('/currency/ads')">{{$t('我的广告')}}</span>
  14. </div>
  15. </div>
  16. <div class="trade-detail-warp release-box">
  17. <!--左边-->
  18. <div class="trade-detail-left">
  19. <router-link to="/" class="trade-detail-left-div1">
  20. <div class="trade-detail-left-top">
  21. <img class="trade-detail-left-headimg" :src="dealerInfo.avatar" v-if="dealerInfo.avatar">
  22. <img class="trade-detail-left-headimg" src="../../assets/images/user-head-img.png" v-else>
  23. </div>
  24. <div class="trade-detail-left-top">
  25. <div class="trade-detail-left-nickname">{{dealerInfo.username || $t('暂无昵称')}}</div>
  26. <div class="merchants-tag">
  27. <img src="../../assets/images/trade/icon-authentication.png">
  28. <span class="hc-color">{{$t('认证商家')}}</span>
  29. </div>
  30. </div>
  31. </router-link>
  32. <div class="trade-detail-left-div2">
  33. <div class="trade-detail-left-div3">
  34. <div class="hc-color">{{$t('总成单')}}</div>
  35. <div class="div2-d1">{{dealerInfo.sumOfFinishedFlow || 0}}</div>
  36. </div>
  37. <div class="trade-detail-left-div4">
  38. <div class="hc-color">{{$t('完成率')}}</div>
  39. <div class="div2-d1">{{dealerInfo.finishedRate || 0}}%</div>
  40. </div>
  41. <!-- <div class="trade-detail-left-div5">
  42. <div class="hc-color">{{$t('30日成单')}}</div>
  43. <div class="div2-d1">{{dealerInfo.numberOf30DayFinishedFlow || 0}}</div>
  44. </div> -->
  45. <div class="trade-detail-left-div5">
  46. <div class="hc-color">{{$t('平均放行')}}</div>
  47. <div class="div2-d1">{{dealerInfo.avgReleaseMinus || 0}} {{$t('分钟')}}</div>
  48. </div>
  49. </div>
  50. <div class="trade-detail-explain">
  51. <h3>{{$t('广告说明')}}:</h3>
  52. <p class="hc-color">{{$t('1.订单有效期为15分钟,请您及时在有效期内付款并点击「标记付款已完成」按钮,我才可以释放数字币给您。')}}</p>
  53. <p class="hc-color">{{$t('2.开始交易后数字币由系统锁定托管,请安心下单。')}}</p>
  54. </div>
  55. </div>
  56. <!-- 右边 -->
  57. <div class="trade-detail-right">
  58. <div class="tab-title">
  59. <ul>
  60. <li :class="{'active': dealType}" @click="dealType = 1">
  61. <span>{{$t('我要买')}}</span>
  62. </li>
  63. <li :class="{'active': !dealType}" @click="dealType = 0">
  64. <span>{{$t('我要卖')}}</span>
  65. </li>
  66. </ul>
  67. </div>
  68. <div class="tab-container">
  69. <div class="choose-currency">
  70. <ul>
  71. <li class="active">
  72. <!-- <span :class="[{'buy-currency': dealType}, {'sell-currency': !dealType}]">{{currentCoin}}</span> -->
  73. <el-cascader v-model="currentCoin" :options="options" @change="handleChange"></el-cascader>
  74. </li>
  75. <li class="limit">{{$t('限额')}} ¥{{limitMin}}~¥{{limitMax}}</li>
  76. </ul>
  77. </div>
  78. <div class="top-price">
  79. <span>
  80. {{$t('当前单价')}}CNY: {{price}}
  81. <div class="question-box">
  82. <img class="fa-question" src="../../assets/images/icon-question.png">
  83. <div class="free-explanation free-explanation2">
  84. <p>{{$t('当前单价会因市场波动而改变,实际单价请以下单后的锁定单价为准')}}</p>
  85. </div>
  86. </div>
  87. </span>
  88. <div class="top-price-r hc-color1" v-if="dealType">{{$t('您需要支付手续费交易手续费按')}}{{buyFee}}%{{$t('收取')}}</div>
  89. <div class="top-price-r hc-color1" v-else>{{$t('您需要支付手续费交易手续费按')}}{{sellFee}}%{{$t('收取')}}</div>
  90. </div>
  91. <div class="form-box">
  92. <div class="form-group">
  93. <div class="address-form-div2">
  94. <label class="form-label">{{dealTypeText}}{{$t('金额')}}</label>
  95. <div class="form-control release-form">
  96. <el-input class="text-input" :placeholder="$t('请输入金额')" v-model="totalPrice" type="text" clearable autocomplete="off" @input="setPrice" @keyup.enter.native="openPassword">
  97. </el-input>
  98. <div class="form-control-company">CNY</div>
  99. </div>
  100. </div>
  101. <div class="address-form-div3">
  102. <img src="../../assets/images/trade/icon-equal.png">
  103. </div>
  104. <div class="address-form-div2">
  105. <label class="form-label">{{dealTypeText}}{{$t('数量')}}</label>
  106. <div class="form-control release-form">
  107. <el-input class="text-input" :placeholder="$t('请输入数量')" v-model="quantity" type="text" clearable autocomplete="off" @input="setQuantity" @keyup.enter.native="openPassword">
  108. </el-input>
  109. <div class="form-control-company">{{currentCoin}}</div>
  110. </div>
  111. </div>
  112. </div>
  113. <div class="form-group">
  114. <div class="address-form-div2">
  115. <label class="form-label">{{$t('最小限额')}}</label>
  116. <div class="form-control release-form">
  117. <el-input class="text-input" :placeholder="$t('请输入最小限额')" v-model="minPrice" type="text" clearable autocomplete="off" @keyup.enter.native="openPassword">
  118. </el-input>
  119. <div class="form-control-company">CNY</div>
  120. </div>
  121. </div>
  122. <div class="address-form-div2" style="float: right;">
  123. <label class="form-label">{{$t('设置单价')}}</label>
  124. <div class="form-control release-form">
  125. <el-input class="text-input" :placeholder="$t('请输入单价')" v-model="price" type="text" clearable autocomplete="off" @keyup.enter.native="openPassword">
  126. </el-input>
  127. <div class="form-control-company">CNY</div>
  128. </div>
  129. </div>
  130. </div>
  131. <div class="form-group">
  132. <div class="address-form-div2">
  133. <label class="form-label">{{$t('付款方式')}}</label>
  134. <div class="form-control">
  135. <div class="buy-payment">
  136. <div class="buy-payment-choose" :class="{'active': alipay}" v-if="hasAlipay">
  137. <span @click="alipay = !alipay">{{$t('支付宝')}}</span>
  138. </div>
  139. <div class="buy-payment-choose" :class="{'active': weixinpay}" v-if="hasWeixin">
  140. <span @click="weixinpay = !weixinpay">{{$t('微信')}}</span>
  141. </div>
  142. <div class="buy-payment-choose" :class="{'active': unionpay}" v-if="hasUnionpay">
  143. <span @click="unionpay = !unionpay">{{$t('银行卡')}}</span>
  144. </div>
  145. <span class="buy-payment-tips" v-if="hasPayment">
  146. {{$t('您还未添加收款方式')}}
  147. <router-link to="/user/setting">{{$t('去设置')}}</router-link>
  148. </span>
  149. </div>
  150. </div>
  151. </div>
  152. </div>
  153. <div class="form-group">
  154. <div class="address-form-div2" @click="openPassword">
  155. <el-button type="primary" :loading="true" v-if="loading">{{$t('提交中...')}}</el-button>
  156. <el-button type="primary" v-else>{{$t('立即发布')}}</el-button>
  157. </div>
  158. </div>
  159. </div>
  160. </div>
  161. <div class="trade-detail-right-tips">
  162. <h3>{{$t('当前数字货币价格为系统自动计算,实际交易价格以发起交易时的价格为准,请点击查看关于')}} <span>{{$t('浮动价格的说明')}}</span></h3>
  163. <p>1. {{$t('交易发起前,请您确认已阅读并同意卖家提出的条款,并再次确认交易内容无误后,再点击购买按钮。')}}</p>
  164. <p>2. {{$t('交易发起后,请您于付款期限截止前转帐至指定账户,并标记已付款完毕,逾期系统将自动取消交易。')}}</p>
  165. <p>3. {{$t('交易发起后,系统会自动将卖家的数字货币锁定,待卖家确认收到您的转帐后,将会释放数字货币至您的账户中。')}}</p>
  166. <p>4. {{$t('建议您在交易前先查看卖家信息,检视相关交易记录及评价,以减少交易纠纷。')}}</p>
  167. <p>5. {{$t('交易过程请使用平台的聊天系统进行沟通,平台外的对话记录将无法作为交易纠纷的依据。')}}</p>
  168. <p>6. {{$t('温馨提示:超过三笔取消订单,将被冻结当天下单权限。')}}</p>
  169. <p>7. {{$t('下单后请履行契约精神,恶意抬价或者是反悔,被投诉将冻结账户 3-14 天不等。')}}</p>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. <!-- 输入支付密码的弹窗 -->
  175. <el-dialog class="user-dialog" :title="$t('验证支付密码')" :visible.sync="showPassword" :before-close="closePassword">
  176. <div class="title-tips">{{$t('支付密码')}}</div>
  177. <div class="address-form-input">
  178. <el-input :placeholder="$t('请输入支付密码')" v-model="payPwd" type="password" clearable autocomplete="off" @keyup.enter.native="releaseAds">
  179. </el-input>
  180. </div>
  181. <div class="title-tips">{{$t('图形验证码')}}</div>
  182. <div class="address-form-input" style="display: flex;justify-content: space-between;">
  183. <el-input :placeholder="$t('请输入图形验证码')" v-model="imgVerifyCode" type="text" clearable autocomplete="off" @keyup.enter.native="submit">
  184. </el-input>
  185. <img class="val" :src="imagesUrl" @click="getImageCode">
  186. </div>
  187. <div class="title-tips">{{$t('短信验证码')}}</div>
  188. <div class="address-form-input">
  189. <el-input class="verify-input" :placeholder="$t('请输入短信验证码')" v-model="noteVerifyCode" type="text" clearable autocomplete="off" @keyup.enter.native="releaseAds">
  190. </el-input>
  191. <span class="get-code" v-if="isCodeSend">{{iTime + $t('s后重新获取')}}</span>
  192. <span class="get-code" @click="getCode" v-else>{{$t('获取验证码')}}</span>
  193. </div>
  194. <span slot="footer" class="dialog-footer">
  195. <el-button type="primary" :loading="true" v-if="loading2">{{$t('提交中...')}}</el-button>
  196. <el-button type="primary" @click="releaseAds" v-else>{{$t('确定')}}</el-button>
  197. </span>
  198. </el-dialog>
  199. </div>
  200. </template>
  201. <script>
  202. import { mapState } from 'vuex'
  203. let Countdown;
  204. export default {
  205. name: 'currencyRelease',
  206. data() {
  207. return {
  208. dealerId: '',
  209. dealerInfo: {}, //商家信息
  210. dealType: 1, //1买 0卖
  211. coinList: [], //所有币种列表
  212. currentCoin: '', //当前币种
  213. currentCoinID: '', //当前币种ID
  214. price: 0, //币种参考单价
  215. limitMin: 0, //最小限额
  216. limitMax: 0, //最大限额
  217. buyRange: 0, //买入价格限制
  218. sellRange: 0, //卖出价格限制
  219. buyFee: 0, //买入手续费
  220. sellFee: 0, //卖出手续费
  221. options: [],
  222. totalPrice: '', //金额
  223. quantity: '', //数量
  224. minPrice: '', //最小限额
  225. alipay: false,
  226. weixinpay: false,
  227. unionpay: false,
  228. payPwd: '', //支付密码
  229. noteVerifyCode: '', //短信验证码
  230. hasAlipay: false,
  231. hasWeixin: false,
  232. hasUnionpay: false,
  233. showPassword: false,
  234. iTime: 60, //验证码倒计时
  235. isCodeSend: false,
  236. loading: false,
  237. loading2: false,
  238. randomString: '', //图片验证码随机数
  239. imgVerifyCode: '', //图片验证码
  240. imagesUrl: '', //验证码图片地址
  241. }
  242. },
  243. computed: {
  244. ...mapState('user', ['userInfoData' ,'merchantStatus']),
  245. dealTypeText() {
  246. let text = this.dealType ? this.$t('购买') : this.$t('出售');
  247. return text;
  248. },
  249. hasPayment() { //是否有添加支付方式
  250. let val = false;
  251. if(!this.hasAlipay && !this.hasWeixin && !this.hasUnionpay) {
  252. val = true;
  253. }
  254. return val;
  255. }
  256. },
  257. watch: {
  258. price(newVal) { //监听单价
  259. if (newVal != '' && this.totalPrice > 0) {
  260. this.quantity = this.common.accDiv(this.totalPrice, newVal); //数量=金额÷单价
  261. }
  262. },
  263. },
  264. methods: {
  265. getImageCode() { //获取图片验证码
  266. this.randomString = Math.floor(Math.random() * 4000 + 1000) + new Date().getTime();
  267. this.imagesUrl = this.common.baseURL + '/user/api/user/image/' + this.randomString;
  268. },
  269. getUserInfoData() {
  270. this.getAxios('/user/api/user/info')
  271. .then(data => {
  272. this.dealerId = data.data.id;
  273. setTimeout(() => {
  274. this.getDealerInfo();
  275. }, 300);
  276. })
  277. },
  278. getDealerInfo() { //商家信息
  279. this.postAxios('/api/market/order/business/info/' + this.dealerId)
  280. .then(data => {
  281. this.dealerInfo = data.data;
  282. })
  283. },
  284. getCoinList() { //获取币种列表
  285. this.getAxios('/api/market/fcoin/list')
  286. .then(data => {
  287. this.coinList = data.data;
  288. this.currentCoin = this.coinList[0].coinId;
  289. this.currentCoinID = this.coinList[0].coinId;
  290. this.price = this.coinList[0].price; //单价
  291. this.buyRange = this.coinList[0].buyRange; //买入单价范围
  292. this.sellRange = this.coinList[0].sellRange; //卖出单价范围
  293. this.buyFee = this.coinList[0].buyServiceChargeRate; //买入手续费
  294. this.sellFee = this.coinList[0].sellServiceChargeRate; //卖出手续费
  295. this.limitMin = this.coinList[0].minLimit; //总金额最低
  296. this.limitMax = this.coinList[0].maxLimit; //总金额最高
  297. this.coinList.forEach(item => {
  298. this.options.push({
  299. value: item.coinId,
  300. label: item.coinId
  301. })
  302. })
  303. })
  304. },
  305. getPayment() { //获取支付方式
  306. this.getAxios('/api/user/payment/list')
  307. .then(data => {
  308. let list = data.data;
  309. list.forEach(item => {
  310. if(item.status == 'U_P_S_NORMAL') {
  311. if(item.paymentType == 1) {
  312. this.hasWeixin = true;
  313. }
  314. if(item.paymentType == 2) {
  315. this.hasAlipay = true;
  316. }
  317. if(item.paymentType == 3) {
  318. this.hasUnionpay = true;
  319. }
  320. }
  321. })
  322. })
  323. },
  324. handleChange(value) { //切换币种
  325. console.log(JSON.stringify(value));
  326. this.coinList.forEach(item => {
  327. if(item.coinId == value[0]) {
  328. this.currentCoin = item.coinId;
  329. this.currentCoinID = item.coinId;
  330. this.price = item.price; //单价
  331. this.buyRange = item.buyRange; //买入单价范围
  332. this.sellRange = item.sellRange; //卖出单价范围
  333. this.buyFee = item.buyServiceChargeRate; //买入手续费
  334. this.sellFee = item.sellServiceChargeRate; //卖出手续费
  335. this.limitMin = item.minLimit; //总金额最低
  336. this.limitMax = item.maxLimit; //总金额最高
  337. }
  338. })
  339. },
  340. setPrice() { //数量=金额÷单价
  341. if(this.totalPrice != '' && this.totalPrice != 0 && this.price > 0) {
  342. this.quantity = this.common.accDiv(this.totalPrice, this.price);
  343. } else if(this.totalPrice == '') {
  344. this.quantity = '';
  345. }
  346. },
  347. setQuantity() { //金额=数量×单价
  348. if (this.quantity != '' && this.quantity != 0 && this.price > 0) {
  349. this.totalPrice = this.common.accMul(this.quantity, this.price);
  350. } else if(this.quantity == '') {
  351. this.totalPrice = '';
  352. }
  353. },
  354. getCode() { //获取验证码
  355. if (this.isCodeSend) {
  356. this.$message.error(this.$t('请勿频繁获取验证码!'))
  357. return;
  358. }
  359. this.isCodeSend = true;
  360. this.getAxios(`/user/api/user/verify/get?verifyType=0`)
  361. .then(() => {
  362. this.$message.success(this.verifyTypeText + this.$t('验证码发送成功!'));
  363. this.countdownTimer();
  364. })
  365. .catch(() => {
  366. this.isCodeSend = false;
  367. });
  368. },
  369. countdownTimer() { //短信发送开始计时60s
  370. if (this.iTime === 0) {
  371. clearTimeout(Countdown);
  372. this.isCodeSend = false;
  373. this.iTime = 60;
  374. } else {
  375. Countdown = setTimeout(this.countdownTimer, 1000);
  376. this.iTime = this.iTime - 1;
  377. }
  378. },
  379. openPassword() { //打开密码弹框
  380. if(this.loading) {
  381. return;
  382. }
  383. if(this.merchantStatus != 'M_E_S_PASS') {
  384. this.$message.error(this.$t('您还不是承兑商,不能发布广告!'));
  385. return;
  386. }
  387. if(!this.userInfoData.initPayPwd) {
  388. this.$message.error(this.$t('您还未设置支付密码!'));
  389. return;
  390. }
  391. if(!this.price) {
  392. this.$message.error(this.$t('请输入单价!'));
  393. return;
  394. }
  395. if(!this.totalPrice) {
  396. this.$message.error(this.$t('请输入金额!'));
  397. return;
  398. }
  399. if(!this.quantity) {
  400. this.$message.error(this.$t('请输入数量!'));
  401. return;
  402. }
  403. if(!this.minPrice) {
  404. this.$message.error(this.$t('请输入最小限额!'));
  405. return;
  406. }
  407. if(this.minPrice < this.limitMin) {
  408. this.$message.error(this.$t('最小限额不能小于') + this.limitMin);
  409. return;
  410. }
  411. if (!this.alipay && !this.weixinpay && !this.unionpay) {
  412. this.$message.error(this.$t('请选择支付方式!'));
  413. return;
  414. }
  415. this.loading = true;
  416. this.showPassword = true;
  417. },
  418. closePassword() {
  419. this.showPassword = false;
  420. //清除数据
  421. this.payPwd = '';
  422. this.noteVerifyCode = '';
  423. this.loading = false;
  424. this.loading2 = false;
  425. },
  426. releaseAds() { //发布广告
  427. if(this.loading2) {
  428. return;
  429. }
  430. if(!this.payPwd) {
  431. this.$message.error('请输入支付密码!');
  432. return;
  433. }
  434. if (!this.imgVerifyCode) {
  435. this.$message.error(this.$t('请输入图片验证码!'));
  436. return;
  437. }
  438. if(!this.noteVerifyCode) {
  439. this.$message.error('请输入短信验证码!');
  440. return;
  441. }
  442. this.loading2 = true;
  443. let params = {
  444. buy: this.dealType ? true : false, //买or卖
  445. amount: this.price, //单价
  446. intAmount: this.dealType ? this.quantity : this.totalPrice, //买数量 卖金额
  447. intCoinId: this.dealType ? this.currentCoinID : 'CNY',
  448. outAmount: this.dealType ? this.totalPrice : this.quantity, //买金额 卖数量
  449. outCoinId: this.dealType ? 'CNY' : this.currentCoinID,
  450. minAmount: this.minPrice, //最小限额
  451. alipay: this.alipay,
  452. weixinpay: this.weixinpay,
  453. unionpay: this.unionpay,
  454. payPwd: this.payPwd,
  455. noteVerifyCode: this.noteVerifyCode,
  456. randomString: this.randomString,
  457. imgVerifyCode: this.imgVerifyCode,
  458. }
  459. this.postAxios('/api/market/order/publish', params)
  460. .then(() => {
  461. this.loading = false;
  462. this.loading2 = false;
  463. this.$message.success('广告发布成功!');
  464. setTimeout(() => {
  465. this.$router.push('/currency/ads');
  466. }, 800)
  467. })
  468. .catch(() => {
  469. this.loading = false;
  470. this.loading2 = false;
  471. })
  472. }
  473. },
  474. created() {
  475. this.getCoinList();
  476. this.getUserInfoData();
  477. this.getPayment();
  478. this.getImageCode();
  479. }
  480. }
  481. </script>
  482. <style scoped>
  483. .order-top-div2 {
  484. position: absolute;
  485. right: 0;
  486. top: 0;
  487. }
  488. .top-price {
  489. margin-bottom: 30px;
  490. }
  491. .release-form {
  492. background: #f6f6f6;
  493. display: flex;
  494. align-items: center;
  495. padding: 0 10px;
  496. }
  497. .release-form .text-input {
  498. width: auto;
  499. flex: 1 1 auto;
  500. padding: 0;
  501. }
  502. </style>