receive.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. <template>
  2. <view class="receive">
  3. <view class="gift-box">
  4. <view class="xzgift">
  5. <view class="xzlb"><text class="juxing"></text>选择礼包</view>
  6. <view class="fanhui" @click="fabhui"></view>
  7. </view>
  8. <view class="gift-item" v-for="(item,index) in lqgiftList" :key="index">
  9. <view class="gift-img"><image :src="$PIC(item.image)"></image></view>
  10. <view class="title-box">
  11. <view>
  12. <view class="zhengbt">{{item.title}}</view>
  13. <view class="fubt">{{item.subtitle}}</view>
  14. </view>
  15. <view class="jiaqian">
  16. <!-- <view><text class="text1">¥</text><text class="text2">{{item.price}}</text></view> -->
  17. <view>x1</view>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="yuan-box">
  22. <view class="yuan1"></view>
  23. <view class="yuan2"></view>
  24. </view>
  25. <view class="xzgift" style="margin-bottom: 60rpx;">
  26. <view class="xzlb"><text class="juxing"></text>填写收货地址</view>
  27. </view>
  28. <view class="input-title">收件人姓名</view>
  29. <view><input type="text" placeholder-style="color:#ccc" value="" v-model="param.name" placeholder="请输入收件人姓名" @blur="inputBlur1"/></view>
  30. <view class="input-title">手机号码</view>
  31. <view><input type="text" placeholder-style="color:#ccc" value="" v-model="param.mobile" placeholder="请输入手机号码" @blur="inputBlur2" /></view>
  32. <view @click="chooseLocation">
  33. <view class="input-title">选择省市区</view>
  34. <view><input type="text" placeholder-style="color:#ccc" value="" placeholder="请选择" disabled="true" v-model="param.province_city"/></view>
  35. </view>
  36. <view class="input-title">详细地址</view>
  37. <view><input type="text" placeholder-style="color:#ccc" value="" v-model="param.address" placeholder="请输入" @blur="inputBlur4" /></view>
  38. <!-- <view class="input-title">发货日期</view>
  39. <view><input type="text" placeholder-style="color:#ccc" value="" placeholder="请选择" /></view> -->
  40. <view class="yzm" v-if="yzm=='1'">
  41. <view>
  42. <view class="input-title">验证码</view>
  43. <view><input style="margin-bottom: 0;" placeholder-style="color:#ccc" type="text" value="" placeholder="点击更换验证码" @blur="inputBlur5" v-model="param.code" /></view>
  44. </view>
  45. <view class="yzn-img" @click="GetValidCode"><image :src="$ANNEX_URL + '/index.php?s=/captcha&j=' + j"></image></view>
  46. </view>
  47. <view class="input-title">备注</view>
  48. <view style="height: 80rpx;"><textarea style="width: 100%;height: 100%;" v-model="param.comments" type="text" placeholder-style="color:#ccc" value="" placeholder="选填, 请输入" @blur="inputBlur6"/></view>
  49. </view>
  50. <w-picker
  51. mode="region"
  52. :defaultVal="['浙江省','杭州市','江干区']"
  53. :areaCode="['33','3301','330108']"
  54. :hideArea="false"
  55. @confirm="onConfirm"
  56. @cancel="onCancel"
  57. ref="region"
  58. themeColor="#FF5A1F">
  59. </w-picker>
  60. <view class="chengnuo">
  61. <view class="td">
  62. 郑重承诺:
  63. </view>
  64. <view class="bd">
  65. 收件地址仅用于邮寄兑换的礼品,不会泄露给第三方
  66. </view>
  67. </view>
  68. <view class="xyb" @click="submit">
  69. 确定
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. import wPicker from "@/components/w-picker/w-picker.vue";
  75. export default {
  76. components: {wPicker},
  77. data() {
  78. return {
  79. lqgiftList: [],
  80. yzm: '0',
  81. j: '',
  82. erweima: '',
  83. ismobile: true,
  84. param: {
  85. gp_id: '',
  86. gg_ids: '',
  87. name: '',
  88. mobile: '',
  89. province_city: '',
  90. address: '',
  91. comments: '',
  92. code: '',
  93. card_id: '',
  94. card_pwd: '',
  95. }
  96. }
  97. },
  98. onLoad(e) {
  99. this.yzm = uni.getStorageSync("captcha");
  100. this.lqgiftList = uni.getStorageSync("lqgiftList");
  101. if(!this.lqgiftList){
  102. uni.navigateTo({
  103. url: "/pages/gift/gift"
  104. })
  105. return;
  106. }
  107. this.param.gp_id = e.gp_id;
  108. this.param.gg_ids = e.gg_ids;
  109. this.param.name = uni.getStorageSync("name");
  110. this.param.mobile = uni.getStorageSync("mobile");
  111. this.param.province_city = uni.getStorageSync("province_city");
  112. this.param.address = uni.getStorageSync("address");
  113. this.param.code = uni.getStorageSync("code");
  114. this.param.comments = uni.getStorageSync("comments");
  115. this.param.card_id = uni.getStorageSync("card_id");
  116. this.param.card_pwd = uni.getStorageSync("card_pwd");
  117. if(this.yzm == '1') {
  118. this.GetValidCode()
  119. }
  120. },
  121. methods: {
  122. fabhui() {
  123. uni.navigateBack({
  124. delta:1
  125. })
  126. },
  127. xiayibu() {
  128. uni.navigateTo({
  129. url: "/pages/logistics/logistics"
  130. })
  131. },
  132. chooseLocation: function () {
  133. if(this.ismobile) {
  134. this.$refs.region.show()
  135. }
  136. },
  137. onConfirm(val){
  138. this.param.province_city = val.result
  139. uni.setStorageSync("province_city",this.param.province_city)
  140. this.$refs.region.hide()
  141. //如果页面需要调用多个mode类型,可以根据mode处理结果渲染到哪里;
  142. // switch(this.mode){
  143. // case "date":
  144. // break;
  145. // }
  146. },
  147. onCancel(val) {
  148. this.$refs.region.hide()
  149. },
  150. GetValidCode() {
  151. // var oldstr = "http://jz.jiuduanfw.com/index.php?s=/captcha";
  152. // var newStr = oldstr + '&j=' + Math.random();
  153. var j = Math.random()
  154. this.j = j
  155. // this.$GET_FUN('index.php?s=/captcha', {'j': j}, res => {
  156. // console.log('2',res)
  157. // if (res.data.code == 1) {
  158. // this.erweima = res.data.data.image
  159. // }else {
  160. // }
  161. // });
  162. },
  163. inputBlur1(val) {
  164. var inputValue = event.target.value
  165. uni.setStorageSync("name",inputValue)
  166. },
  167. inputBlur2(val) {
  168. var inputValue = event.target.value
  169. uni.setStorageSync("mobile",inputValue)
  170. var mobileReg = /^1[3456789]\d{9}$/;
  171. if (!mobileReg.test(inputValue)) {
  172. this.ismobile = false
  173. uni.showToast({
  174. title: '请输入正确的手机号码',
  175. icon: 'none'
  176. });
  177. }else {
  178. this.ismobile = true
  179. }
  180. },
  181. inputBlur4(val) {
  182. var inputValue = event.target.value
  183. uni.setStorageSync("address",inputValue)
  184. },
  185. inputBlur5(val) {
  186. var inputValue = event.target.value
  187. uni.setStorageSync("code",inputValue)
  188. },
  189. inputBlur6(val) {
  190. var inputValue = event.target.value
  191. uni.setStorageSync("comments",inputValue)
  192. },
  193. submit() {
  194. var _this = this
  195. var mobileReg = /^1[3456789]\d{9}$/;
  196. if (!mobileReg.test(this.param.mobile)) {
  197. uni.showToast({
  198. title: '请输入正确的手机号码',
  199. icon: 'none'
  200. });
  201. }else {
  202. _this.$GET_FUN('/addons/pickup/pickupapi/setGiftOrder', this.param, res => {
  203. if (res.data.code == 1) {
  204. uni.reLaunch({
  205. url: "/pages/success/success"
  206. })
  207. }else {
  208. uni.showToast({
  209. title: res.data.msg,
  210. icon: 'none'
  211. });
  212. }
  213. });
  214. }
  215. }
  216. }
  217. }
  218. </script>
  219. <style>
  220. .receive {
  221. line-height: 1;
  222. background: linear-gradient(to top ,#FDC2B9 ,#FCC295);
  223. padding-bottom: 30rpx;
  224. }
  225. .gift-box {
  226. position: relative;
  227. top: 30rpx;
  228. margin: 0rpx 20rpx 70rpx;
  229. padding: 30rpx 30rpx 56rpx 42rpx;
  230. background: #fff;
  231. border-radius:24rpx;
  232. }
  233. .xzgift {
  234. display: flex;
  235. justify-content: space-between;
  236. align-items: center;
  237. margin-bottom: 44rpx;
  238. position: relative;
  239. left: -12rpx;
  240. }
  241. .fanhui {
  242. width: 18rpx;
  243. height: 18rpx;
  244. border-top: 4rpx solid #999999;
  245. border-right: 4rpx solid #999999;
  246. transform: rotate(45deg);
  247. }
  248. .xzlb {
  249. font-size: 34rpx;
  250. color: #1A1A1A;
  251. font-weight: bold;
  252. }
  253. .juxing{
  254. display: inline-block;
  255. width: 12rpx;
  256. height: 30rpx;
  257. background: #B32424;
  258. margin-right: 16rpx;
  259. }
  260. .gift-item {
  261. border-radius: 16rpx;
  262. display: flex;
  263. align-items: center;
  264. margin-bottom: 30rpx;
  265. }
  266. .gift-img {
  267. width: 200rpx;
  268. height: 200rpx;
  269. border-radius: 16rpx;
  270. margin-right: 24rpx;
  271. overflow: hidden;
  272. }
  273. .gift-img image {
  274. width: 100%;
  275. height: 100%;
  276. }
  277. .title-box {
  278. display: flex;
  279. flex-direction: column;
  280. justify-content: space-between;
  281. font-size: 28rpx;
  282. color: #1A1A1A;
  283. font-weight: 500;
  284. height: 200rpx;
  285. padding: 15rpx 0;
  286. box-sizing: border-box;
  287. width: 410rpx;
  288. line-height: 1.3;
  289. }
  290. .zhengbt {
  291. display: -webkit-box;
  292. -webkit-line-clamp: 2;
  293. -webkit-box-orient: vertical;
  294. overflow: hidden;
  295. }
  296. .fubt {
  297. font-size: 24rpx;
  298. color: #999999;
  299. margin-top: 10rpx;
  300. text-overflow: ellipsis;
  301. display: -webkit-box;
  302. -webkit-line-clamp: 2;
  303. -webkit-box-orient: vertical;
  304. overflow: hidden;
  305. }
  306. .jiaqian {
  307. display: flex;
  308. justify-content: space-between;
  309. align-items: flex-end;
  310. font-size: 24rpx;
  311. color: #999999;
  312. font-weight: 500;
  313. }
  314. .text1 {
  315. font-size: 22rpx;
  316. color: #EB3026;
  317. font-weight: bold;
  318. }
  319. .text2 {
  320. font-size: 40rpx;
  321. color: #EB3026;
  322. font-weight: bold;
  323. }
  324. .yuan-box {
  325. display: flex;
  326. justify-content: space-between;
  327. align-items: center;
  328. position: relative;
  329. margin: 45rpx 0;
  330. }
  331. .yuan1 {
  332. width: 30rpx;
  333. height: 30rpx;
  334. background: rgb(255, 195, 159);
  335. border-radius: 50%;
  336. position: absolute;
  337. left: -58rpx;
  338. }
  339. .yuan2 {
  340. width: 30rpx;
  341. height: 30rpx;
  342. background: rgb(255, 195, 159);
  343. border-radius: 50%;
  344. position: absolute;
  345. right: -44rpx;
  346. }
  347. .input-title {
  348. font-size: 28rpx;
  349. color: #050505;
  350. font-weight: bold;
  351. margin-bottom: 30rpx;
  352. }
  353. input {
  354. font-size: 36rpx;
  355. margin-bottom: 68rpx;
  356. }
  357. .yzm {
  358. display: flex;
  359. justify-content: space-between;
  360. align-items: center;
  361. margin-bottom: 68rpx;
  362. }
  363. .yzn-img {
  364. width: 190rpx;
  365. height: 86rpx;
  366. flex: 1;
  367. }
  368. .yzn-img image {
  369. width: 100%;
  370. height: 100%;
  371. }
  372. .xiayibu {
  373. width: 690rpx;
  374. height: 94rpx;
  375. border-radius:6rpx;
  376. line-height: 94rpx;
  377. text-align: center;
  378. margin: 92rpx auto 30rpx;
  379. background: #999999;
  380. font-size: 36rpx;
  381. color: #fff;
  382. font-weight: 500;
  383. }
  384. .xyb {
  385. width: 690rpx;
  386. height: 94rpx;
  387. border-radius:6rpx;
  388. line-height: 94rpx;
  389. text-align: center;
  390. margin: 32rpx auto 30rpx;
  391. background: linear-gradient(to top, #C82D2D, #E06363);
  392. font-size: 36rpx;
  393. color: #fff;
  394. font-weight: 500;
  395. }
  396. .chengnuo{ font-size: 26rpx; text-align: left; margin: 20rpx 40rpx 0; color: #565656;}
  397. .chengnuo .td{ font-size: 32rpx;}
  398. .chengnuo .bd{ margin-top: 10rpx; text-indent: 2em;}
  399. </style>