part_time_push.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <view class="main">
  3. <view class="form_group">
  4. <view class="lable re">兼职名称</view>
  5. <input placeholder="请输入" v-model="item.title" />
  6. </view>
  7. <view class="form_group">
  8. <view class="lable re">兼职类型</view>
  9. <picker :disabled="true" @click="go('/pages/job/position/classification')">
  10. <input placeholder="请选择" v-model="item.positionName" :disabled="true" />
  11. <view class="icon more">&#xe62b;</view>
  12. </picker>
  13. </view>
  14. <view class="form_group">
  15. <view class="lable re">兼职描述(要求)</view>
  16. <leditor ref="editor" v-model="item.contents" placeholder="请输入兼职描述"></leditor>
  17. </view>
  18. <view class="form_group">
  19. <view class="lable re">兼职金额(元)</view>
  20. <view class="bgm">
  21. <input type="digit" placeholder="请输入" v-model="item.salary" class="input" />
  22. <view class="msg">
  23. <text>{{ money }}</text>
  24. <text @click="go('/pages/user/money/index')">充值</text>
  25. </view>
  26. </view>
  27. <view class="bz">
  28. <text class="icon">&#xe634;</text>
  29. <text>兼职金额从账户余额扣除,请保留充足的余额</text>
  30. </view>
  31. </view>
  32. <view class="form_group">
  33. <view class="lable re">兼职时间</view>
  34. </view>
  35. <view class="form_group" style="display: flex">
  36. <view class="start">
  37. <picker mode="date" :start="end" @change="picker($event, 'startDate')">
  38. <input placeholder="开始时间" v-model="item.startDate" :disabled="true" />
  39. </picker>
  40. </view>
  41. <view class="hor">至</view>
  42. <view class="start">
  43. <picker mode="date" :start="end" @change="picker($event, 'endDate')">
  44. <input placeholder="结束时间" v-model="item.endDate" :disabled="true" />
  45. </picker>
  46. </view>
  47. </view>
  48. <view class="form_group">
  49. <view class="lable re">结算方式</view>
  50. <input value="完工结算" :disabled="true" />
  51. </view>
  52. <view class="form_group">
  53. <view class="lable">兼职地点</view>
  54. <picker :disabled="true" @click="chooseLocation()">
  55. <input :placeholder="item.type == 0 ? '请选择' : '留空不限工作地点'" v-model="item.location" :disabled="true" />
  56. <view class="icon more">&#xe8f2;</view>
  57. </picker>
  58. <input placeholder="请输入楼层/单元室/门牌号" v-model="item.mph" v-if="item.address" />
  59. <view class="bz">如需应聘者去现场请选择兼职地点</view>
  60. </view>
  61. <button class="btn" @click="save()">{{ item.id ? '编辑' : '保存' }}</button>
  62. <u-popup :show="show" round="15" mode="center" :closeable="true" :closeOnClickOverlay="false" :customStyle="{ width: '85%' }" @close="show = false">
  63. <view class="popup">
  64. <view class="mtt">兼职金额</view>
  65. <view class="money">¥{{ item.salary }}</view>
  66. <view>
  67. <view class="item">
  68. <text class="tt">服务费</text>
  69. <text class="la">¥{{ item.serviceMoney }}</text>
  70. </view>
  71. <view class="item">
  72. <text class="tt">费率</text>
  73. <text class="la">{{ platform.cashOutService }}%</text>
  74. </view>
  75. <view class="item">
  76. <text class="tt">实际扣除</text>
  77. <text class="la">¥{{ item.realMoney }}</text>
  78. </view>
  79. </view>
  80. <button class="btn" @click="ok()">确定</button>
  81. </view>
  82. </u-popup>
  83. </view>
  84. </template>
  85. <script>
  86. export default {
  87. data() {
  88. return {
  89. money: 0,
  90. item: { type: 1 },
  91. end: this.util.getDate('day'),
  92. platform: {},
  93. show: false
  94. };
  95. },
  96. onLoad(e) {
  97. if (e.id) {
  98. this.http.request({
  99. url: '/app/position/manage/detail/' + e.id,
  100. success: (res) => {
  101. this.item = res.data.data;
  102. this.$refs.editor.setContents();
  103. uni.setNavigationBarTitle({ title: '编辑兼职' });
  104. }
  105. });
  106. }
  107. uni.$on('select_position', (res) => {
  108. this.item.positionName = res.title;
  109. this.item.positionId = res.id;
  110. this.$forceUpdate();
  111. });
  112. this.getPlatform();
  113. },
  114. onShow() {
  115. this.money = uni.getStorageSync('money');
  116. },
  117. methods: {
  118. //平台服务费信息
  119. getPlatform() {
  120. this.http.request({
  121. url: '/app/pay/getPlatform',
  122. success: (res) => {
  123. this.platform = res.data.data;
  124. }
  125. });
  126. },
  127. picker(e, tag) {
  128. this.item[tag] = e.detail.value;
  129. this.$forceUpdate();
  130. },
  131. go(url) {
  132. uni.navigateTo({ url: url });
  133. },
  134. chooseLocation() {
  135. uni.chooseLocation({
  136. success: (res) => {
  137. let reg = /.+?(省|市|自治区|自治州|县|区)/g;
  138. let addressList = res.address.match(reg).toString().split(',');
  139. //注意区分直辖市;
  140. let city = addressList.length >= 3 ? addressList[1] : addressList[0];
  141. let region = addressList.length >= 3 ? addressList[2] : addressList[1];
  142. this.item.location = res.name;
  143. this.item.address = res.address;
  144. this.item.longitude = res.longitude;
  145. this.item.latitude = res.latitude;
  146. this.item.regionName = region;
  147. this.item.cityName = city;
  148. this.$forceUpdate();
  149. }
  150. });
  151. },
  152. save() {
  153. let rule = [
  154. { name: 'title', checkType: 'notnull', errorMsg: '请输入兼职名称' },
  155. { name: 'positionName', checkType: 'notnull', errorMsg: '请选择兼职类型' },
  156. { name: 'contents', checkType: 'notnull', errorMsg: '请输入兼职描述(要求)' },
  157. { name: 'salary', checkType: 'notnull', errorMsg: '请输入兼职金额' },
  158. { name: 'startDate', checkType: 'notnull', errorMsg: '请选择兼职开始时间' },
  159. { name: 'endDate', checkType: 'notnull', errorMsg: '请选择兼职结束时间' }
  160. ];
  161. if (!this.verify.check(this.item, rule)) {
  162. uni.showModal({ content: this.verify.error, showCancel: false });
  163. return false;
  164. }
  165. this.show = true;
  166. this.item.serviceMoney = (this.item.salary * (this.platform.cashOutService / 100)).toFixed(2);
  167. this.item.realMoney = (parseFloat(this.item.salary) + parseFloat(this.item.serviceMoney)).toFixed(2);
  168. },
  169. ok() {
  170. this.http.request({
  171. url: this.item.id ? '/app/position/manage/edit' : '/app/position/manage/add',
  172. data: this.item,
  173. method: 'POST',
  174. success: (res) => {
  175. //实名认证跳转
  176. if (res.data.code == 7878) {
  177. uni.showModal({
  178. title: '提示',
  179. content: res.data.msg,
  180. showCancel: false,
  181. success: (res) => {
  182. uni.navigateTo({ url: '/pages/user/auth' });
  183. }
  184. });
  185. return;
  186. }
  187. //余额不足,请先充值
  188. if (res.data.code == 8080) {
  189. uni.showModal({
  190. title: '提示',
  191. content: res.data.msg,
  192. showCancel: false,
  193. success: (res) => {
  194. uni.navigateTo({ url: '/pages/user/money/index' });
  195. }
  196. });
  197. return;
  198. }
  199. uni.showToast({ title: '操作成功' });
  200. setTimeout(() => {
  201. uni.$emit('position');
  202. uni.navigateBack();
  203. }, 1500);
  204. }
  205. });
  206. }
  207. }
  208. };
  209. </script>
  210. <style lang="scss">
  211. .bgm {
  212. .input {
  213. width: 50%;
  214. }
  215. .msg {
  216. text {
  217. padding-left: 17px;
  218. }
  219. }
  220. }
  221. </style>