app-delivery.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <div class="app-delivery-module">
  3. <!-- 配送公共组件 -->
  4. <!-- 收花人 -->
  5. <div class="module-com">
  6. <tui-list-cell class="line-cell" :hover="false">
  7. <div class="tui-title">收花人姓名</div>
  8. <input
  9. v-model="form.receiveUserName"
  10. placeholder-class="phcolor"
  11. placeholder-style="color:#ccc"
  12. class="tui-input"
  13. name="receiveUserName"
  14. placeholder="请填写姓名"
  15. />
  16. </tui-list-cell>
  17. <tui-list-cell class="line-cell" :hover="false">
  18. <div class="tui-title">收花人手机号</div>
  19. <input
  20. v-model="form.receiveMobile"
  21. placeholder-class="phcolor"
  22. placeholder-style="color:#ccc"
  23. class="tui-input"
  24. type="number"
  25. name="receiveMobile"
  26. placeholder="请填写手机号"
  27. />
  28. </tui-list-cell>
  29. <tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="openAddres">
  30. <div class="tui-title">所在城市</div>
  31. <div
  32. class="tui-input"
  33. v-if="form.province || form.city"
  34. >{{ form.province + '-' + form.city }}</div>
  35. <div class="tui-placeholder" v-else>请选择</div>
  36. </tui-list-cell>
  37. <tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="selRegionFn">
  38. <div class="tui-title">详细地址</div>
  39. <div class="tui-input" v-if="form.address">{{ form.address }}</div>
  40. <div class="tui-placeholder" v-else>请填写地址</div>
  41. </tui-list-cell>
  42. <tui-list-cell class="line-cell" :hover="false">
  43. <div class="tui-title">门牌号</div>
  44. <input
  45. v-model="form.floor"
  46. placeholder-class="phcolor"
  47. placeholder-style="color:#ccc"
  48. class="tui-input"
  49. name="floor"
  50. placeholder="楼号门牌号(选填)"
  51. />
  52. </tui-list-cell>
  53. <tui-list-cell class="line-cell" :hover="false" :arrow="true">
  54. <div class="tui-title">配送时间</div>
  55. <picker mode="date" :value="form.reachTime" @change="selTimeFn" class="tui-input">
  56. <div v-if="form.reachTime">{{ form.reachTime }}</div>
  57. <div class="tui-placeholder" v-else>请选择送达时间</div>
  58. </picker>
  59. </tui-list-cell>
  60. <div class="delivery-time">
  61. <button
  62. class="button-com"
  63. :class="[form.reachPeriod == 0 ? 'red' : 'default']"
  64. @click="timeTodaySelFn(0)"
  65. >上午</button>
  66. <button
  67. class="button-com"
  68. :class="[form.reachPeriod == 1 ? 'red' : 'default']"
  69. @click="timeTodaySelFn(1)"
  70. >下午</button>
  71. <button
  72. class="button-com"
  73. :class="[form.reachPeriod == 2 ? 'red' : 'default']"
  74. @click="timeTodaySelFn(2)"
  75. >晚上</button>
  76. </div>
  77. <tui-list-cell class="line-cell" :hover="false">
  78. <div class="tui-title">订花人姓名</div>
  79. <input
  80. v-model="form.bookName"
  81. placeholder-class="phcolor"
  82. placeholder-style="color:#ccc"
  83. class="tui-input"
  84. name="bookName"
  85. placeholder="请填写姓名(选填)"
  86. />
  87. </tui-list-cell>
  88. <tui-list-cell class="line-cell" :hover="false">
  89. <div class="tui-title">订花人手机号</div>
  90. <input
  91. v-model="form.bookMobile"
  92. placeholder-class="phcolor"
  93. placeholder-style="color:#ccc"
  94. class="tui-input"
  95. type="number"
  96. name="bookMobile"
  97. placeholder="请填写手机号(选填)"
  98. />
  99. </tui-list-cell>
  100. <tui-list-cell class="line-cell" :hover="false">
  101. <div class="none-name-delivery flex-center" style="padding-left:0rpx;">
  102. <div class="tui-title">派送方式</div>
  103. <checkbox-group @change="anonymityChange" style="padding-left:70rpx;">
  104. <checkbox class="ljd-checkbox" value="1" id="noneNameText" ></checkbox>
  105. <label for="noneNameText" class="none-name-text">匿名派送</label>
  106. </checkbox-group>
  107. </div>
  108. </tui-list-cell>
  109. </div>
  110. <!-- 备注 -->
  111. <div class="module-com remark-wrap">
  112. <tui-list-cell class="line-cell" :hover="false">
  113. <div class="tui-title">备注</div>
  114. <input
  115. v-model="form.remark"
  116. placeholder-class="phcolor"
  117. class="tui-input"
  118. placeholder-style="color:#ccc"
  119. name="remark"
  120. placeholder="选填"
  121. />
  122. </tui-list-cell>
  123. </div>
  124. <!-- 省市联动 -->
  125. <simple-address
  126. ref="simpleAddress"
  127. :region="orderShop.region"
  128. :pickerValueDefault="cityPickerValueDefault"
  129. @onConfirm="onCityConfirm"
  130. ></simple-address>
  131. <!-- 选择地区 -->
  132. <app-area-sel :show.sync="showRegion" :city="form.city" @change="changeAreaFn" />
  133. </div>
  134. </template>
  135. <script>
  136. import { mapGetters } from "vuex";
  137. import TuiListCell from "@/components/plugin/list-cell";
  138. import AppDatePicker from "@/components/app-date-picker";
  139. import SimpleAddress from "@/components/plugin/simple-address";
  140. import AppAreaSel from "@/components/app-area-sel";
  141. import AppBindInfo from "@/components/app-bind-info";
  142. export default {
  143. name: "app-delivery-module",
  144. components: {
  145. AppAreaSel,
  146. TuiListCell,
  147. AppDatePicker,
  148. SimpleAddress,
  149. AppBindInfo
  150. },
  151. props: {},
  152. data() {
  153. return {
  154. region: [],
  155. showRegion: false,
  156. form: {
  157. receiveUserName: "", // 收花人姓名;到店自提的姓名
  158. receiveMobile: "", // 收花人手机;到店自提的电话;
  159. province: "", // 收花人省份
  160. city: "", // 收花人城市
  161. address: "", // 收花人城市
  162. floor: "", // 收花人门楼号和牌号
  163. fullAddress: "", // 收花人完整地址,从腾讯地图接口获取
  164. bookName: '', // 订花人姓名
  165. bookMobile: "", // 订花人手机号
  166. reachTime: 0, // 配送时间
  167. reachPeriod: "0", // 配送时段,0上午1下午2晚上
  168. needCard: "1", // 是否要贺卡 0不要 1要
  169. cardInfo: "", // 贺卡信息
  170. remark: "",// 备注
  171. anonymity:0
  172. },
  173. region: {
  174. latitude: 0,
  175. longitude: 0
  176. },
  177. // 省市联动
  178. cityPickerValueDefault: [0, 0]
  179. };
  180. },
  181. computed: {
  182. ...mapGetters({ orderShop: "getOrderShop" })
  183. },
  184. watch: {
  185. orderShop(val) {
  186. console.log("val", val);
  187. this.form.province = val.shop.province ? val.shop.province : "";
  188. this.form.city = val.shop.city ? val.shop.city : "";
  189. }
  190. },
  191. mounted() {
  192. if (!this.$util.isEmpty(this.orderShop)) {
  193. this.form.province = this.orderShop.shop.province
  194. ? this.orderShop.shop.province
  195. : "";
  196. this.form.city = this.orderShop.shop.city
  197. ? this.orderShop.shop.city
  198. : "";
  199. }
  200. },
  201. methods: {
  202. selTimeFn(e) {
  203. this.form.reachTime = e.detail.value;
  204. },
  205. // 选择地址
  206. selRegionFn() {
  207. if (!this.form.city) {
  208. this.$msg("请选择城市");
  209. return false;
  210. }
  211. this.showRegion = true;
  212. },
  213. changeAreaFn(e) {
  214. console.log("changeAreaFn", e);
  215. this.form.address = e.title;
  216. this.form.fullAddress = e.address;
  217. this.region.latitude = e.location.lat;
  218. this.region.longitude = e.location.lng;
  219. this.$emit("changeAddress", e);
  220. },
  221. timeTodaySelFn(index) {
  222. this.form.reachPeriod = index;
  223. },
  224. needCardChange() {
  225. this.form.needCard = this.form.needCard == 1 ? 0 : 1;
  226. },
  227. anonymityChange() {
  228. this.form.anonymity = this.form.anonymity == 1 ? 0 : 1;
  229. },
  230. // 省市联动
  231. openAddres() {
  232. this.$refs.simpleAddress.open();
  233. },
  234. onCityConfirm(e) {
  235. this.form.address = e.label;
  236. this.form.province = e.provinceName;
  237. this.form.city = e.cityName;
  238. }
  239. }
  240. };
  241. </script>
  242. <style lang="scss" scoped>
  243. .app-delivery-module {
  244. .module-com {
  245. margin-bottom: 20px;
  246. background-color: #fff;
  247. .module-tit {
  248. padding: 20px 18px;
  249. font-size: 28px;
  250. font-weight: 600;
  251. border-bottom: 1px solid $borderColor;
  252. }
  253. .module-det {
  254. padding: 0 30px;
  255. }
  256. }
  257. // 公共
  258. .line-cell {
  259. .tui-title {
  260. width: 210px;
  261. color: $fontColor2;
  262. }
  263. .tui-input {
  264. width: calc(100% - 210px);
  265. font-size: 28px;
  266. }
  267. .tui-placeholder {
  268. color: #ccc;
  269. }
  270. .phcolor {
  271. color: #ccc;
  272. }
  273. }
  274. // 今天时间选择
  275. .delivery-time {
  276. @include disFlex(center, center);
  277. background-color: #fff;
  278. padding: 20px 0;
  279. // border-top: 1px solid $borderColor;
  280. .button-com {
  281. padding-top: 14px;
  282. padding-bottom: 10px;
  283. margin: 0 10px;
  284. }
  285. }
  286. // 贺卡
  287. .gift-wrap {
  288. .gift-content {
  289. width: 100%;
  290. }
  291. .need-gift {
  292. margin-left: 14px;
  293. color: $fontColor2;
  294. }
  295. .gitf-textarea {
  296. margin-top: 40px;
  297. }
  298. }
  299. // 匿名派送
  300. .none-name-delivery {
  301. // padding-left: 30px;
  302. // padding: 26px 30px;
  303. // margin-top: 40px;
  304. margin-bottom: 20px;
  305. background-color: #fff;
  306. .none-name-text {
  307. margin-left: 14px;
  308. color: $fontColor2;
  309. }
  310. }
  311. }
  312. </style>