auction.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. define({
  2. template:`
  3. <div>
  4. <el-form ref="auction" label-width="15%" :rules="rules">
  5. <div id="vue_head">
  6. <div class="base_set">
  7. <div class="vue-main-title">
  8. <div class="vue-main-title-left"></div>
  9. <div class="vue-main-title-content">拍卖</div>
  10. </div>
  11. <div class="vue-main-form auction" style="margin:0 auto;width:80%;">
  12. <el-form-item label="商品所属拍卖员">
  13. <div class="upload-box" >
  14. <div class="upload-box-member" @click="btnNotificationData">
  15. <i class="el-icon-plus notcie_icon" style="font-size:32px"></i><br>
  16. <span>选择商品所属拍卖员</span>
  17. </div>
  18. </div>
  19. <div class="img_box" v-if="auctioneer.avatar_image">
  20. <img :src="auctioneer.avatar_image"/>
  21. <span class="introduce_name">{{auctioneer.nickname}}</span>
  22. </div>
  23. </el-form-item>
  24. <el-form-item label="拍卖商品审核状态">
  25. <el-radio v-model="auction.type" :label="0">审核中</el-radio>
  26. <el-radio v-model="auction.type" :label="1">审核通过</el-radio>
  27. <el-radio v-model="auction.type" :label="2">审核失败</el-radio>
  28. <div class="tip">审核通过允许上架,审核失败不允许上架</div>
  29. </el-form-item>
  30. <el-form-item label="起拍价" prop="start_price">
  31. <el-input v-model.trim="auction.start_price" maxlength="300">
  32. <template slot="append">元</template>
  33. </el-input>
  34. <div class="form-item_tips">商品最低拍卖价</div>
  35. </el-form-item>
  36. <el-form-item label="加一口" prop="mini_markup">
  37. <el-input v-model.trim="auction.mini_markup" maxlength="300">
  38. <template slot="append">元</template>
  39. </el-input>
  40. <div class="form-item_tips">商品每次加价金额</div>
  41. </el-form-item>
  42. <el-form-item label="一口价" prop="fixed_price">
  43. <el-input v-model.trim="auction.fixed_price" maxlength="300">
  44. <template slot="append">元</template>
  45. </el-input>
  46. <!-- <div class="form-item_tips">出价达到或者超过此价格时立即成交</div>-->
  47. </el-form-item>
  48. <el-form-item label="封顶金额" prop="capped_amount">
  49. <el-input v-model.trim="auction.capped_amount" maxlength="300">
  50. <template slot="append">元</template>
  51. </el-input>
  52. <div class="form-item_tips">出价达到或者超过此价格时立即成交</div>
  53. </el-form-item>
  54. <!-- <el-form-item label="最低成交价(保留价)" prop="mini_deal" label-width="155px">-->
  55. <!-- <el-input v-model.trim="auction.mini_deal" maxlength="300">-->
  56. <!-- <template slot="append">元</template>-->
  57. <!-- </el-input>-->
  58. <!-- <div class="form-item_tips">拍卖品的最低成交金额</div>-->
  59. <!-- </el-form-item>-->
  60. <el-form-item :label="endorsement_name" >
  61. <div style="display: flex;">
  62. <el-form-item prop="em_proportion">
  63. <el-input v-model.trim="auction.em_proportion" maxlength="300">
  64. <template slot="prepend">比例或固定金额</template>
  65. <template slot="append">%</template>
  66. </el-input>
  67. </el-form-item>
  68. <el-form-item prop="endorsement">
  69. <el-input v-model.trim="auction.endorsement" maxlength="300">
  70. <template slot="append">元</template>
  71. </el-input>
  72. </el-form-item>
  73. </div>
  74. <div class="form-item_tips">拍卖完成后会员上级获得{{endorsement_name}}</div>
  75. </el-form-item>
  76. <el-form-item label="成交奖励积分" prop="reward_points">
  77. <el-input v-model.trim="auction.reward_points" maxlength="300">
  78. <!--<template slot="append">元</template>-->
  79. </el-input>
  80. </el-form-item>
  81. <el-form-item label="拍卖开始和结束时间" label-width="155px">
  82. <el-date-picker
  83. value-format="timestamp"
  84. type="datetimerange"
  85. v-model="timeLimit"
  86. range-separator="至"
  87. start-placeholder="开始日期"
  88. end-placeholder="结束日期">
  89. </el-date-picker>
  90. </el-form-item>
  91. <el-form-item label="保证金金额" >
  92. <div style="display: flex;">
  93. <el-form-item prop="advance_proportion">
  94. <el-input v-model.trim="auction.advance_proportion" maxlength="300">
  95. <template slot="prepend">比例或固定金额</template>
  96. <template slot="append">%</template>
  97. </el-input>
  98. </el-form-item>
  99. <el-form-item prop="advance_money">
  100. <el-input v-model.trim="auction.advance_money" maxlength="300">
  101. <template slot="append">元</template>
  102. </el-input>
  103. </el-form-item>
  104. </div>
  105. </el-form-item>
  106. <el-form-item label="出价奖励金额" >
  107. <div style="display: flex;">
  108. <el-form-item prop="balance_proportion">
  109. <el-input v-model.trim="auction.balance_proportion" maxlength="300">
  110. <template slot="prepend">比例或固定金额</template>
  111. <template slot="append">%</template>
  112. </el-input>
  113. </el-form-item>
  114. <el-form-item prop="balance_money">
  115. <el-input v-model.trim="auction.balance_money" maxlength="300">
  116. <template slot="append">元</template>
  117. </el-input>
  118. </el-form-item>
  119. </div>
  120. </el-form-item>
  121. <el-form-item label="拍卖结束触发延时时间" prop="delay_before_minute" label-width="155px">
  122. <el-input v-model.trim="auction.delay_before_minute" maxlength="300">
  123. <template slot="append">分</template>
  124. </el-input>
  125. </el-form-item>
  126. <el-form-item label="延时周期时间" prop="delay_cycle_minute">
  127. <el-input v-model.trim="auction.delay_cycle_minute" maxlength="300">
  128. <template slot="append">分</template>
  129. </el-input>
  130. </el-form-item>
  131. </div>
  132. </div>
  133. </div>
  134. </el-form>
  135. <!-- 选择图片弹窗 -->
  136. <el-dialog :visible.sync="choose_goods_show" width="60%" left title="选择通知人">
  137. <div>
  138. <div class="search_line">
  139. <el-input style="width:90%" placeholder="" v-model="keyword"></el-input>
  140. <el-button @click="btnSearch">搜索</el-button>
  141. </div>
  142. <el-table :data="memberData" style="width: 100%;height:500px;overflow:auto" v-loading="loading">
  143. <el-table-column label="昵称" align="" >
  144. <template slot-scope="scope">
  145. <div style="display:flex;">
  146. <img style="width: 50px;height:50px" :src="scope.row.avatar_image" alt="">
  147. <span class="nickname_card">{{scope.row.nickname}}</span>
  148. </div>
  149. </template>
  150. </el-table-column>
  151. <el-table-column label="会员ID" align="center" prop="uid"></el-table-column>
  152. <el-table-column label="姓名" align="center" prop="username"></el-table-column>
  153. <el-table-column label="手机号码" align="center" prop="mobile"></el-table-column>
  154. <el-table-column label="" align="center">
  155. <template slot-scope="scope">
  156. <span style="color:#399fbd" @click="btnSelect(scope.row)">
  157. 选择
  158. </span>
  159. </template>
  160. </el-table-column>
  161. </el-table>
  162. </div>
  163. <span slot="footer" class="dialog-footer">
  164. <el-button @click="choose_goods_show = false">取 消</el-button>
  165. </span>
  166. </el-dialog>
  167. </div>
  168. `,
  169. style:`
  170. .auction .el-input-group {
  171. width:300px;
  172. }
  173. .img_box{
  174. margin:20px 0;
  175. display: flex;
  176. flex-direction: column;
  177. }
  178. .img_box img{
  179. width:150px;
  180. height:150px;
  181. }
  182. .introduce_name{
  183. width: 150px;
  184. line-height: 20px;
  185. }
  186. .notcie_icon{
  187. font-size: 32px;
  188. width: 100%;
  189. text-align: center;
  190. }
  191. .el-checkbox-group{
  192. display: contents;
  193. }
  194. .nickname_card{
  195. align-items: center;
  196. overflow: hidden;
  197. text-overflow: ellipsis;
  198. display: -webkit-box;
  199. -webkit-box-orient: vertical;
  200. -webkit-line-clamp: 1;
  201. height: fit-content;
  202. line-height: 50px;
  203. margin-left:10px;
  204. }
  205. `,
  206. props: {
  207. form: {
  208. default() {
  209. return {}
  210. }
  211. },
  212. http_url:{
  213. type:String,
  214. default() {
  215. return "";
  216. }
  217. },
  218. },
  219. data() {
  220. let intReg = /^[0-9]*$/;
  221. let floatReg = /^\d+(\.\d+)?$/;
  222. // 整数校验
  223. let intNum = (rule,value,callback)=>{
  224. let regular = intReg.test(value);
  225. if(!value){
  226. callback();
  227. }else{
  228. if (regular) {
  229. callback();
  230. }else{
  231. callback(new Error("请输入正整数"));
  232. }
  233. }
  234. };
  235. // 浮点数校验
  236. let floatNum = (rule,value,callback)=>{
  237. let regular = floatReg.test(value);
  238. if(!value){
  239. callback();
  240. }else{
  241. if (regular) {
  242. callback();
  243. }else{
  244. callback(new Error("请输入大于零或等于零的数字"));
  245. }
  246. }
  247. };
  248. return {
  249. rules: {
  250. start_price: { validator: floatNum },
  251. mini_markup: { validator: floatNum },
  252. fixed_price: { validator: floatNum },
  253. // mini_deal: { validator: floatNum },
  254. delay_before_minute: { validator: intNum },
  255. delay_cycle_minute: { validator: intNum },
  256. reward_points:{validator: intNum},
  257. },
  258. choose_goods_show:false,
  259. choose_goods_loading:false,
  260. keyword:"",
  261. loading:false,
  262. timeLimit:'',
  263. memberData:[],
  264. endorsement_name:'',
  265. auctioneer:{
  266. nickname:"",
  267. avatar_image:"",
  268. uid:"",
  269. },
  270. auction: {
  271. type: 0,
  272. start_price:0,
  273. mini_markup:0,
  274. fixed_price:0,
  275. capped_amount:0,
  276. // mini_deal:0,
  277. reward_points:0,
  278. delay_before_minute:0,
  279. delay_cycle_minute:0,
  280. },
  281. }
  282. },
  283. mounted() {
  284. this.endorsement_name = this.form.endorsement_name;
  285. this.auctioneer.avatar_image = this.form.auctioneer ? this.form.auctioneer.avatar_image : "";
  286. this.auctioneer.uid = this.form.auctioneer ? this.form.auctioneer.uid : "";
  287. this.auctioneer.nickname = this.form.auctioneer ? this.form.auctioneer.nickname : "";
  288. this.timeLimit = [this.form.start_time * 1000,this.form.end_time * 1000];
  289. if (!Array.isArray(this.form.auction)) {
  290. this.auction = this.form.auction;
  291. }
  292. },
  293. methods:{
  294. btnNotificationData(){
  295. this.choose_goods_show = true;
  296. this.choose_goods_loading = true
  297. },
  298. btnSelect(data){
  299. this.auctioneer.nickname = data.nickname;
  300. this.auctioneer.avatar_image = data.avatar_image;
  301. this.auctioneer.uid = data.uid;
  302. this.choose_goods_show = false
  303. },
  304. btnSearch(){
  305. this.loading = true
  306. this.$http.post(this.http_url +'plugin.auction.admin.auctioneer.get-search-auctioneer-json',{
  307. keyword:this.keyword
  308. }).then(response => {
  309. if(response.data.result==1){
  310. this.$message({
  311. message: '成功',
  312. type: 'success'
  313. });
  314. this.loading = false;
  315. this.memberData = response.data.data.members
  316. }
  317. else{
  318. this.$message.error(response.data);
  319. }
  320. }),function(res){
  321. console.log(res);
  322. };
  323. },
  324. extraDate(){
  325. },
  326. validate(){
  327. // if(!this.auctioneer.uid){
  328. // this.$message({
  329. // message: '请选择商品所属拍卖员', type: 'warning'
  330. // });
  331. // return false;
  332. // }
  333. let json = {
  334. auctioneer_id:this.auctioneer.uid?this.auctioneer.uid: 0,
  335. type:this.auction.type,
  336. start_price:this.auction.start_price,
  337. mini_markup:this.auction.mini_markup,
  338. fixed_price:this.auction.fixed_price,
  339. capped_amount:this.auction.capped_amount,
  340. // mini_deal:this.auction.mini_deal,
  341. reward_points:this.auction.reward_points,
  342. delay_before_minute:this.auction.delay_before_minute,
  343. delay_cycle_minute:this.auction.delay_cycle_minute,
  344. advance_proportion:this.auction.advance_proportion?this.auction.advance_proportion: 0,
  345. advance_money:this.auction.advance_money?this.auction.advance_money: 0,
  346. em_proportion:this.auction.em_proportion?this.auction.em_proportion: 0,
  347. endorsement:this.auction.endorsement?this.auction.endorsement: 0,
  348. balance_proportion:this.auction.balance_proportion?this.auction.balance_proportion: 0,
  349. balance_money:this.auction.balance_money?this.auction.balance_money: 0,
  350. };
  351. if (this.timeLimit) {
  352. json.start_shooting = this.timeLimit[0] / 1000;
  353. json.end_shooting = this.timeLimit[1] / 1000;
  354. }
  355. return json;
  356. }
  357. }
  358. });