store.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <view>
  3. <my_form ref="form" :form="form" @isUncomplete="isUncomplete" requiredFieldOnly @interrupt="interrupt" />
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. sa_storeid: 0,
  11. form: []
  12. }
  13. },
  14. async onLoad() {
  15. uni.setNavigationBarTitle({
  16. title: '新增人员'
  17. });
  18. this.form = [{
  19. key: "storename",
  20. type: "text",
  21. label: "门店名称",
  22. isMust: true,//是否必填
  23. value: "",
  24. }, {
  25. key: "area",
  26. type: "text",
  27. label: "面积(m²)",
  28. isMust: true,//是否必填
  29. value: "",
  30. inputmode: 'digit',
  31. }, {
  32. key: "leader_hrid",
  33. type: "route",
  34. path: "/team/userCenter/selectUser?title=选择负责人",
  35. isRadio: true,
  36. label: "负责人姓名",
  37. isMust: true,//是否必填
  38. value: [],
  39. showValue: [],
  40. interrupt: true
  41. }, {
  42. key: "phonenumber",
  43. type: "text",
  44. label: "负责人电话",
  45. isMust: true,//是否必填
  46. value: "",
  47. inputmode: 'number',
  48. disabled: true,
  49. verify: [this.getReg("phonenumber")]
  50. }, {
  51. key: "sale_phonenmber",
  52. type: "text",
  53. label: "门店售前电话",
  54. isMust: false,//是否必填
  55. value: "",
  56. inputmode: 'number',
  57. verify: [this.getReg("phonenumber")]
  58. }, {
  59. key: "service_phonenmber",
  60. type: "text",
  61. label: "门店售后电话",
  62. isMust: false,//是否必填
  63. value: "",
  64. inputmode: 'number',
  65. verify: [this.getReg("phonenumber")]
  66. }, {
  67. key: "storetype",
  68. type: "radio",
  69. label: "门店类型",
  70. value: "直营",
  71. options: [{
  72. label: "直营",
  73. name: "直营",
  74. marginRight: 60
  75. }, {
  76. label: "分销",
  77. name: "分销",
  78. }]
  79. }, {
  80. key: "markettype",
  81. type: "customClass",
  82. label: "门店卖场类型",
  83. isMust: false,//是否必填
  84. isMultipleChoice: false,//是否多选
  85. value: '',// 多选[] 单选 ""
  86. list: await this.getCustomClass('storetype')
  87. }, {
  88. key: "selectMap",
  89. type: "route",
  90. path: "/select/place/index",
  91. label: "门店地址",
  92. isMust: true,//是否必填
  93. value: {},
  94. }];
  95. },
  96. methods: {
  97. isUncomplete(uncomplete) {
  98. this.uncomplete = uncomplete;
  99. },
  100. interrupt(item, selected, index) {
  101. console.log(item)
  102. console.log(selected)
  103. console.log(index)
  104. switch (item.key) {
  105. case "leader_hrid":
  106. item.showValue = [selected.name];
  107. item.value = [selected.sys_enterprise_hrid];
  108. this.$refs.form.setItem(index, item)
  109. this.$refs.form.setValue(index + 1, selected.phonenumber, true)
  110. break;
  111. }
  112. },
  113. submit() {
  114. this.loading = true;
  115. let that = this;
  116. this.$refs.form.submit().then(data => {
  117. this.$Http.basic({
  118. "id": 20240410095302,
  119. "content": {
  120. "sa_storeid": this.sa_storeid,
  121. ...data
  122. }
  123. }).then(res => {
  124. this.loading = false;
  125. console.log("加入团队", res)
  126. if (this.cutoff(res.msg)) return;
  127. this.loading = true;
  128. if (this.attachmentids.length) {
  129. this.uploadCallback(this.attachmentids, "sys_users", this.userid).then(s => {
  130. if (s) getUserMsg()
  131. });
  132. if (this.headportraits.length) this.$Http.basic({
  133. "classname": "system.attachment.Attachment",
  134. "method": "deleteFileLink",
  135. "content": {
  136. linksids: this.headportraits.map(v => v.linksid)
  137. }
  138. })
  139. } else {
  140. getUserMsg()
  141. }
  142. function getUserMsg() {
  143. that.$Http.wechatLogin().then(token => {
  144. that.loading = false;
  145. uni.showModal({
  146. title: '提示',
  147. content: '成功加入团队',
  148. showCancel: false,
  149. confirmText: '确定',
  150. confirmColor: '#C40C24',
  151. success: ({ confirm }) => {
  152. if (confirm) uni.redirectTo({
  153. url: '/pages/index/index',
  154. })
  155. }
  156. });
  157. })
  158. }
  159. })
  160. })
  161. },
  162. },
  163. onShow() {
  164. /* let a11 = {
  165. address: "浙江省嘉兴市南湖区望湖路585号",
  166. city: "嘉兴市",
  167. county: "南湖区",
  168. district: "南湖区",
  169. latitude: 30.74803,
  170. longitude: 120.786539,
  171. name: "翡翠花园",
  172. province: "浙江省"
  173. }
  174. if (location) {
  175. location.county = location.district;
  176. this.location = location;
  177. this.$refs.form.setValue(this.form.findIndex(v => v.label == '门店地址'), location.name || this.getCity(location))
  178. } */
  179. }
  180. }
  181. </script>
  182. <style></style>