stylebook.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <view class="page">
  3. <view class="stylebookbox">
  4. <view class="apply">样书申请</view>
  5. <view class="stylebook">
  6. 欢迎您申请我们的国优、国规样书
  7. </view>
  8. <view class="dotted">
  9. <image src="/static/images/dotted.png" style="width: 654rpx;height: 4rpx;" mode=""></image>
  10. </view>
  11. <!-- 姓名 -->
  12. <view class="item">
  13. <view class="name">
  14. <text>*</text>
  15. <text style="color: rgba(34, 34, 34, 1);">您的姓名</text>
  16. </view>
  17. <view class="box u-flex">
  18. <input v-model="from.name" type="text" style="width: 100%;" />
  19. </view>
  20. </view>
  21. <!-- 电话 -->
  22. <view class="item">
  23. <view class="name">
  24. <text>*</text>
  25. <text style="color: rgba(34, 34, 34, 1);">您的电话</text>
  26. </view>
  27. <view class="box u-flex">
  28. <input v-model="from.phone" type="text" style="width: 100%;" />
  29. </view>
  30. </view>
  31. <!-- 邮箱 -->
  32. <view class="item">
  33. <view class="name">
  34. <text>*</text>
  35. <text style="color: rgba(34, 34, 34, 1);">您的邮箱</text>
  36. </view>
  37. <view class="box u-flex">
  38. <input v-model="from.email" type="text" style="width: 100%;" />
  39. </view>
  40. </view>
  41. <!-- 学校 -->
  42. <view class="item">
  43. <view class="name">
  44. <text>*</text>
  45. <text style="color: rgba(34, 34, 34, 1);">您所在的学校名称</text>
  46. </view>
  47. <view class="box u-flex">
  48. <input v-model="from.school" type="text" style="width: 100%;" />
  49. </view>
  50. </view>
  51. <!-- 样书 -->
  52. <view class="item">
  53. <view class="name">
  54. <text>*</text>
  55. <text style="color: rgba(34, 34, 34, 1);">样书用途</text>
  56. </view>
  57. <!-- <view class="box u-flex"> -->
  58. <view class="" style="margin-top: 38rpx;">
  59. <u-radio-group :wrap='true' @change='changeground' v-model="value">
  60. <u-radio shape="square" active-color="rgba(6, 169, 113, 1)" v-for="(item, index) in list"
  61. :key="index" :name="index" @change="radioChange">
  62. {{item.name}}
  63. </u-radio>
  64. </u-radio-group>
  65. </view>
  66. <!-- </view> -->
  67. </view>
  68. <!-- 地址 -->
  69. <view class="item">
  70. <view class="name">
  71. <text>*</text>
  72. <text style="color: rgba(34, 34, 34, 1);">您的邮寄地址</text>
  73. </view>
  74. <view class="u-flex u-row-between" style="margin-top: 40rpx;">
  75. <view class="address">姓名:</view>
  76. <view class="box u-flex " style="margin-top: 0rpx;width: 500rpx;">
  77. <input v-model="from.mailing_name" type="text" style="width: 100%;" />
  78. </view>
  79. </view>
  80. <view @click="showc=true" class="u-flex u-row-between" style="margin-top: 40rpx;">
  81. <view class="address">所在地区:</view>
  82. <view class="box u-flex " style="margin-top: 0rpx;width: 500rpx;">
  83. {{from.mailing_area}}
  84. <!-- <input @click="showc=true" disabled v-model="from.mailing_area" type="text" style="width: 100%;" /> -->
  85. </view>
  86. </view>
  87. <view class="u-flex u-row-between" style="margin-top: 40rpx;">
  88. <view class="address">详细地址:</view>
  89. <view class="box u-flex " style="margin-top: 0rpx;width: 500rpx;">
  90. <input v-model="from.mailing_address" type="text" style="width: 100%;" />
  91. </view>
  92. </view>
  93. <view class="u-flex u-row-between" style="margin-top: 40rpx;">
  94. <view class="address">手机号码:</view>
  95. <view class="box u-flex " style="margin-top: 0rpx;width: 500rpx;">
  96. <input v-model="from.mailing_phone" type="text" style="width: 100%;" />
  97. </view>
  98. </view>
  99. </view>
  100. <view class="btn" @click="toupload">
  101. 提交
  102. </view>
  103. </view>
  104. <u-select :list='city' mode='mutil-column-auto' value-name='code' label-name='name' child-name='sub'
  105. v-model="showc" @confirm="changecity"></u-select>
  106. </view>
  107. </template>
  108. <script>
  109. import city from '../../common/city-data.js'
  110. export default {
  111. data() {
  112. return {
  113. showc:false,
  114. value: 0,
  115. list: [{
  116. name: '教材用书',
  117. disabled: false,
  118. id: 0
  119. },
  120. {
  121. name: '学习参考',
  122. disabled: false,
  123. id: 1
  124. },
  125. {
  126. name: '其他',
  127. disabled: false,
  128. id: 2
  129. }
  130. ],
  131. city: city,
  132. from: {
  133. name: '',
  134. phone: '',
  135. email: '',
  136. school: '',
  137. use_to: 0,
  138. mailing_name: '',
  139. mailing_area: '',
  140. mailing_address: '',
  141. mailing_phone: '',
  142. books_id: ''
  143. }
  144. };
  145. },
  146. onLoad(options) {
  147. this.from.books_id = options.id
  148. console.log(city);
  149. },
  150. methods: {
  151. changecity(e){
  152. console.log(e);
  153. this.from.mailing_area = e[0].label+e[1].label+e[2].label
  154. },
  155. radioChange(e) {
  156. this.from.use_to = e
  157. },
  158. changeground(e) {
  159. console.log(e);
  160. },
  161. toupload() {
  162. if (!this.from.name) {
  163. this.$u.toast('请输入您的姓名')
  164. return
  165. }
  166. if (!this.$u.test.mobile(this.from.phone)) {
  167. this.$u.toast("请输入正确的手机号")
  168. return
  169. }
  170. if (!this.$u.test.email(this.from.email)) {
  171. this.$u.toast("请输入正确的邮箱号")
  172. return
  173. }
  174. if (!this.from.school) {
  175. this.$u.toast('请输入您的学校')
  176. return
  177. }
  178. if (!this.from.use_to) {
  179. this.$u.toast('请选择图书用途')
  180. return
  181. }
  182. if (!this.from.mailing_name) {
  183. this.$u.toast('请输入您的收货姓名')
  184. return
  185. }
  186. if (!this.from.mailing_address) {
  187. this.$u.toast('请输入您的收货地址')
  188. return
  189. }
  190. if (!this.$u.test.mobile(this.from.mailing_phone)) {
  191. this.$u.toast("请输入正确的收货手机号")
  192. return
  193. }
  194. this.$u.post("api/books/addSampleApply", {
  195. ...this.from
  196. }).then(res => {
  197. console.log(res);
  198. if (res.code == 1) {
  199. uni.navigateBack()
  200. }
  201. })
  202. }
  203. }
  204. }
  205. </script>
  206. <style lang="scss">
  207. .btn {
  208. // width: 614rpx;
  209. height: 82rpx;
  210. background: #06A971;
  211. border-radius: 8rpx;
  212. font-size: 32rpx;
  213. font-family: PingFangSC, PingFang SC;
  214. font-weight: 500;
  215. color: #FFFFFF;
  216. margin-top: 48rpx;
  217. line-height: 82rpx;
  218. text-align: center;
  219. }
  220. .address {
  221. font-size: 26rpx;
  222. font-family: PingFangSC, PingFang SC;
  223. font-weight: 400;
  224. color: #222222;
  225. }
  226. .item {
  227. margin-top: 44rpx;
  228. .name {
  229. font-size: 26rpx;
  230. font-family: PingFangSC, PingFang SC;
  231. font-weight: 500;
  232. color: #CF1534;
  233. }
  234. .box {
  235. margin-top: 24rpx;
  236. height: 72rpx;
  237. border: 2rpx solid rgba(151, 151, 151, 0.3);
  238. }
  239. }
  240. .page {
  241. background-color: rgba(246, 246, 246, 1);
  242. width: 750rpx;
  243. min-height: 100vh;
  244. padding: 20rpx 28rpx 68rpx;
  245. }
  246. .stylebookbox {
  247. background: #FFFFFF;
  248. border-radius: 12rpx;
  249. padding: 38rpx 20rpx 44rpx;
  250. .apply {
  251. font-size: 32rpx;
  252. font-family: PingFangSC, PingFang SC;
  253. font-weight: 500;
  254. color: #222222;
  255. text-align: center;
  256. }
  257. .stylebook {
  258. font-size: 26rpx;
  259. font-family: PingFangSC, PingFang SC;
  260. font-weight: 400;
  261. color: #222222;
  262. margin-top: 50rpx;
  263. }
  264. .dotted {
  265. // margin-top: 30rpx;
  266. }
  267. }
  268. </style>