app-delivery.vue 11 KB

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