app-delivery.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <view class="app-delivery-module">
  3. <view class="module-com">
  4. <tui-list-cell class="line-cell" :hover="false">
  5. <view class="tui-title required">配送方式</view>
  6. <button @tap="form.sendType = 3" class="admin-button-com middle" :class="form.sendType == 3 ? 'blue' : 'default'">骑手送</button>
  7. <button @tap="form.sendType = 2" class="admin-button-com middle" style="margin-left:15upx;" :class="form.sendType == 2 ? 'blue' : 'default'">自己送</button>
  8. <button @tap="form.sendType = 1" class="admin-button-com middle" style="margin-left:15upx;" :class="form.sendType == 1 ? 'blue' : 'default'">到店自取</button>
  9. </tui-list-cell>
  10. <template>
  11. <tui-list-cell class="line-cell" :hover="false" :arrow="true">
  12. <view class="tui-title required" v-if="form.sendType == 1">取花日期</view>
  13. <view class="tui-title required" v-else>配送日期</view>
  14. <picker mode="date" :value="form.reachDate" @change="selTimeFn" class="tui-input">
  15. <view v-if="form.reachDate">{{ form.reachDate }}</view>
  16. <view v-else>今天</view>
  17. </picker>
  18. </tui-list-cell>
  19. <tui-list-cell class="line-cell" :hover="false" :arrow="false">
  20. <view class="tui-title required" v-if="form.sendType == 1">取花时间</view>
  21. <view class="tui-title required" v-else>配送时间</view>
  22. <picker mode="multiSelector" :value="form.reachPeriod" :range="timeOptions" @change="bindTimeChange">
  23. <view class="uni-input" style="width:450upx;">{{form.reachPeriod}}<text style="margin-left:10upx;">前</text></view>
  24. </picker>
  25. </tui-list-cell>
  26. </template>
  27. <tui-list-cell class="line-cell" :hover="false">
  28. <view class="tui-title required">订花人姓名</view>
  29. <input v-model="form.bookName" placeholder-class="phcolor" placeholder-style="color:#ccc;" style="width:282upx;" class="tui-input" name="bookName" placeholder="请填写姓名" />
  30. <button class="admin-button-com default middle" @click="form.bookName='游客'" style="margin-right:10upx;">填游客</button>
  31. </tui-list-cell>
  32. <tui-list-cell class="line-cell" :hover="false">
  33. <view class="tui-title">订花人手机</view>
  34. <input v-model="form.bookMobile" placeholder-class="phcolor" placeholder-style="color:#ccc" class="tui-input" type="number" name="bookMobile" placeholder="请填写手机号" />
  35. </tui-list-cell>
  36. <tui-list-cell class="line-cell" :hover="false">
  37. <view class="tui-title">贺卡内容</view>
  38. <input v-model="form.cardInfo" placeholder-class="phcolor" placeholder-style="color:#ccc" class="tui-input" name="cardInfo" placeholder="选填" />
  39. </tui-list-cell>
  40. <template v-if="form.sendType != 1">
  41. <tui-list-cell class="line-cell" :hover="false">
  42. <view class="tui-title">收花人姓名</view>
  43. <input v-model="form.receiveUserName" placeholder-class="phcolor" placeholder-style="color:#ccc" class="tui-input" name="receiveUserName" placeholder="请填写姓名" />
  44. </tui-list-cell>
  45. <tui-list-cell class="line-cell" :hover="false">
  46. <view class="tui-title">收花人手机</view>
  47. <input v-model="form.receiveMobile" placeholder-class="phcolor" placeholder-style="color:#ccc" class="tui-input" type="number" name="receiveMobile" placeholder="请填写手机号" />
  48. </tui-list-cell>
  49. <tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="selectCityFn">
  50. <view class="tui-title">所在城市</view>
  51. <view class="tui-input" v-if="form.province || form.city" >{{ form.province + '-' + form.city }}</view> <view class="tui-placeholder" v-else>请选择</view>
  52. </tui-list-cell>
  53. <tui-list-cell class="line-cell" :hover="false">
  54. <view class="tui-title">详细地址</view>
  55. <input v-model="form.address" placeholder-class="phcolor" placeholder-style="color:#ccc" class="tui-input" name="address" placeholder="请填写地址" @input="changeAddress()" />
  56. </tui-list-cell>
  57. <tui-list-cell class="line-cell" :hover="false">
  58. <view class="tui-title">楼号门牌</view>
  59. <input v-model="form.floor" placeholder-class="phcolor" placeholder-style="color:#ccc" class="tui-input" name="floor" placeholder="选填" @input="changeFloor()" />
  60. </tui-list-cell>
  61. </template>
  62. <template v-if="form.sendType != 1">
  63. <tui-list-cell class="line-cell" :hover="false">
  64. <view class="none-name-delivery flex-center" style="padding-left:0upx;">
  65. <view class="tui-title">匿名派送</view>
  66. <checkbox-group @change="anonymityChange" style="padding-left:70upx;">
  67. <checkbox class="ljd-checkbox" value="1" style="transform:scale(0.6,0.6)" id="noneNameText" ></checkbox>
  68. <label for="noneNameText" class="none-name-text">需要</label>
  69. </checkbox-group>
  70. </view>
  71. </tui-list-cell>
  72. </template>
  73. <tui-list-cell class="line-cell" :hover="false">
  74. <view class="tui-title">备注</view>
  75. <input v-model="form.remark" placeholder-class="phcolor" class="tui-input" placeholder-style="color:#ccc" name="remark" placeholder="选填" />
  76. </tui-list-cell>
  77. </view>
  78. <!-- 省市联动 -->
  79. <simple-address ref="simpleAddress" :region="regionTree" :pickerValueDefault="cityPickerValueDefault" @onConfirm="getCityConfirm" ></simple-address>
  80. </view>
  81. </template>
  82. <script>
  83. import { mapGetters } from "vuex";
  84. import TuiListCell from "@/components/plugin/list-cell";
  85. import AppDatePicker from "@/components/app-date-picker";
  86. import SimpleAddress from "@/components/plugin/simple-address";
  87. import AppAreaSel from "@/components/app-area-sel";
  88. import AppBindInfo from "@/components/app-bind-info";
  89. import {getShop} from "@/api/common"
  90. import {getRegion} from "@/api/shop"
  91. export default {
  92. name: "app-delivery-module",
  93. components: {
  94. AppAreaSel,
  95. TuiListCell,
  96. AppDatePicker,
  97. SimpleAddress,
  98. AppBindInfo
  99. },
  100. props: {},
  101. data() {
  102. return {
  103. region: [],
  104. showRegion: false,
  105. form: {
  106. sendType:3,
  107. receiveUserName: "",
  108. receiveMobile: "",
  109. province: "",
  110. city: "",
  111. address: "",
  112. showAddress:"",
  113. floor: "",
  114. fullAddress: "",
  115. bookName: '',
  116. bookMobile: "",
  117. reachDate: '',
  118. reachPeriod: "12:00",
  119. cardInfo: "",
  120. remark: "",
  121. anonymity:0
  122. },
  123. region: {latitude:10,longitude:11},
  124. regionTree:[],
  125. cityPickerValueDefault: [0, 0],
  126. timeOptions: [
  127. ['00', '01', '02','03','04','05','06','07','08','09','10','11','12','13', '14','15','16','17','18','19','20','21','22','23'],
  128. ['00', '05', '10','15','20','25','30','35','40','45','50','55']
  129. ],
  130. };
  131. },
  132. mounted() {
  133. let that = this
  134. getRegion().then(res=>{
  135. if(res.code == 1){
  136. that.regionTree = res.data.region
  137. getShop().then(res=>{
  138. if(res.code == 1){
  139. if(res.data.info){
  140. that.form.province = res.data.info.province
  141. that.form.city = res.data.info.city
  142. }
  143. }
  144. })
  145. }
  146. })
  147. },
  148. methods: {
  149. changeAddress(){
  150. this.form.showAddress = this.form.city+this.form.address+this.form.floor
  151. },
  152. changeFloor(){
  153. this.form.showAddress = this.form.city+this.form.address+this.form.floor
  154. },
  155. bindTimeChange(event){
  156. let val = event.detail.value
  157. let before = Number(val[0])
  158. let after = Number(val[1])
  159. let timeOptions = this.timeOptions
  160. this.form.reachPeriod = timeOptions[0][before]+':'+timeOptions[1][after]
  161. },
  162. selTimeFn(e) {
  163. this.form.reachDate = e.detail.value;
  164. },
  165. timeTodaySelFn(index) {
  166. this.form.reachPeriod = index;
  167. },
  168. anonymityChange() {
  169. this.form.anonymity = this.form.anonymity == 1 ? 0 : 1;
  170. },
  171. selectCityFn() {
  172. this.$refs.simpleAddress.open();
  173. },
  174. getCityConfirm(e) {
  175. this.form.province = e.provinceName;
  176. this.form.city = e.cityName;
  177. }
  178. }
  179. };
  180. </script>
  181. <style lang="scss" scoped>
  182. .app-delivery-module {
  183. .module-com {
  184. margin-bottom: 20upx;
  185. background-color: #fff;
  186. .module-tit {
  187. padding: 20upx 18upx;
  188. font-size: 28upx;
  189. font-weight: 600;
  190. border-bottom: 1px solid $borderColor;
  191. }
  192. .module-det {
  193. padding: 0 30upx;
  194. }
  195. }
  196. // 公共
  197. .line-cell {
  198. .tui-title {
  199. width: 210upx;
  200. color: $fontColor2;
  201. }
  202. .tui-input {
  203. width: calc(100% - 210upx);
  204. font-size: 28upx;
  205. }
  206. .tui-placeholder {
  207. color: #ccc;
  208. }
  209. .phcolor {
  210. color: #ccc;
  211. }
  212. }
  213. .delivery-time {
  214. @include disFlex(center, center);
  215. .button-com {
  216. padding-top: 14upx;
  217. padding-bottom: 10upx;
  218. margin-right:10upx;
  219. }
  220. }
  221. // 贺卡
  222. .gift-wrap {
  223. .gift-content {
  224. width: 100%;
  225. }
  226. .need-gift {
  227. margin-left: 14upx;
  228. color: $fontColor2;
  229. }
  230. .gitf-textarea {
  231. margin-top: 40upx;
  232. }
  233. }
  234. // 匿名派送
  235. .none-name-delivery {
  236. margin-bottom: 20upx;
  237. background-color: #fff;
  238. .none-name-text {
  239. margin-left: 10upx;
  240. color: $fontColor2;
  241. }
  242. }
  243. }
  244. </style>