part_time_push.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <view class="main">
  3. <view class="form_group">
  4. <view class="lable re">兼职名称</view>
  5. <input placeholder="请输入" v-model="item.title" :disabled="item.audit == 1" />
  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="请输入兼职描述" :read="item.audit == 1"></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" :disabled="item.audit == 1" />
  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="ok()" v-if="item.id && item.audit == 0">编辑</button>
  62. <button class="btn" @click="save()" v-if="!item.id">保存</button>
  63. <u-popup :show="show" round="15" mode="center" :closeable="true" :closeOnClickOverlay="false" :customStyle="{ width: '85%' }" @close="show = false">
  64. <view class="popup">
  65. <view class="mtt">兼职金额</view>
  66. <view class="money">¥{{ item.salary }}</view>
  67. <view>
  68. <view class="item">
  69. <text class="tt">服务费</text>
  70. <text class="la">¥{{ item.serviceMoney }}</text>
  71. </view>
  72. <view class="item">
  73. <text class="tt">费率</text>
  74. <text class="la">{{ platform.partTimeService }}%</text>
  75. </view>
  76. <view class="item">
  77. <text class="tt">实际扣除</text>
  78. <text class="la">¥{{ item.realMoney }}</text>
  79. </view>
  80. </view>
  81. <button class="btn" @click="ok()">确定</button>
  82. </view>
  83. </u-popup>
  84. </view>
  85. </template>
  86. <script>
  87. export default {
  88. data() {
  89. return {
  90. money: 0,
  91. item: { type: 1 },
  92. end: this.util.getDate('day'),
  93. platform: {},
  94. show: false
  95. };
  96. },
  97. onLoad(e) {
  98. if (e.id) {
  99. this.http.request({
  100. url: '/app/position/manage/detail/' + e.id,
  101. success: (res) => {
  102. this.item = res.data.data;
  103. this.$refs.editor.setContents();
  104. uni.setNavigationBarTitle({ title: '编辑兼职' });
  105. }
  106. });
  107. }
  108. uni.$on('select_position', (res) => {
  109. this.item.positionName = res.title;
  110. this.item.positionId = res.id;
  111. this.$forceUpdate();
  112. });
  113. this.getPlatform();
  114. },
  115. onShow() {
  116. this.money = uni.getStorageSync('money');
  117. },
  118. methods: {
  119. //平台服务费信息
  120. getPlatform() {
  121. this.http.request({
  122. url: '/app/pay/getPlatform',
  123. success: (res) => {
  124. this.platform = res.data.data;
  125. }
  126. });
  127. },
  128. picker(e, tag) {
  129. this.item[tag] = e.detail.value;
  130. this.$forceUpdate();
  131. },
  132. go(url) {
  133. uni.navigateTo({ url: url });
  134. },
  135. chooseLocation() {
  136. uni.chooseLocation({
  137. success: (res) => {
  138. let reg = /.+?(省|市|自治区|自治州|县|区)/g;
  139. let addressList = res.address.match(reg).toString().split(',');
  140. //注意区分直辖市;
  141. let city = addressList.length >= 3 ? addressList[1] : addressList[0];
  142. let region = addressList.length >= 3 ? addressList[2] : addressList[1];
  143. this.item.location = res.name;
  144. this.item.address = res.address;
  145. this.item.longitude = res.longitude;
  146. this.item.latitude = res.latitude;
  147. this.item.regionName = region;
  148. this.item.cityName = city;
  149. this.$forceUpdate();
  150. }
  151. });
  152. },
  153. save() {
  154. let rule = [
  155. { name: 'title', checkType: 'notnull', errorMsg: '请输入兼职名称' },
  156. { name: 'positionName', checkType: 'notnull', errorMsg: '请选择兼职类型' },
  157. { name: 'contents', checkType: 'notnull', errorMsg: '请输入兼职描述(要求)' },
  158. { name: 'salary', checkType: 'notnull', errorMsg: '请输入兼职金额' },
  159. { name: 'startDate', checkType: 'notnull', errorMsg: '请选择兼职开始时间' },
  160. { name: 'endDate', checkType: 'notnull', errorMsg: '请选择兼职结束时间' }
  161. ];
  162. if (!this.verify.check(this.item, rule)) {
  163. uni.showModal({ content: this.verify.error, showCancel: false });
  164. return false;
  165. }
  166. this.show = true;
  167. this.item.serviceMoney = (this.item.salary * (this.platform.partTimeService / 100)).toFixed(2);
  168. this.item.realMoney = (parseFloat(this.item.salary) + parseFloat(this.item.serviceMoney)).toFixed(2);
  169. },
  170. ok() {
  171. this.http.request({
  172. url: this.item.id ? '/app/position/manage/edit' : '/app/position/manage/add',
  173. data: this.item,
  174. method: 'POST',
  175. success: (res) => {
  176. //实名认证跳转
  177. if (res.data.code == 7878) {
  178. uni.showModal({
  179. title: '提示',
  180. content: res.data.msg,
  181. showCancel: false,
  182. success: (res) => {
  183. uni.navigateTo({ url: '/pages/user/auth' });
  184. }
  185. });
  186. return;
  187. }
  188. //余额不足,请先充值
  189. if (res.data.code == 8080) {
  190. uni.showModal({
  191. title: '提示',
  192. content: res.data.msg,
  193. showCancel: false,
  194. success: (res) => {
  195. uni.navigateTo({ url: '/pages/user/money/index' });
  196. }
  197. });
  198. return;
  199. }
  200. uni.showToast({ title: '操作成功' });
  201. setTimeout(() => {
  202. uni.$emit('position');
  203. uni.navigateBack();
  204. }, 1500);
  205. }
  206. });
  207. }
  208. }
  209. };
  210. </script>
  211. <style lang="scss">
  212. .bgm {
  213. .input {
  214. width: 50%;
  215. }
  216. .msg {
  217. text {
  218. padding-left: 17px;
  219. }
  220. }
  221. }
  222. </style>