modifyLoc.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <!-- 售后部修改设备位置信息-->
  3. <div class="fife" style="background-color:#ebedf0">
  4. <s-header :name="'修改设备发货位置信息'" :noback="false"></s-header>
  5. <br>
  6. <van-form @submit="onSubmit">
  7. <van-cell-group inset>
  8. <van-field v-model="modName" name="姓名" label="姓名" placeholder="姓名" left-icon="smile-o"
  9. :rules="[{ required: true, message: '请填写真实姓名' }]" />
  10. <van-field v-model="modPhone" name="电话" label="电话" placeholder="手机号码" left-icon="phone-o"
  11. :rules="[{ required: true, message: '请填写联系电话' }]" />
  12. <!-- <van-field v-model="modUsername" name="用户名" label="用户名" placeholder="用户名/登录账号"
  13. :rules="[{ required: true, message: '请填写用户名' }]" /> -->
  14. <van-field v-model="clientId" name="设备唯一码" label="设备唯一码" placeholder="设备唯一码" left-icon="setting-o"
  15. :rules="[{ required: true, message: '设备唯一码不能为空' }]" />
  16. <van-field v-model="country" is-link readonly name="发往国家" label="发往国家" placeholder="发往国家" left-icon="guide-o"
  17. :rules="[{ required: true, message: '请填写发往国家' }]" @click="showPicker = true" />
  18. <van-popup v-model:show="showPicker" round position="bottom">
  19. <van-picker :columns="columns" @confirm="onConfirm" @cancel="showPicker = false" />
  20. </van-popup>
  21. <van-field v-model="location" name="地区名称" label="地区名称" placeholder="城市/地区名称" left-icon="location-o"/>
  22. </van-cell-group>
  23. <div style="margin: 16px; display: flex; justify-content: center; align-items: center;">
  24. <van-button round class="custom-button" type="primary" size="small" native-type="submit" block>
  25. 提交
  26. </van-button>
  27. </div>
  28. </van-form>
  29. </div>
  30. </template>
  31. <script>
  32. import sHeader from "@/components/SimpleHeader";
  33. import { updateLocInfo } from "../../service/fife/modifyLoc";
  34. import { ref } from "vue";
  35. import { Toast } from "vant";
  36. export default {
  37. components: { sHeader },
  38. setup: function () {
  39. const modPhone = ref('');
  40. const modName = ref('');
  41. // const modUsername = ref('');
  42. const country = ref('');
  43. const location = ref('');
  44. const clientId = ref('');
  45. const showPicker = ref(false);
  46. const columns = [
  47. { text: '英国', value: '英国' },
  48. { text: '美国', value: '美国' },
  49. { text: '加拿大', value: '加拿大' },
  50. { text: '澳大利亚', value: '澳大利亚' },
  51. { text: '德国', value: '德国' },
  52. { text: '奥地利', value: '奥地利' },
  53. { text: '瑞士', value: '瑞士' },
  54. { text: '俄罗斯', value: '俄罗斯' },
  55. { text: '白俄罗斯', value: '白俄罗斯' },
  56. { text: '乌克兰', value: '乌克兰' },
  57. { text: '日本', value: '日本' },
  58. { text: '西班牙', value: '西班牙' },
  59. { text: '墨西哥', value: '墨西哥' },
  60. { text: '阿根廷', value: '阿根廷' },
  61. { text: '法国', value: '法国' },
  62. { text: '比利时', value: '比利时' },
  63. { text: '保加利亚', value: '保加利亚' },
  64. { text: '丹麦', value: '丹麦' },
  65. { text: '芬兰', value: '芬兰' },
  66. { text: '荷兰', value: '荷兰' },
  67. { text: '比利时', value: '比利时' },
  68. { text: '捷克', value: '捷克' },
  69. { text: '罗马尼亚', value: '罗马尼亚' },
  70. { text: '挪威', value: '挪威' },
  71. { text: '葡萄牙', value: '葡萄牙' },
  72. { text: '巴西', value: '巴西' },
  73. { text: '瑞典', value: '瑞典' },
  74. { text: '斯洛伐克', value: '斯洛伐克' },
  75. { text: '匈牙利', value: '匈牙利' },
  76. { text: '意大利', value: '意大利' },
  77. { text: '韩国', value: '韩国' },
  78. { text: '波兰', value: '波兰' },
  79. { text: '乌克兰', value: '乌克兰' },
  80. { text: '亚美尼亚', value: '亚美尼亚' },
  81. { text: '阿拉伯', value: '阿拉伯' },
  82. { text: '泰国', value: '泰国' },
  83. { text: '以色列', value: '以色列' },
  84. { text: '格鲁吉亚', value: '格鲁吉亚' },
  85. { text: '土耳其', value: '土耳其' },
  86. { text: '拉脱维亚', value: '拉脱维亚' },
  87. { text: '爱沙尼亚', value: '爱沙尼亚' },
  88. { text: '蒙古国', value: '蒙古国' },
  89. { text: '伊朗', value: '伊朗' },
  90. ];
  91. const onConfirm = ({ selectedOptions }) => {
  92. if (selectedOptions[0] != null) {
  93. showPicker.value = false;
  94. country.value = selectedOptions[0].text;
  95. }
  96. }
  97. // 提交表单
  98. const locationCheck = {
  99. modName: modName.value,
  100. modPhone: modPhone.value,
  101. // modUsername: modUsername.value,
  102. clientId: clientId.value,
  103. country: country.value,
  104. location: location.value
  105. }
  106. const onSubmit = async () => {
  107. const { data } = await updateLocInfo(locationCheck);
  108. if (data.code === "00000") {
  109. // 成功
  110. // ElMessage.success("保存成功");
  111. Toast(data.message);
  112. } else {
  113. Toast(data.message);
  114. }
  115. }
  116. return {
  117. onSubmit,
  118. clientId,
  119. locationCheck,
  120. onConfirm,
  121. columns,
  122. showPicker,
  123. country,
  124. modName,
  125. // modUsername,
  126. modPhone,
  127. location,
  128. };
  129. }
  130. }
  131. </script>
  132. <style>
  133. .custom-button {
  134. width: 120px;
  135. }
  136. </style>